Skip to content

Commit 6c711bb

Browse files
eric-parsonsEric Parsons
andauthored
Fixing an issue with the create script not working. (#50)
Co-authored-by: Eric Parsons <eric.parsons@vertigis.com>
1 parent 4ff3fb0 commit 6c711bb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scripts/create.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ const installNpmDeps = projectPath => {
8282
// user's machine. This can have unintended side-effects, such as generating
8383
// a lock file with the wrong version. Temporarily rename the whole folder
8484
// to avoid this.
85-
fs.renameSync(
86-
path.join(rootDir, "node_modules", ".bin"),
87-
path.join(rootDir, "node_modules", ".bin.ignore")
88-
);
85+
const localBinDir = path.join(rootDir, "node_modules", ".bin");
86+
const localBinDirRenamed = `${localBinDir}.ignore`;
87+
if (fs.existsSync(localBinDir)) {
88+
fs.renameSync(localBinDir, localBinDirRenamed);
89+
}
8990

9091
try {
9192
// First install existing deps.
@@ -116,10 +117,9 @@ const installNpmDeps = projectPath => {
116117
)
117118
);
118119
} finally {
119-
fs.renameSync(
120-
path.join(rootDir, "node_modules", ".bin.ignore"),
121-
path.join(rootDir, "node_modules", ".bin")
122-
);
120+
if (fs.existsSync(localBinDirRenamed)) {
121+
fs.renameSync(localBinDirRenamed, localBinDir);
122+
}
123123
}
124124
};
125125

0 commit comments

Comments
 (0)