create-vttforge 0.3.30 → 0.3.32
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/bin.mjs +49 -22
- package/package.json +2 -2
package/bin.mjs
CHANGED
|
@@ -4,65 +4,92 @@
|
|
|
4
4
|
*
|
|
5
5
|
* `pnpm create vttforge my-system` (or `npm create vttforge@latest my-system`,
|
|
6
6
|
* `bun create vttforge my-system`, `yarn create vttforge my-system`) invokes
|
|
7
|
-
* this binary. We forward the args
|
|
8
|
-
*
|
|
7
|
+
* this binary. We forward the args to `@vttforge/cli`'s `init` subcommand so
|
|
8
|
+
* the scaffolder code lives in exactly one place.
|
|
9
|
+
*
|
|
10
|
+
* The flag list mirrors `vttforge init`. It used to carry four of them, so
|
|
11
|
+
* `--description` and the rest of the manifest fields were unreachable through
|
|
12
|
+
* the entry point most people actually use, and a scaffold came out holding
|
|
13
|
+
* the template's placeholder text.
|
|
9
14
|
*/
|
|
10
15
|
import { runInit } from '@vttforge/cli';
|
|
11
16
|
|
|
12
17
|
const args = process.argv.slice(2);
|
|
13
18
|
|
|
19
|
+
/** Flags taking a value, mapped to the `runInit` option they fill. */
|
|
20
|
+
const VALUE_FLAGS = new Map([
|
|
21
|
+
['--type', 'type'],
|
|
22
|
+
['-t', 'type'],
|
|
23
|
+
['--lang', 'lang'],
|
|
24
|
+
['-l', 'lang'],
|
|
25
|
+
['--id', 'id'],
|
|
26
|
+
['--title', 'title'],
|
|
27
|
+
['--description', 'description'],
|
|
28
|
+
['--author', 'author'],
|
|
29
|
+
['--license', 'license'],
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
const options = {};
|
|
14
33
|
let name;
|
|
15
|
-
let type;
|
|
16
|
-
let lang;
|
|
17
|
-
let noInstall = false;
|
|
18
|
-
let noGit = false;
|
|
19
34
|
|
|
20
35
|
for (let i = 0; i < args.length; i += 1) {
|
|
21
36
|
const arg = args[i];
|
|
22
37
|
if (arg === undefined) continue;
|
|
38
|
+
|
|
23
39
|
// Accept both the create-* convention (--no-install, --no-git) and the
|
|
24
40
|
// affirmative form (--install=false). Defaults are install + git enabled.
|
|
25
41
|
if (arg === '--no-install' || arg === '--install=false') {
|
|
26
|
-
noInstall = true;
|
|
42
|
+
options.noInstall = true;
|
|
27
43
|
continue;
|
|
28
44
|
}
|
|
29
45
|
if (arg === '--no-git' || arg === '--git=false') {
|
|
30
|
-
noGit = true;
|
|
46
|
+
options.noGit = true;
|
|
31
47
|
continue;
|
|
32
48
|
}
|
|
33
|
-
if (arg === '--
|
|
34
|
-
|
|
35
|
-
type = args[i];
|
|
49
|
+
if (arg === '--yes' || arg === '-y') {
|
|
50
|
+
options.yes = true;
|
|
36
51
|
continue;
|
|
37
52
|
}
|
|
38
|
-
|
|
53
|
+
|
|
54
|
+
const spaced = VALUE_FLAGS.get(arg);
|
|
55
|
+
if (spaced !== undefined) {
|
|
39
56
|
i += 1;
|
|
40
|
-
|
|
57
|
+
const value = args[i];
|
|
58
|
+
if (value === undefined || value.startsWith('-')) {
|
|
59
|
+
console.error(`Missing value for ${arg}.`);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
options[spaced] = value;
|
|
41
63
|
continue;
|
|
42
64
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
65
|
+
|
|
66
|
+
const eq = arg.indexOf('=');
|
|
67
|
+
if (arg.startsWith('--') && eq > 0) {
|
|
68
|
+
const joined = VALUE_FLAGS.get(arg.slice(0, eq));
|
|
69
|
+
if (joined !== undefined) {
|
|
70
|
+
options[joined] = arg.slice(eq + 1);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
50
73
|
}
|
|
74
|
+
|
|
51
75
|
if (arg.startsWith('-')) {
|
|
52
76
|
// Skipping this used to be deliberate, to keep the create-* flow from
|
|
53
77
|
// crashing. It cost more than it saved: the flag did nothing, nothing
|
|
54
78
|
// was printed, and the scaffold came out as whatever the defaults are.
|
|
55
79
|
console.error(`Unknown flag: ${arg}.`);
|
|
56
|
-
console.error(
|
|
80
|
+
console.error(
|
|
81
|
+
'This command takes: --type (-t), --lang (-l), --id, --title, --description, --author, --license, --yes (-y), --no-install, --no-git.',
|
|
82
|
+
);
|
|
57
83
|
process.exit(1);
|
|
58
84
|
}
|
|
85
|
+
|
|
59
86
|
if (name === undefined) {
|
|
60
87
|
name = arg;
|
|
61
88
|
}
|
|
62
89
|
}
|
|
63
90
|
|
|
64
91
|
try {
|
|
65
|
-
await runInit({ name,
|
|
92
|
+
await runInit({ name, ...options });
|
|
66
93
|
} catch (err) {
|
|
67
94
|
console.error(err instanceof Error ? err.message : String(err));
|
|
68
95
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vttforge",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.32",
|
|
4
4
|
"description": "Scaffold a Foundry VTT system or module with VTTForge. Runs `@vttforge/cli init`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@vttforge/cli": "0.
|
|
28
|
+
"@vttforge/cli": "0.18.1"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=26.0.0"
|