create-curb.js 1.16.0-preview.4 → 1.16.0-preview.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RELEASE_NOTES.md +2 -0
- package/bin/create-curb.js +10 -2
- package/package.json +1 -1
package/RELEASE_NOTES.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
### Fixed
|
|
8
8
|
|
|
9
|
+
- Refuse unknown arguments to curb upgrade (#39)
|
|
10
|
+
- Explain a target folder that cannot be created (#40)
|
|
9
11
|
- Say what hosted deploys accept today (#46)
|
|
10
12
|
- Correct what the help and guide say about conversations and build (#41)
|
|
11
13
|
- Start curb outside a project from the npm package (#38)
|
package/bin/create-curb.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
readFileSync,
|
|
13
13
|
readdirSync,
|
|
14
14
|
renameSync,
|
|
15
|
+
statSync,
|
|
15
16
|
writeFileSync,
|
|
16
17
|
} from "node:fs";
|
|
17
18
|
import { basename, dirname, join, resolve } from "node:path";
|
|
@@ -118,6 +119,9 @@ if (!/^[a-z0-9][a-z0-9._-]*$/.test(appName)) {
|
|
|
118
119
|
`"${appName}" is not a valid project name — use lowercase letters, digits, ".", "_", "-" (npm package name rules).`,
|
|
119
120
|
);
|
|
120
121
|
}
|
|
122
|
+
if (existsSync(targetDir) && !statSync(targetDir).isDirectory()) {
|
|
123
|
+
fail(`${targetDir} is a file. Choose a new directory.`);
|
|
124
|
+
}
|
|
121
125
|
if (existsSync(targetDir) && readdirSync(targetDir).length > 0) {
|
|
122
126
|
fail(`${targetDir} already exists and is not empty. Choose a new directory.`);
|
|
123
127
|
}
|
|
@@ -301,8 +305,12 @@ const envValues = finalizeEnv();
|
|
|
301
305
|
|
|
302
306
|
// -------------------------------------------------------------- copy template
|
|
303
307
|
const templateDir = resolve(dirname(fileURLToPath(import.meta.url)), "../templates/default");
|
|
304
|
-
|
|
305
|
-
|
|
308
|
+
try {
|
|
309
|
+
mkdirSync(targetDir, { recursive: true });
|
|
310
|
+
cpSync(templateDir, targetDir, { recursive: true });
|
|
311
|
+
} catch (error) {
|
|
312
|
+
fail(`Cannot create the project in ${targetDir} (${error.code ?? error.message}). Choose a directory you can write to.`);
|
|
313
|
+
}
|
|
306
314
|
|
|
307
315
|
// npm strips .gitignore from published tarballs, so the template ships it without the
|
|
308
316
|
// leading dot. The project carries no .npmrc: hosted builds refuse one.
|