@vttforge/cli 0.7.1 → 0.9.0
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/CHANGELOG.md +39 -0
- package/README.md +2 -2
- package/dist/bin.mjs +3 -3
- package/dist/bin.mjs.map +1 -1
- package/dist/index.d.mts +16 -343
- package/dist/index.mjs +2 -2
- package/dist/{src-C2VIeKmf.mjs → src-BAHJHuJ7.mjs} +240 -66
- package/dist/src-BAHJHuJ7.mjs.map +1 -0
- package/package.json +5 -5
- package/templates/module-js/README.md +3 -3
- package/templates/module-js/module.json +1 -0
- package/templates/module-js/package.json +3 -3
- package/templates/module-ts/README.md +3 -3
- package/templates/module-ts/module.json +1 -0
- package/templates/module-ts/package.json +3 -3
- package/templates/system-js/README.md +3 -3
- package/templates/system-js/package.json +3 -3
- package/templates/system-js/scripts/main.mjs +0 -8
- package/templates/system-js/scripts/migrations.mjs +1 -1
- package/templates/system-js/system.json +1 -0
- package/templates/system-js/templates/actor/character-sheet.hbs +1 -1
- package/templates/system-ts/README.md +3 -3
- package/templates/system-ts/package.json +3 -3
- package/templates/system-ts/scripts/foundry-globals.ts +4 -0
- package/templates/system-ts/scripts/main.ts +0 -8
- package/templates/system-ts/scripts/migrations.ts +1 -1
- package/templates/system-ts/system.json +1 -0
- package/templates/system-ts/templates/actor/character-sheet.hbs +1 -1
- package/dist/src-C2VIeKmf.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# @vttforge/cli
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2224420: Target Foundry v14.
|
|
8
|
+
|
|
9
|
+
- `vttforge init` writes `"type"` into the manifest and sets `compatibility` to `{ "minimum": "14", "verified": "14" }`. The system templates no longer unregister the core sheets, because v14 registers none.
|
|
10
|
+
- `vttforge audit` gains six rules for the v13 code v14 broke or deprecated: bare utility globals such as `mergeObject` (`VTTF-AUDIT-011`, HIGH), `-=` / `==` update keys (012), `rollMode` (013), whole-array `CONFIG.statusEffects` assignment (014), `legacyTransferral` (015) and numeric Active Effect modes (016). `VTTF-AUDIT-002` is now HIGH: v14 dropped the shim for the flat `gridDistance` / `gridUnits` keys.
|
|
11
|
+
|
|
12
|
+
## 0.8.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 0034209: Follow the `@vttforge/core` and `@vttforge/vite-plugin` minors in the scaffold's pins, so a new project gets the decorators and the build that lowers them.
|
|
17
|
+
|
|
18
|
+
On a `0.x` version a caret pins the minor, so the old pins would have kept new projects on the releases before them. The templates ship inside this package, so the corrected pins only reach anyone when the CLI is published too.
|
|
19
|
+
|
|
20
|
+
## 0.8.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- 89b7ffa: **Breaking.** Removes 23 internal exports from the package index.
|
|
25
|
+
|
|
26
|
+
Every package here is below `1.0.0`, where a minor may break you. This one does.
|
|
27
|
+
|
|
28
|
+
The product here is the `vttforge` binary. Its index had grown to re-export the pieces the commands are built from, and 33 of 60 exports were reachable only by importing them by name. The previous release tagged them `@internal`; this one removes them.
|
|
29
|
+
|
|
30
|
+
Gone: `scaffold`, `substitute`, `templatesRoot`, `createLink`, `readLinkTarget`, `removeLink`, `setupDevSymlink`, `cleanupDevSymlink`, `resolveViteInvocation`, `runViteBuildOnce`, `spawnViteWatch`, `ViteNotInstalledError`, `detectPackageManager`, `detectProjectPackageManager`, `execInvocation`, `installCommand`, `autoDetectFoundryDataDir`, `configPath`, `foundryPackagesDir`, `looksLikeFoundryDataDir`, `resolveFoundryDataDir`, `loadConfig`, `saveConfig`, and the types that existed only for them (`ScaffoldOptions`, `ScaffoldVars`, `CreateLinkOptions`, `PackageManager`, `ResolveDataDirOptions`, `VTTForgeConfig`).
|
|
31
|
+
|
|
32
|
+
What remains is what the package is for:
|
|
33
|
+
|
|
34
|
+
- `runInit` and `ScaffoldError`, which is what `create-vttforge` calls.
|
|
35
|
+
- The audit surface: `runAudit`, `runManifestRules`, `runSourceRules`, `formatReport`, `SEVERITY_RANK`, and the `RuleFn` / `RuleResult` / `Severity` / `AuditReport` types. Write your own rule and hand it to the same reporter the CLI uses.
|
|
36
|
+
- `runDev`, `runBuild`, `emitReleaseZip`, `emitZip` and `readManifest`, still `@experimental`.
|
|
37
|
+
|
|
38
|
+
Every removed export was checked: nothing outside this package imported any of them. If one of these was your only way to do something, open an issue and it comes back as a supported export rather than a leak.
|
|
39
|
+
|
|
40
|
+
Use the `vttforge` command for everything else.
|
|
41
|
+
|
|
3
42
|
## 0.7.1
|
|
4
43
|
|
|
5
44
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vttforge/cli
|
|
2
2
|
|
|
3
|
-
Scaffold, dev loop, release build and audit for Foundry VTT
|
|
3
|
+
Scaffold, dev loop, release build and audit for Foundry VTT v14+ systems and modules.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
pnpm create vttforge my-system # same as: npx @vttforge/cli init my-system
|
|
@@ -22,7 +22,7 @@ vttforge audit [dir] [--json] [--strict]
|
|
|
22
22
|
|
|
23
23
|
**`build`** runs the production build and writes `<id>-<version>.zip` at the project root with the manifest at the top level, which is what foundryvtt.com expects. `LICENSE`, `README.md` and `CHANGELOG.md` go in when present.
|
|
24
24
|
|
|
25
|
-
**`audit`** checks the manifest, the source and the templates against
|
|
25
|
+
**`audit`** checks the manifest, the source and the templates against the v14 breakages that fail quietly: the `flags.hotReload` shape, the removed grid fields, the v12 `styles` shape, `HTMLField`/`FilePathField` paths missing from `documentTypes`, `TypeDataModel` without `prepareBaseData`, a bad `_addDataFieldMigrations` override, token attributes that do not point at a `{ value, max }` field, a sheet template that opens a `<form>` the sheet already is, a declared subtype with no name in any language file, a `template.json` that erases the metadata `system.json` declares for the same type, and the v13 code v14 broke or deprecated: bare `mergeObject`-style globals, `-=` update keys, `rollMode`, whole-array `CONFIG.statusEffects` assignment, `legacyTransferral`, numeric Active Effect modes. `--json` for machines; `--strict` exits non-zero on any finding rather than only on HIGH.
|
|
26
26
|
|
|
27
27
|
## As a library
|
|
28
28
|
|
package/dist/bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { i as runDev, l as runAuditCommand, n as ScaffoldError, o as runBuild, r as runInit, t as VTTFORGE_CLI_VERSION } from "./src-BAHJHuJ7.mjs";
|
|
3
3
|
import { defineCommand, runMain } from "citty";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
/**
|
|
@@ -140,7 +140,7 @@ const build = defineCommand({
|
|
|
140
140
|
const audit = defineCommand({
|
|
141
141
|
meta: {
|
|
142
142
|
name: "audit",
|
|
143
|
-
description: "Scan a system/module project for the
|
|
143
|
+
description: "Scan a system/module project for the v14 manifest, source and template breakages that fail quietly"
|
|
144
144
|
},
|
|
145
145
|
args: {
|
|
146
146
|
path: {
|
|
@@ -177,7 +177,7 @@ const main = defineCommand({
|
|
|
177
177
|
meta: {
|
|
178
178
|
name: "vttforge",
|
|
179
179
|
version: VTTFORGE_CLI_VERSION,
|
|
180
|
-
description: "VTTForge CLI: scaffold, dev, build and audit for Foundry
|
|
180
|
+
description: "VTTForge CLI: scaffold, dev, build and audit for Foundry v14+ systems and modules"
|
|
181
181
|
},
|
|
182
182
|
subCommands: {
|
|
183
183
|
init,
|
package/dist/bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.mjs","names":[],"sources":["../src/cli.ts","../src/bin.ts"],"sourcesContent":["/**\n * vttforge command tree.\n *\n * Kept apart from `bin.ts`, which only runs it. Argument definitions are the\n * CLI's contract with its users (`--no-install` skipping the install, an\n * alias resolving to its canonical name) and a module that calls `runMain`\n * on import cannot be reached by a test. Exporting the commands from here\n * lets the suite parse real argv against the real definitions.\n */\nimport { defineCommand } from 'citty';\nimport { runAuditCommand } from './commands/audit.js';\nimport { runBuild } from './commands/build.js';\nimport { runDev } from './commands/dev.js';\nimport { runInit, ScaffoldError } from './commands/init.js';\nimport { VTTFORGE_CLI_VERSION } from './index.js';\n\nexport const init = defineCommand({\n meta: {\n name: 'init',\n description: 'Scaffold a new Foundry VTT system or module from a VTTForge template',\n },\n args: {\n name: {\n type: 'positional',\n description: 'Directory name for the new system/module (also the default manifest id)',\n required: false,\n },\n type: {\n type: 'string',\n description: 'Package type: system | module',\n },\n lang: {\n type: 'string',\n description: 'Language: ts | js',\n },\n id: {\n type: 'string',\n description: 'Manifest id (defaults to a slug of the directory name)',\n },\n title: {\n type: 'string',\n description: 'Human-readable title shown in Foundry setup screens',\n },\n description: {\n type: 'string',\n description: 'One-line description for the manifest',\n },\n author: {\n type: 'string',\n description: 'Author name for the manifest (defaults to the git author)',\n },\n license: {\n type: 'string',\n description: 'SPDX license id (default MIT)',\n },\n // Without a terminal there is nothing for a prompt to read, so it waits\n // forever. This flag takes the defaults instead, and the scaffolder\n // also assumes it when stdin is not a TTY, so CI need not pass it.\n yes: {\n type: 'boolean',\n alias: 'y',\n default: false,\n description: 'Accept defaults for anything not passed, without prompting',\n },\n // Citty parses `--no-X` as `args.X === false`, so define affirmative\n // flags with a true default. `--no-install` then yields `install: false`\n // which we forward as `noInstall: true`.\n install: {\n type: 'boolean',\n default: true,\n description: 'Install dependencies after scaffold (use --no-install to skip)',\n },\n git: {\n type: 'boolean',\n default: true,\n description: 'Initialize a git repository after scaffold (use --no-git to skip)',\n },\n },\n async run({ args }) {\n try {\n await runInit({\n name: typeof args.name === 'string' ? args.name : undefined,\n type: typeof args.type === 'string' ? (args.type as 'system' | 'module') : undefined,\n lang: typeof args.lang === 'string' ? (args.lang as 'ts' | 'js') : undefined,\n id: typeof args.id === 'string' ? args.id : undefined,\n title: typeof args.title === 'string' ? args.title : undefined,\n description: typeof args.description === 'string' ? args.description : undefined,\n author: typeof args.author === 'string' ? args.author : undefined,\n license: typeof args.license === 'string' ? args.license : undefined,\n yes: args.yes === true,\n noInstall: args.install === false,\n noGit: args.git === false,\n });\n } catch (err) {\n // ScaffoldError already surfaced its message via `p.cancel`; anything\n // else is a real crash worth showing. Either way the bin exits 1.\n if (!(err instanceof ScaffoldError)) {\n console.error(err instanceof Error ? err.message : String(err));\n }\n process.exit(1);\n }\n },\n});\n\nexport const dev = defineCommand({\n meta: {\n name: 'dev',\n description: 'Symlink dist/ into Foundry Data and run vite build --watch',\n },\n args: {\n 'foundry-data': {\n type: 'string',\n alias: 'data-dir',\n description:\n 'Override the Foundry user-data directory (skips env / config / first-run prompt)',\n },\n 'hmr-port': {\n type: 'string',\n description: 'Port for the hot reload bridge (default 31313)',\n },\n },\n async run({ args }) {\n // Citty surfaces aliases under the canonical name. Belt-and-suspenders:\n // accept either spelling so older docs and muscle memory keep working.\n const explicit =\n (typeof args['foundry-data'] === 'string' ? args['foundry-data'] : undefined) ??\n (typeof args['data-dir'] === 'string' ? args['data-dir'] : undefined);\n // A non-numeric port is the user's typo, not a reason to fall back to a\n // port they did not ask for. Say so and stop.\n const rawPort = typeof args['hmr-port'] === 'string' ? args['hmr-port'] : undefined;\n const hmrPort = rawPort === undefined ? undefined : Number(rawPort);\n if (hmrPort !== undefined && !Number.isInteger(hmrPort)) {\n console.error(`--hmr-port expects a whole number, got \\`${rawPort}\\`.`);\n process.exit(1);\n }\n try {\n await runDev({ dataDir: explicit, hmrPort });\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nexport const build = defineCommand({\n meta: {\n name: 'build',\n description: 'Run vite build (production) and emit <id>-<version>.zip for foundryvtt.com',\n },\n async run() {\n try {\n await runBuild();\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nexport const audit = defineCommand({\n meta: {\n name: 'audit',\n description: 'Scan a system/module project for the seven v13 manifest + code footguns',\n },\n args: {\n path: {\n type: 'positional',\n description: 'Project root to scan (defaults to the current directory)',\n required: false,\n },\n json: {\n type: 'boolean',\n default: false,\n description: 'Emit a machine-readable JSON report instead of markdown',\n },\n strict: {\n type: 'boolean',\n default: false,\n description: 'Exit non-zero on any finding (default: only HIGH triggers a non-zero exit)',\n },\n },\n async run({ args }) {\n try {\n const result = await runAuditCommand({\n cwd: typeof args.path === 'string' ? args.path : undefined,\n format: args.json === true ? 'json' : 'markdown',\n strict: args.strict === true,\n });\n // Set exitCode instead of calling process.exit so any pending stdout\n // writes (the JSON / markdown report) get flushed before the process\n // tears down. process.exit(1) would truncate large reports on the\n // exact runs CI needs them intact.\n if (result.exitCode !== 0) process.exitCode = result.exitCode;\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exitCode = 1;\n }\n },\n});\n\nexport const main = defineCommand({\n meta: {\n name: 'vttforge',\n version: VTTFORGE_CLI_VERSION,\n description:\n 'VTTForge CLI: scaffold, dev, build and audit for Foundry v13+ systems and modules',\n },\n subCommands: {\n init,\n dev,\n build,\n audit,\n },\n});\n","#!/usr/bin/env node\n/**\n * vttforge bin: the executable entry.\n *\n * Nothing but the launch. The command tree lives in `cli.ts` so tests can\n * import it without running the CLI.\n */\nimport { runMain } from 'citty';\nimport { main } from './cli.js';\n\nrunMain(main);\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAa,OAAO,cAAc;CAChC,MAAM;EACJ,MAAM;EACN,aAAa;CACf;CACA,MAAM;EACJ,MAAM;GACJ,MAAM;GACN,aAAa;GACb,UAAU;EACZ;EACA,MAAM;GACJ,MAAM;GACN,aAAa;EACf;EACA,MAAM;GACJ,MAAM;GACN,aAAa;EACf;EACA,IAAI;GACF,MAAM;GACN,aAAa;EACf;EACA,OAAO;GACL,MAAM;GACN,aAAa;EACf;EACA,aAAa;GACX,MAAM;GACN,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,aAAa;EACf;EACA,SAAS;GACP,MAAM;GACN,aAAa;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AG,CAAC;GAC9D,QAAQ,WAAW;EACrB;CACF;AACF,CAAC;AAED,MAAa,OAAO,cAAc;CAChC,MAAM;EACJ,MAAM;EACN,SAAS;EACT,aACE;CACJ;CACA,aAAa;EACX;EACA;EACA;EACA;CACF;AACF,CAAC;;;;;;;;;AC3MD,QAAQ,IAAI"}
|
|
1
|
+
{"version":3,"file":"bin.mjs","names":[],"sources":["../src/cli.ts","../src/bin.ts"],"sourcesContent":["/**\n * vttforge command tree.\n *\n * Kept apart from `bin.ts`, which only runs it. Argument definitions are the\n * CLI's contract with its users (`--no-install` skipping the install, an\n * alias resolving to its canonical name) and a module that calls `runMain`\n * on import cannot be reached by a test. Exporting the commands from here\n * lets the suite parse real argv against the real definitions.\n */\nimport { defineCommand } from 'citty';\nimport { runAuditCommand } from './commands/audit.js';\nimport { runBuild } from './commands/build.js';\nimport { runDev } from './commands/dev.js';\nimport { runInit, ScaffoldError } from './commands/init.js';\nimport { VTTFORGE_CLI_VERSION } from './index.js';\n\nexport const init = defineCommand({\n meta: {\n name: 'init',\n description: 'Scaffold a new Foundry VTT system or module from a VTTForge template',\n },\n args: {\n name: {\n type: 'positional',\n description: 'Directory name for the new system/module (also the default manifest id)',\n required: false,\n },\n type: {\n type: 'string',\n description: 'Package type: system | module',\n },\n lang: {\n type: 'string',\n description: 'Language: ts | js',\n },\n id: {\n type: 'string',\n description: 'Manifest id (defaults to a slug of the directory name)',\n },\n title: {\n type: 'string',\n description: 'Human-readable title shown in Foundry setup screens',\n },\n description: {\n type: 'string',\n description: 'One-line description for the manifest',\n },\n author: {\n type: 'string',\n description: 'Author name for the manifest (defaults to the git author)',\n },\n license: {\n type: 'string',\n description: 'SPDX license id (default MIT)',\n },\n // Without a terminal there is nothing for a prompt to read, so it waits\n // forever. This flag takes the defaults instead, and the scaffolder\n // also assumes it when stdin is not a TTY, so CI need not pass it.\n yes: {\n type: 'boolean',\n alias: 'y',\n default: false,\n description: 'Accept defaults for anything not passed, without prompting',\n },\n // Citty parses `--no-X` as `args.X === false`, so define affirmative\n // flags with a true default. `--no-install` then yields `install: false`\n // which we forward as `noInstall: true`.\n install: {\n type: 'boolean',\n default: true,\n description: 'Install dependencies after scaffold (use --no-install to skip)',\n },\n git: {\n type: 'boolean',\n default: true,\n description: 'Initialize a git repository after scaffold (use --no-git to skip)',\n },\n },\n async run({ args }) {\n try {\n await runInit({\n name: typeof args.name === 'string' ? args.name : undefined,\n type: typeof args.type === 'string' ? (args.type as 'system' | 'module') : undefined,\n lang: typeof args.lang === 'string' ? (args.lang as 'ts' | 'js') : undefined,\n id: typeof args.id === 'string' ? args.id : undefined,\n title: typeof args.title === 'string' ? args.title : undefined,\n description: typeof args.description === 'string' ? args.description : undefined,\n author: typeof args.author === 'string' ? args.author : undefined,\n license: typeof args.license === 'string' ? args.license : undefined,\n yes: args.yes === true,\n noInstall: args.install === false,\n noGit: args.git === false,\n });\n } catch (err) {\n // ScaffoldError already surfaced its message via `p.cancel`; anything\n // else is a real crash worth showing. Either way the bin exits 1.\n if (!(err instanceof ScaffoldError)) {\n console.error(err instanceof Error ? err.message : String(err));\n }\n process.exit(1);\n }\n },\n});\n\nexport const dev = defineCommand({\n meta: {\n name: 'dev',\n description: 'Symlink dist/ into Foundry Data and run vite build --watch',\n },\n args: {\n 'foundry-data': {\n type: 'string',\n alias: 'data-dir',\n description:\n 'Override the Foundry user-data directory (skips env / config / first-run prompt)',\n },\n 'hmr-port': {\n type: 'string',\n description: 'Port for the hot reload bridge (default 31313)',\n },\n },\n async run({ args }) {\n // Citty surfaces aliases under the canonical name. Belt-and-suspenders:\n // accept either spelling so older docs and muscle memory keep working.\n const explicit =\n (typeof args['foundry-data'] === 'string' ? args['foundry-data'] : undefined) ??\n (typeof args['data-dir'] === 'string' ? args['data-dir'] : undefined);\n // A non-numeric port is the user's typo, not a reason to fall back to a\n // port they did not ask for. Say so and stop.\n const rawPort = typeof args['hmr-port'] === 'string' ? args['hmr-port'] : undefined;\n const hmrPort = rawPort === undefined ? undefined : Number(rawPort);\n if (hmrPort !== undefined && !Number.isInteger(hmrPort)) {\n console.error(`--hmr-port expects a whole number, got \\`${rawPort}\\`.`);\n process.exit(1);\n }\n try {\n await runDev({ dataDir: explicit, hmrPort });\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nexport const build = defineCommand({\n meta: {\n name: 'build',\n description: 'Run vite build (production) and emit <id>-<version>.zip for foundryvtt.com',\n },\n async run() {\n try {\n await runBuild();\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exit(1);\n }\n },\n});\n\nexport const audit = defineCommand({\n meta: {\n name: 'audit',\n description:\n 'Scan a system/module project for the v14 manifest, source and template breakages that fail quietly',\n },\n args: {\n path: {\n type: 'positional',\n description: 'Project root to scan (defaults to the current directory)',\n required: false,\n },\n json: {\n type: 'boolean',\n default: false,\n description: 'Emit a machine-readable JSON report instead of markdown',\n },\n strict: {\n type: 'boolean',\n default: false,\n description: 'Exit non-zero on any finding (default: only HIGH triggers a non-zero exit)',\n },\n },\n async run({ args }) {\n try {\n const result = await runAuditCommand({\n cwd: typeof args.path === 'string' ? args.path : undefined,\n format: args.json === true ? 'json' : 'markdown',\n strict: args.strict === true,\n });\n // Set exitCode instead of calling process.exit so any pending stdout\n // writes (the JSON / markdown report) get flushed before the process\n // tears down. process.exit(1) would truncate large reports on the\n // exact runs CI needs them intact.\n if (result.exitCode !== 0) process.exitCode = result.exitCode;\n } catch (err) {\n console.error(err instanceof Error ? err.message : String(err));\n process.exitCode = 1;\n }\n },\n});\n\nexport const main = defineCommand({\n meta: {\n name: 'vttforge',\n version: VTTFORGE_CLI_VERSION,\n description:\n 'VTTForge CLI: scaffold, dev, build and audit for Foundry v14+ systems and modules',\n },\n subCommands: {\n init,\n dev,\n build,\n audit,\n },\n});\n","#!/usr/bin/env node\n/**\n * vttforge bin: the executable entry.\n *\n * Nothing but the launch. The command tree lives in `cli.ts` so tests can\n * import it without running the CLI.\n */\nimport { runMain } from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aAAa;GACb,UAAU;EACZ;EACA,MAAM;GACJ,MAAM;GACN,SAAS;GACT,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,SAAS;GACT,aAAa;EACf;CACF;CACA,MAAM,IAAI,EAAE,QAAQ;EAClB,IAAI;GACF,MAAM,SAAS,MAAM,gBAAgB;IACnC,KAAK,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO,KAAA;IACjD,QAAQ,KAAK,SAAS,OAAO,SAAS;IACtC,QAAQ,KAAK,WAAW;GAC1B,CAAC;GAKD,IAAI,OAAO,aAAa,GAAG,QAAQ,WAAW,OAAO;EACvD,SAAS,KAAK;GACZ,QAAQ,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;GAC9D,QAAQ,WAAW;EACrB;CACF;AACF,CAAC;AAED,MAAa,OAAO,cAAc;CAChC,MAAM;EACJ,MAAM;EACN,SAAS;EACT,aACE;CACJ;CACA,aAAa;EACX;EACA;EACA;EACA;CACF;AACF,CAAC;;;;;;;;;AC5MD,QAAQ,IAAI"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ChildProcess } from "node:child_process";
|
|
2
1
|
//#region src/audit/types.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Shared types for the `vttforge audit` rule engine.
|
|
5
4
|
*
|
|
6
|
-
* The audit catalog covers
|
|
5
|
+
* The audit catalog covers the breakages that fail quietly on v14. Each rule produces zero or more `RuleResult` entries; the
|
|
7
6
|
* orchestrator aggregates them into an `AuditReport` which the reporter
|
|
8
7
|
* renders as JSON or markdown.
|
|
9
8
|
*
|
|
@@ -40,7 +39,7 @@ interface AuditReport {
|
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
/** Severity rank for sorting (HIGH first). */
|
|
43
|
-
declare const SEVERITY_RANK: Record<Severity, number>;
|
|
42
|
+
export declare const SEVERITY_RANK: Record<Severity, number>;
|
|
44
43
|
/**
|
|
45
44
|
* A rule is a plain function over the project root. Manifest rules parse
|
|
46
45
|
* `system.json` / `module.json`; source rules walk `scripts/` / `src/`.
|
|
@@ -53,18 +52,18 @@ type RuleFn = (cwd: string) => Promise<RuleResult[]> | RuleResult[];
|
|
|
53
52
|
interface RunAuditOptions {
|
|
54
53
|
cwd: string;
|
|
55
54
|
}
|
|
56
|
-
declare function runAudit(options: RunAuditOptions): Promise<AuditReport>;
|
|
55
|
+
export declare function runAudit(options: RunAuditOptions): Promise<AuditReport>;
|
|
57
56
|
//#endregion
|
|
58
57
|
//#region src/audit/manifest-rules.d.ts
|
|
59
|
-
declare function runManifestRules(cwd: string): Promise<RuleResult[]>;
|
|
58
|
+
export declare function runManifestRules(cwd: string): Promise<RuleResult[]>;
|
|
60
59
|
//#endregion
|
|
61
60
|
//#region src/audit/reporter.d.ts
|
|
62
61
|
type ReportFormat = 'json' | 'markdown';
|
|
63
|
-
declare function formatReport(report: AuditReport, format: ReportFormat): string;
|
|
62
|
+
export declare function formatReport(report: AuditReport, format: ReportFormat): string;
|
|
64
63
|
//#endregion
|
|
65
64
|
//#region src/audit/source-rules.d.ts
|
|
66
65
|
/** Entry point: gather everything once, then dispatch to the per-file rules. */
|
|
67
|
-
declare function runSourceRules(cwd: string): Promise<RuleResult[]>;
|
|
66
|
+
export declare function runSourceRules(cwd: string): Promise<RuleResult[]>;
|
|
68
67
|
//#endregion
|
|
69
68
|
//#region src/commands/audit.d.ts
|
|
70
69
|
interface AuditOptions {
|
|
@@ -89,7 +88,7 @@ interface AuditResult {
|
|
|
89
88
|
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
90
89
|
* change in a minor.
|
|
91
90
|
*/
|
|
92
|
-
declare function runAuditCommand(options?: AuditOptions): Promise<AuditResult>;
|
|
91
|
+
export declare function runAuditCommand(options?: AuditOptions): Promise<AuditResult>;
|
|
93
92
|
//#endregion
|
|
94
93
|
//#region src/manifest.d.ts
|
|
95
94
|
/**
|
|
@@ -124,7 +123,7 @@ interface FoundryManifest {
|
|
|
124
123
|
* @experimental Shape is unproven: no consumer has asked for this yet.
|
|
125
124
|
* It can change in a minor.
|
|
126
125
|
*/
|
|
127
|
-
declare function readManifest(distDir: string): Promise<FoundryManifest>;
|
|
126
|
+
export declare function readManifest(distDir: string): Promise<FoundryManifest>;
|
|
128
127
|
//#endregion
|
|
129
128
|
//#region src/commands/build.d.ts
|
|
130
129
|
interface BuildOptions {
|
|
@@ -138,7 +137,7 @@ interface BuildOptions {
|
|
|
138
137
|
* @experimental Shape is unproven: no consumer has asked for this yet.
|
|
139
138
|
* It can change in a minor.
|
|
140
139
|
*/
|
|
141
|
-
declare function emitReleaseZip(opts: {
|
|
140
|
+
export declare function emitReleaseZip(opts: {
|
|
142
141
|
cwd: string;
|
|
143
142
|
}): Promise<{
|
|
144
143
|
zipFile: string;
|
|
@@ -149,7 +148,7 @@ declare function emitReleaseZip(opts: {
|
|
|
149
148
|
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
150
149
|
* change in a minor.
|
|
151
150
|
*/
|
|
152
|
-
declare function runBuild(options?: BuildOptions): Promise<void>;
|
|
151
|
+
export declare function runBuild(options?: BuildOptions): Promise<void>;
|
|
153
152
|
//#endregion
|
|
154
153
|
//#region src/commands/dev.d.ts
|
|
155
154
|
interface DevOptions {
|
|
@@ -164,38 +163,7 @@ interface DevOptions {
|
|
|
164
163
|
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
165
164
|
* change in a minor.
|
|
166
165
|
*/
|
|
167
|
-
declare function runDev(options?: DevOptions): Promise<void>;
|
|
168
|
-
/**
|
|
169
|
-
* Internal building block exposed for tests: given an already-built `dist/`
|
|
170
|
-
* (vite has run, manifest is present) and a resolved Foundry data dir,
|
|
171
|
-
* create the symlink and return the target path + manifest. Skips the
|
|
172
|
-
* vite spawn and the signal-loop, so tests can drive the orchestration
|
|
173
|
-
* deterministically.
|
|
174
|
-
*
|
|
175
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
176
|
-
* for outside use, and going away in the next major.
|
|
177
|
-
*/
|
|
178
|
-
declare function setupDevSymlink(opts: {
|
|
179
|
-
cwd: string;
|
|
180
|
-
dataRoot: string;
|
|
181
|
-
}): Promise<{
|
|
182
|
-
target: string;
|
|
183
|
-
manifest: Awaited<ReturnType<typeof readManifest>>;
|
|
184
|
-
childProcess?: ChildProcess;
|
|
185
|
-
}>;
|
|
186
|
-
/**
|
|
187
|
-
* Tear down a dev symlink iff it still points at the expected source.
|
|
188
|
-
* Refuses to remove a symlink that another `vttforge dev` session (or a
|
|
189
|
-
* manual `ln -s`) has since redirected. That link doesn't belong to us
|
|
190
|
-
* and removing it would silently disconnect their setup.
|
|
191
|
-
*
|
|
192
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
193
|
-
* for outside use, and going away in the next major.
|
|
194
|
-
*/
|
|
195
|
-
declare function cleanupDevSymlink(opts: {
|
|
196
|
-
target: string;
|
|
197
|
-
expectedSource: string;
|
|
198
|
-
}): Promise<void>;
|
|
166
|
+
export declare function runDev(options?: DevOptions): Promise<void>;
|
|
199
167
|
//#endregion
|
|
200
168
|
//#region src/commands/init.d.ts
|
|
201
169
|
/**
|
|
@@ -251,305 +219,10 @@ type TemplateVariant = 'system-ts' | 'system-js' | 'module-ts' | 'module-js';
|
|
|
251
219
|
* catch and recover. The `vttforge` bin wraps `runInit` in a top-level
|
|
252
220
|
* handler that prints the message and exits with code 1.
|
|
253
221
|
*/
|
|
254
|
-
declare class ScaffoldError extends Error {
|
|
222
|
+
export declare class ScaffoldError extends Error {
|
|
255
223
|
constructor(message: string);
|
|
256
224
|
}
|
|
257
|
-
declare function runInit(options?: InitOptions): Promise<void>;
|
|
258
|
-
//#endregion
|
|
259
|
-
//#region src/foundry-data-dir.d.ts
|
|
260
|
-
/**
|
|
261
|
-
* Foundry user-data directory discovery + persistence.
|
|
262
|
-
*
|
|
263
|
-
* Foundry stores worlds, systems, and modules under a single user-data
|
|
264
|
-
* directory (`Data/` lives at its root). `vttforge dev` needs to know where
|
|
265
|
-
* that is so it can symlink the built `dist/` into `Data/systems/<id>/` or
|
|
266
|
-
* `Data/modules/<id>/` and let Foundry pick it up.
|
|
267
|
-
*
|
|
268
|
-
* Precedence (top wins):
|
|
269
|
-
* 1. Explicit `--data-dir` flag passed to the command
|
|
270
|
-
* 2. `FOUNDRY_DATA_DIR` env var (useful in Docker/CI)
|
|
271
|
-
* 3. `<project>/.vttforge/config.json :: foundryDataDir`
|
|
272
|
-
* 4. OS default + interactive prompt that saves to (3) for next time
|
|
273
|
-
*
|
|
274
|
-
* The OS-default detection treats `XDG_DATA_HOME` (Linux) and `%LOCALAPPDATA%`
|
|
275
|
-
* (Windows) as part of the OS convention, not as Foundry-specific overrides.
|
|
276
|
-
*
|
|
277
|
-
* Everything here is pure: `platform`, `env`, and `home` flow through
|
|
278
|
-
* options so tests can drive every branch without monkey-patching globals.
|
|
279
|
-
*/
|
|
280
|
-
/** Shape persisted to `<project>/.vttforge/config.json`. */
|
|
281
|
-
interface VTTForgeConfig {
|
|
282
|
-
foundryDataDir?: string;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Return the OS-default Foundry user-data directory, or `null` on unknown
|
|
286
|
-
* platforms / missing platform-specific env vars. Does NOT check existence;
|
|
287
|
-
* callers prompt the user when the suggested path doesn't resolve.
|
|
288
|
-
*
|
|
289
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
290
|
-
* for outside use, and going away in the next major.
|
|
291
|
-
*/
|
|
292
|
-
declare function autoDetectFoundryDataDir(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv, home?: string): string | null;
|
|
293
|
-
/**
|
|
294
|
-
* Heuristic: a path looks like a Foundry user-data root if it contains a
|
|
295
|
-
* `Data/` subdirectory (canonical Foundry layout) OR if it already contains
|
|
296
|
-
* `systems/` or `modules/` (the path is already the Data folder itself).
|
|
297
|
-
*
|
|
298
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
299
|
-
* for outside use, and going away in the next major.
|
|
300
|
-
*/
|
|
301
|
-
declare function looksLikeFoundryDataDir(path: string): boolean;
|
|
302
|
-
/** Absolute path to the project-local config file (whether or not it exists).
|
|
303
|
-
*
|
|
304
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
305
|
-
* for outside use, and going away in the next major.
|
|
306
|
-
*/
|
|
307
|
-
declare function configPath(cwd: string): string;
|
|
308
|
-
/** Load `<cwd>/.vttforge/config.json` if it exists and is valid JSON.
|
|
309
|
-
*
|
|
310
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
311
|
-
* for outside use, and going away in the next major.
|
|
312
|
-
*/
|
|
313
|
-
declare function loadConfig(cwd: string): Promise<VTTForgeConfig | null>;
|
|
314
|
-
/** Persist `<cwd>/.vttforge/config.json`. Creates the `.vttforge/` dir as needed.
|
|
315
|
-
*
|
|
316
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
317
|
-
* for outside use, and going away in the next major.
|
|
318
|
-
*/
|
|
319
|
-
declare function saveConfig(cwd: string, config: VTTForgeConfig): Promise<void>;
|
|
320
|
-
/**
|
|
321
|
-
* Resolve the packages directory (`Data/systems/` or `Data/modules/`) under
|
|
322
|
-
* the given Foundry user-data root. Accepts the path Foundry itself runs
|
|
323
|
-
* with (the user-data folder, which contains `Data/`) OR the `Data/` folder
|
|
324
|
-
* directly; both are common in muscle memory.
|
|
325
|
-
*
|
|
326
|
-
* The returned path is not guaranteed to exist yet; callers `mkdir -p` it
|
|
327
|
-
* before creating the symlink.
|
|
328
|
-
*
|
|
329
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
330
|
-
* for outside use, and going away in the next major.
|
|
331
|
-
*/
|
|
332
|
-
declare function foundryPackagesDir(dataRoot: string, type: 'system' | 'module'): string;
|
|
333
|
-
interface ResolveDataDirOptions {
|
|
334
|
-
/** Project root: also where `.vttforge/config.json` is read/written. */
|
|
335
|
-
cwd: string;
|
|
336
|
-
/** `--data-dir` flag value. Skips persistence and prompting when present. */
|
|
337
|
-
override?: string;
|
|
338
|
-
/**
|
|
339
|
-
* Interactive prompt for the first run. Receives the OS-default path
|
|
340
|
-
* (may be `null` on unknown platforms) and resolves with the chosen path,
|
|
341
|
-
* or `null` if the user cancelled. When undefined, the function refuses
|
|
342
|
-
* to ask and throws, appropriate for non-TTY contexts (CI, scripts).
|
|
343
|
-
*/
|
|
344
|
-
prompt?: (autoDetected: string | null) => Promise<string | null>;
|
|
345
|
-
/** Override `process.platform` (tests). */
|
|
346
|
-
platform?: NodeJS.Platform;
|
|
347
|
-
/** Override `process.env` (tests). */
|
|
348
|
-
env?: NodeJS.ProcessEnv;
|
|
349
|
-
/** Override `os.homedir()` (tests). */
|
|
350
|
-
home?: string;
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Walk the precedence chain and return the chosen Foundry user-data path.
|
|
354
|
-
* Saves the user's choice to the project config on first interactive run so
|
|
355
|
-
* subsequent invocations skip the prompt.
|
|
356
|
-
*
|
|
357
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
358
|
-
* for outside use, and going away in the next major.
|
|
359
|
-
*/
|
|
360
|
-
declare function resolveFoundryDataDir(opts: ResolveDataDirOptions): Promise<string>;
|
|
361
|
-
//#endregion
|
|
362
|
-
//#region src/package-manager.d.ts
|
|
363
|
-
/**
|
|
364
|
-
* Detect which package manager invoked the CLI so we can run the right
|
|
365
|
-
* `install` command after scaffolding.
|
|
366
|
-
*
|
|
367
|
-
* Strategy: read `npm_config_user_agent`, which pnpm/npm/bun/yarn all set when
|
|
368
|
-
* they spawn a child process (including `pnpm dlx`, `pnpm create`, etc.).
|
|
369
|
-
* Falls back to `pnpm` because that's the VTTForge house default and the
|
|
370
|
-
* most common Foundry-developer choice, but any concrete signal in the
|
|
371
|
-
* environment wins over the default.
|
|
372
|
-
*/
|
|
373
|
-
type PackageManager = 'pnpm' | 'npm' | 'bun' | 'yarn';
|
|
374
|
-
/**
|
|
375
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
376
|
-
* outside use, and going away in the next major.
|
|
377
|
-
*/
|
|
378
|
-
declare function detectPackageManager(env?: NodeJS.ProcessEnv): PackageManager;
|
|
379
|
-
/**
|
|
380
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
381
|
-
* outside use, and going away in the next major.
|
|
382
|
-
*/
|
|
383
|
-
declare function installCommand(pm: PackageManager): string;
|
|
384
|
-
/**
|
|
385
|
-
* Detect a project's package manager by looking at which lockfile it
|
|
386
|
-
* ships. `dev` and `build` need this: by the time the user runs
|
|
387
|
-
* `vttforge dev`, npm_config_user_agent reflects whatever shell launched
|
|
388
|
-
* the binary (often nothing in a global install), not how the project
|
|
389
|
-
* was bootstrapped. The lockfile is the project's own contract.
|
|
390
|
-
*
|
|
391
|
-
* Falls back to {@link detectPackageManager} for fresh checkouts that
|
|
392
|
-
* haven't been installed yet.
|
|
393
|
-
*
|
|
394
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
395
|
-
* for outside use, and going away in the next major.
|
|
396
|
-
*/
|
|
397
|
-
declare function detectProjectPackageManager(cwd: string, env?: NodeJS.ProcessEnv): PackageManager;
|
|
398
|
-
/**
|
|
399
|
-
* Argument vector to invoke `vite` (or any other locally-installed CLI)
|
|
400
|
-
* via the project's package manager. We always shell out through `<pm>
|
|
401
|
-
* exec` so the call works regardless of the linker's choices. Yarn 4
|
|
402
|
-
* Plug'n'Play, pnpm's symlinked layout, npm's flattened node_modules,
|
|
403
|
-
* Bun's symlinked node_modules. Each manager exposes a uniform "run a
|
|
404
|
-
* locally-resolved binary in the project's dependency graph" command.
|
|
405
|
-
*
|
|
406
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
407
|
-
* for outside use, and going away in the next major.
|
|
408
|
-
*/
|
|
409
|
-
declare function execInvocation(pm: PackageManager, bin: string): [string, string[]];
|
|
410
|
-
//#endregion
|
|
411
|
-
//#region src/scaffold.d.ts
|
|
412
|
-
/**
|
|
413
|
-
* Template copy with `{{var}}` placeholder substitution.
|
|
414
|
-
*
|
|
415
|
-
* Templates live under `packages/cli/templates/<variant>/` and are shipped
|
|
416
|
-
* inside the published tarball (see the `files` array in package.json).
|
|
417
|
-
* Each file is read, substituted, and written to the destination directory
|
|
418
|
-
* preserving the relative path. Directories are created lazily on first
|
|
419
|
-
* write.
|
|
420
|
-
*
|
|
421
|
-
* We intentionally avoid Handlebars or any other template engine. The
|
|
422
|
-
* substitution surface is small (a flat string-to-string map), and bundling
|
|
423
|
-
* a dependency for ten lines of regex would be wasteful in a tool whose
|
|
424
|
-
* value is being fast to invoke.
|
|
425
|
-
*/
|
|
426
|
-
interface ScaffoldVars {
|
|
427
|
-
ID: string;
|
|
428
|
-
TITLE: string;
|
|
429
|
-
DESCRIPTION: string;
|
|
430
|
-
AUTHOR: string;
|
|
431
|
-
LICENSE: string;
|
|
432
|
-
FOUNDRY_MIN_VERSION: string;
|
|
433
|
-
FOUNDRY_VERIFIED_VERSION: string;
|
|
434
|
-
LOCALE_PREFIX: string;
|
|
435
|
-
YEAR: string;
|
|
436
|
-
}
|
|
437
|
-
interface ScaffoldOptions {
|
|
438
|
-
/** Absolute path to the template root (e.g. `<cli-pkg>/templates/system-ts`). */
|
|
439
|
-
templateDir: string;
|
|
440
|
-
/** Absolute path to the destination directory. Created if it doesn't exist. */
|
|
441
|
-
destDir: string;
|
|
442
|
-
/** Variables to substitute into `{{NAME}}` placeholders inside template files. */
|
|
443
|
-
vars: ScaffoldVars;
|
|
444
|
-
}
|
|
445
|
-
/**
|
|
446
|
-
* Replace `{{NAME}}` placeholders in `content` using the `vars` map.
|
|
447
|
-
* Unknown placeholders are passed through unchanged so partially-templated
|
|
448
|
-
* files (e.g. a snippet that contains `{{handlebarsLikeSyntax}}` as literal
|
|
449
|
-
* content) still scaffold without surprises.
|
|
450
|
-
*
|
|
451
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
452
|
-
* for outside use, and going away in the next major.
|
|
453
|
-
*/
|
|
454
|
-
declare function substitute(content: string, vars: ScaffoldVars): string;
|
|
455
|
-
/**
|
|
456
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
457
|
-
* outside use, and going away in the next major.
|
|
458
|
-
*/
|
|
459
|
-
declare function scaffold({ templateDir, destDir, vars }: ScaffoldOptions): Promise<void>;
|
|
460
|
-
/**
|
|
461
|
-
* Resolve the templates directory relative to this module's file URL. tsdown
|
|
462
|
-
* emits `dist/scaffold.mjs`, so `import.meta.url` points there at runtime;
|
|
463
|
-
* we walk up two segments to land at the package root, then descend into
|
|
464
|
-
* `templates/`.
|
|
465
|
-
*
|
|
466
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
467
|
-
* for outside use, and going away in the next major.
|
|
468
|
-
*/
|
|
469
|
-
declare function templatesRoot(): string;
|
|
470
|
-
//#endregion
|
|
471
|
-
//#region src/symlink.d.ts
|
|
472
|
-
/**
|
|
473
|
-
* Cross-platform symlink helpers for `vttforge dev`.
|
|
474
|
-
*
|
|
475
|
-
* The dev loop drops a symlink from Foundry's `Data/<systems|modules>/<id>/`
|
|
476
|
-
* back to the project's `dist/` so Foundry serves freshly-built files as
|
|
477
|
-
* vite writes them. The win32 path matters: with `type: 'junction'` the
|
|
478
|
-
* operation works on standard Windows shells without Developer Mode, while
|
|
479
|
-
* `type: 'dir'` requires admin. We never silently fall back to copying;
|
|
480
|
-
* Foundry's HMR relies on live file mutation, and a copy snapshot defeats
|
|
481
|
-
* the loop. If the symlink fails, we surface the platform-specific fix.
|
|
482
|
-
*/
|
|
483
|
-
interface CreateLinkOptions {
|
|
484
|
-
/**
|
|
485
|
-
* Overwrite an existing symlink that points elsewhere. Real files and
|
|
486
|
-
* directories are never overwritten; that path needs explicit user
|
|
487
|
-
* action outside the tool.
|
|
488
|
-
*/
|
|
489
|
-
overwrite?: boolean;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Read a symlink target. Returns the absolute path the link points at, or
|
|
493
|
-
* `null` if `path` doesn't exist or isn't a symlink. Relative symlink
|
|
494
|
-
* targets are resolved against the link's own directory (matches the
|
|
495
|
-
* semantics callers expect when comparing to a known absolute source).
|
|
496
|
-
*
|
|
497
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
498
|
-
* for outside use, and going away in the next major.
|
|
499
|
-
*/
|
|
500
|
-
declare function readLinkTarget(path: string): Promise<string | null>;
|
|
501
|
-
/**
|
|
502
|
-
* Create a symlink at `target` pointing to `source`. Win32 uses `'junction'`
|
|
503
|
-
* so the call succeeds without elevation; everywhere else uses `'dir'`.
|
|
504
|
-
*
|
|
505
|
-
* Idempotency:
|
|
506
|
-
* - target already points to source → no-op
|
|
507
|
-
* - target points elsewhere → throws unless `options.overwrite`
|
|
508
|
-
* - target is a real file/dir → throws unconditionally
|
|
509
|
-
*
|
|
510
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
511
|
-
* for outside use, and going away in the next major.
|
|
512
|
-
*/
|
|
513
|
-
declare function createLink(target: string, source: string, options?: CreateLinkOptions): Promise<void>;
|
|
514
|
-
/**
|
|
515
|
-
* Remove a symlink at `path`. No-ops when the path doesn't exist. Throws
|
|
516
|
-
* when the path exists but isn't a symlink; we never unlink real files
|
|
517
|
-
* or directories.
|
|
518
|
-
*
|
|
519
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
520
|
-
* for outside use, and going away in the next major.
|
|
521
|
-
*/
|
|
522
|
-
declare function removeLink(path: string): Promise<void>;
|
|
523
|
-
//#endregion
|
|
524
|
-
//#region src/vite-runner.d.ts
|
|
525
|
-
/**
|
|
526
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
527
|
-
* outside use, and going away in the next major.
|
|
528
|
-
*/
|
|
529
|
-
declare class ViteNotInstalledError extends Error {
|
|
530
|
-
constructor(message: string);
|
|
531
|
-
}
|
|
532
|
-
/** Spawn args for invoking the user's vite (e.g. `["pnpm", ["exec", "vite"]]`).
|
|
533
|
-
*
|
|
534
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
535
|
-
* for outside use, and going away in the next major.
|
|
536
|
-
*/
|
|
537
|
-
declare function resolveViteInvocation(cwd: string): [string, string[]];
|
|
538
|
-
/** Run `vite build` once and wait for it to exit. Throws on non-zero exit.
|
|
539
|
-
*
|
|
540
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
541
|
-
* for outside use, and going away in the next major.
|
|
542
|
-
*/
|
|
543
|
-
declare function runViteBuildOnce(cwd: string): Promise<void>;
|
|
544
|
-
/**
|
|
545
|
-
* Spawn `vite build --watch` and return the child process. The caller is
|
|
546
|
-
* responsible for waiting on it and tearing it down (the dev command kills
|
|
547
|
-
* it on SIGINT).
|
|
548
|
-
*
|
|
549
|
-
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
550
|
-
* for outside use, and going away in the next major.
|
|
551
|
-
*/
|
|
552
|
-
declare function spawnViteWatch(cwd: string): ChildProcess;
|
|
225
|
+
export declare function runInit(options?: InitOptions): Promise<void>;
|
|
553
226
|
//#endregion
|
|
554
227
|
//#region src/zip.d.ts
|
|
555
228
|
/**
|
|
@@ -582,10 +255,10 @@ interface EmitZipResult {
|
|
|
582
255
|
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
583
256
|
* change in a minor.
|
|
584
257
|
*/
|
|
585
|
-
declare function emitZip(opts: EmitZipOptions): Promise<EmitZipResult>;
|
|
258
|
+
export declare function emitZip(opts: EmitZipOptions): Promise<EmitZipResult>;
|
|
586
259
|
//#endregion
|
|
587
260
|
//#region src/index.d.ts
|
|
588
|
-
declare const VTTFORGE_CLI_VERSION: string;
|
|
261
|
+
export declare const VTTFORGE_CLI_VERSION: string;
|
|
589
262
|
//#endregion
|
|
590
|
-
export {
|
|
263
|
+
export type { AuditOptions, AuditReport, AuditResult, BuildOptions, DevOptions, EmitZipOptions, EmitZipResult, FoundryManifest, InitOptions, PackageType, ReportFormat, ResolvedInitOptions, RuleFn, RuleResult, RunAuditOptions, Severity, TemplateVariant };
|
|
591
264
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { SEVERITY_RANK, ScaffoldError, VTTFORGE_CLI_VERSION,
|
|
1
|
+
import { a as emitReleaseZip, c as readManifest, d as runAudit, f as SEVERITY_RANK, i as runDev, l as runAuditCommand, m as runManifestRules, n as ScaffoldError, o as runBuild, p as runSourceRules, r as runInit, s as emitZip, t as VTTFORGE_CLI_VERSION, u as formatReport } from "./src-BAHJHuJ7.mjs";
|
|
2
|
+
export { SEVERITY_RANK, ScaffoldError, VTTFORGE_CLI_VERSION, emitReleaseZip, emitZip, formatReport, readManifest, runAudit, runAuditCommand, runBuild, runDev, runInit, runManifestRules, runSourceRules };
|