Skip to content

Commit 69319ba

Browse files
committed
Fix for yarn stuff
1 parent 24a6011 commit 69319ba

File tree

3 files changed

+20
-9732
lines changed

3 files changed

+20
-9732
lines changed

createReactWpTheme.js

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ const scriptsFromNpm = function() {
6969
};
7070

7171
const scriptsFromGit = function() {
72+
const deleteFolderRecursive = (path) => {
73+
if (fs.existsSync(path)) {
74+
fs.readdirSync(path).forEach(function(file) {
75+
let curPath = path + "/" + file;
76+
if (fs.statSync(curPath).isDirectory()) {
77+
// recurse
78+
deleteFolderRecursive(curPath);
79+
} else {
80+
// delete file
81+
fs.unlinkSync(curPath);
82+
}
83+
});
84+
85+
fs.rmdirSync(path);
86+
}
87+
}
88+
7289
const tempFolderName = "temp";
7390
fs.ensureDirSync(tempFolderName);
7491
process.chdir(tempFolderName);
@@ -197,17 +214,8 @@ function createApp(
197214

198215
const useYarn = useNpm ? false : shouldUseYarn();
199216
const originalDirectory = process.cwd();
200-
process.chdir(root);
201-
if (!useYarn && !checkThatNpmCanReadCwd()) {
202-
process.exit(1);
203-
}
204217

205-
if (useYarn) {
206-
fs.copySync(
207-
require.resolve('./yarn.lock.cached'),
208-
path.join(root, 'yarn.lock')
209-
);
210-
}
218+
process.chdir(appName); // change into the newly created folder, then run create-react-app.
211219

212220
createWpTheme(
213221
root,
@@ -347,6 +355,7 @@ function checkAppName(appName) {
347355
`"${appName}"`
348356
)} because of npm naming restrictions:`
349357
);
358+
350359
printValidationResults(validationResult.errors);
351360
printValidationResults(validationResult.warnings);
352361
process.exit(1);
@@ -468,20 +477,3 @@ function checkIfOnline(useYarn) {
468477
});
469478
});
470479
}
471-
472-
function deleteFolderRecursive(path) {
473-
if (fs.existsSync(path)) {
474-
fs.readdirSync(path).forEach(function(file) {
475-
let curPath = path + "/" + file;
476-
if (fs.statSync(curPath).isDirectory()) {
477-
// recurse
478-
deleteFolderRecursive(curPath);
479-
} else {
480-
// delete file
481-
fs.unlinkSync(curPath);
482-
}
483-
});
484-
485-
fs.rmdirSync(path);
486-
}
487-
}

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": "2.1.1-wptheme-2.0.4",
3+
"version": "2.1.1-wptheme-2.0.5",
44
"description": "Create React WP themes with no build configuration.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)