Skip to content

Commit 41e6269

Browse files
committed
Issue 45
1 parent f91334e commit 41e6269

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

packages/create-react-wptheme-utils/getUserConfig.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,43 +26,47 @@ function _getUserConfig(paths, configName, defaultConfig) {
2626
userConfig = require(path.join(paths.appPath, configName));
2727
} catch (err) {
2828
userConfig = JSON.stringify(defaultConfig, null, 4);
29-
_writeUserConfig(paths, configName, userConfig);
29+
// Issue 45; Always write the dev config on error; only write the prod config if it is complete.
30+
if (configName === _userDevConfigName || (configName === _userProdConfigName && defaultConfig && typeof defaultConfig.homepage === "string")) {
31+
_writeUserConfig(paths, configName, userConfig);
32+
}
3033
return defaultConfig;
3134
}
3235

3336
return userConfig;
3437
}
3538

36-
module.exports = function(paths, nodeEnv) {
39+
module.exports = function (paths, nodeEnv) {
3740
const appPackageJson = require(paths.appPackageJson);
3841

3942
const defaultUserDevConfig = {
4043
fileWatcherPlugin: {
4144
touchFile: "./public/index.php",
4245
ignored: "./public/index.php",
43-
watchFileGlobs: ["./public/**/*.js", "./public/**/*.css", "./public/**/*.php"]
46+
watchFileGlobs: ["./public/**/*.js", "./public/**/*.css", "./public/**/*.php"],
4447
},
4548
wpThemeServer: {
4649
enable: true,
4750
host: "127.0.0.1",
4851
port: 8090,
4952
sslCert: null,
5053
sslKey: null,
51-
watchFile: "../index.php"
54+
watchFile: "../index.php",
5255
},
5356
injectWpThemeClient: {
5457
override: null,
55-
file: "./build/index.php"
56-
}
58+
file: "./build/index.php",
59+
},
5760
};
5861

5962
const defaultUserProdConfig = {
6063
finalBuildPath: null,
61-
homepage: appPackageJson.homepage
64+
homepage: appPackageJson.homepage,
6265
};
6366

6467
// Create both files ASAP.
6568
if (!wpThemePostInstallerInfo.postInstallerExists(paths)) {
69+
nodeEnv = "init"; // Issue 45; this should only happen during setup of a new theme...
6670
_getUserConfig(paths, _userDevConfigName, defaultUserDevConfig);
6771
_getUserConfig(paths, _userProdConfigName, defaultUserProdConfig);
6872
}
@@ -78,6 +82,7 @@ module.exports = function(paths, nodeEnv) {
7882
switch (nodeEnv) {
7983
case "dev":
8084
case "development":
85+
case "init":
8186
return _getUserConfig(paths, _userDevConfigName, defaultUserDevConfig);
8287
case "build":
8388
case "prod":

packages/create-react-wptheme-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devloco/create-react-wptheme-utils",
3-
"version": "3.4.0-wp.2",
3+
"version": "3.4.0-wp.11",
44
"description": "Utilities used by create-react-wptheme.",
55
"engines": {
66
"node": ">=8"

packages/create-react-wptheme/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
# Create React WP Theme
22

3-
## Still Up to Date
3+
Facebook released v3.4.1 of Create-React-App. I'm preparing an update that should be done soon.
44

5-
Mar. 19, 2020
5+
Until then you can continue to create new projects using v3.4.0. When the new release is ready, updating is easy!
6+
7+
## Update to 3.4.1 Coming Soon
8+
9+
Apr. 12, 2020
610
<br />
7-
It's been a while, so I thought I'd just let everyone know that [v3.4.0](https://github.com/facebook/create-react-app/releases/tag/v3.4.0) of `Create-React-App` is still the latest. I'll keep my eye on it and update this project whenever Facebook releases a new version.
11+
Facebook released [v3.4.1](https://github.com/facebook/create-react-app/releases/tag/v3.4.1) of `Create-React-App`. I'm preparing an update and should be done soon.
12+
13+
Until then you can continue to create new projects using [v3.4.0](https://github.com/facebook/create-react-app/releases/tag/v3.4.0). When the new release is ready,
14+
[updating is easy](https://github.com/devloco/create-react-wptheme/tree/master#updating-existing-themes)!
815

916
---
1017

packages/create-react-wptheme/createReactWpTheme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const _wpThemeVersion = packageJson.version;
4343
const _createReactAppVersion = _wpThemeVersion.split("-wp.")[0];
4444

4545
// Check these!!!!
46-
const _reactScriptsWpThemeVersion = "^3.4.0-wp.2";
46+
const _reactScriptsWpThemeVersion = "^3.4.0-wp.9";
4747
const _getScriptsPath = function () {
4848
return scriptsFromNpm();
4949
};

packages/create-react-wptheme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-react-wptheme",
3-
"version": "3.4.0-wp.4",
3+
"version": "3.4.0-wp.7",
44
"description": "Create React-enabled WP themes.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)