@vttforge/cli 0.17.2 → 0.18.1

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.
@@ -68,6 +68,9 @@
68
68
  "enabled": true,
69
69
  "rules": {
70
70
  "preset": "recommended",
71
+ "complexity": {
72
+ "noThisInStatic": "off"
73
+ },
71
74
  "style": {
72
75
  "useImportType": "error",
73
76
  "useNodejsImportProtocol": "error"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vttforge/cli",
3
- "version": "0.17.2",
3
+ "version": "0.18.1",
4
4
  "description": "Scaffold, dev loop, release build, lint and audit for Foundry VTT v14+ systems and modules.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,13 +30,13 @@ jobs:
30
30
  fi
31
31
  echo "version=$version" >> "$GITHUB_OUTPUT"
32
32
 
33
+ # No `version` here: package.json's `packageManager` is the one source,
34
+ # and the action fails when both are set.
33
35
  - uses: pnpm/action-setup@v4
34
- with:
35
- version: 10
36
36
 
37
37
  - uses: actions/setup-node@v4
38
38
  with:
39
- node-version: 22
39
+ node-version: 26
40
40
 
41
41
  - run: pnpm install
42
42
 
@@ -46,31 +46,18 @@ jobs:
46
46
  run: |
47
47
  node -e "const fs=require('node:fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));p.version=process.env.VERSION;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n');"
48
48
 
49
- # We invoke vite directly (not `pnpm build` → `vttforge build`) because
50
- # the release workflow needs to:
51
- # 1. Run vite build → emit dist/module.json
52
- # 2. Patch manifest/download URLs into dist/module.json
53
- # 3. Zip dist/ → release artifact (so the zipped manifest carries URLs)
54
- # `vttforge build` zips at step 1, which would freeze the un-patched
55
- # manifest. Eventually the vite-plugin will support env-driven URL
56
- # injection and this dance disappears.
57
- - run: pnpm exec vite build
58
-
59
- - name: Inject release URLs into manifest
49
+ # `vttforge build` emits dist/ and zips it in one step. The plugin
50
+ # writes the two release URLs into the manifest before the zip is made,
51
+ # so the archive carries them.
52
+ - name: Build
60
53
  env:
61
54
  VERSION: ${{ steps.version.outputs.version }}
62
55
  REPO: ${{ github.repository }}
63
56
  PKG_ID: '{{ID}}'
57
+ VTTFORGE_MANIFEST_URL: https://github.com/${{ github.repository }}/releases/latest/download/module.json
64
58
  run: |
65
- node -e "const fs=require('node:fs');const path='dist/module.json';const m=JSON.parse(fs.readFileSync(path,'utf8'));const r=process.env.REPO;const v=process.env.VERSION;const id=process.env.PKG_ID;m.manifest=\`https://github.com/\${r}/releases/latest/download/module.json\`;m.download=\`https://github.com/\${r}/releases/download/v\${v}/\${id}-\${v}.zip\`;fs.writeFileSync(path,JSON.stringify(m,null,2)+'\n');"
66
-
67
- - name: Build release zip
68
- env:
69
- VERSION: ${{ steps.version.outputs.version }}
70
- PKG_ID: '{{ID}}'
71
- run: |
72
- cd dist
73
- zip -r "../${PKG_ID}-${VERSION}.zip" .
59
+ export VTTFORGE_DOWNLOAD_URL="https://github.com/$REPO/releases/download/v$VERSION/$PKG_ID-{version}.zip"
60
+ pnpm build
74
61
 
75
62
  - name: Create GitHub Release
76
63
  env:
@@ -13,14 +13,15 @@
13
13
  "format": "vttforge lint --fix"
14
14
  },
15
15
  "dependencies": {
16
- "@vttforge/core": "^0.19.0"
16
+ "@vttforge/core": "^0.20.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@vttforge/cli": "^0.17.0",
20
- "@vttforge/vite-plugin": "^0.5.0",
19
+ "@vttforge/cli": "^0.18.0",
20
+ "@vttforge/vite-plugin": "^0.6.0",
21
21
  "vite": "^8.2.2"
22
22
  },
23
23
  "engines": {
24
24
  "node": ">=26"
25
- }
25
+ },
26
+ "packageManager": "pnpm@11.25.0"
26
27
  }
@@ -30,13 +30,13 @@ jobs:
30
30
  fi
31
31
  echo "version=$version" >> "$GITHUB_OUTPUT"
32
32
 
33
+ # No `version` here: package.json's `packageManager` is the one source,
34
+ # and the action fails when both are set.
33
35
  - uses: pnpm/action-setup@v4
34
- with:
35
- version: 10
36
36
 
37
37
  - uses: actions/setup-node@v4
38
38
  with:
39
- node-version: 22
39
+ node-version: 26
40
40
 
41
41
  - run: pnpm install
42
42
 
@@ -46,31 +46,18 @@ jobs:
46
46
  run: |
47
47
  node -e "const fs=require('node:fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));p.version=process.env.VERSION;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n');"
48
48
 
49
- # We invoke vite directly (not `pnpm build` → `vttforge build`) because
50
- # the release workflow needs to:
51
- # 1. Run vite build → emit dist/module.json
52
- # 2. Patch manifest/download URLs into dist/module.json
53
- # 3. Zip dist/ → release artifact (so the zipped manifest carries URLs)
54
- # `vttforge build` zips at step 1, which would freeze the un-patched
55
- # manifest. Eventually the vite-plugin will support env-driven URL
56
- # injection and this dance disappears.
57
- - run: pnpm exec vite build
58
-
59
- - name: Inject release URLs into manifest
49
+ # `vttforge build` emits dist/ and zips it in one step. The plugin
50
+ # writes the two release URLs into the manifest before the zip is made,
51
+ # so the archive carries them.
52
+ - name: Build
60
53
  env:
61
54
  VERSION: ${{ steps.version.outputs.version }}
62
55
  REPO: ${{ github.repository }}
63
56
  PKG_ID: '{{ID}}'
57
+ VTTFORGE_MANIFEST_URL: https://github.com/${{ github.repository }}/releases/latest/download/module.json
64
58
  run: |
65
- node -e "const fs=require('node:fs');const path='dist/module.json';const m=JSON.parse(fs.readFileSync(path,'utf8'));const r=process.env.REPO;const v=process.env.VERSION;const id=process.env.PKG_ID;m.manifest=\`https://github.com/\${r}/releases/latest/download/module.json\`;m.download=\`https://github.com/\${r}/releases/download/v\${v}/\${id}-\${v}.zip\`;fs.writeFileSync(path,JSON.stringify(m,null,2)+'\n');"
66
-
67
- - name: Build release zip
68
- env:
69
- VERSION: ${{ steps.version.outputs.version }}
70
- PKG_ID: '{{ID}}'
71
- run: |
72
- cd dist
73
- zip -r "../${PKG_ID}-${VERSION}.zip" .
59
+ export VTTFORGE_DOWNLOAD_URL="https://github.com/$REPO/releases/download/v$VERSION/$PKG_ID-{version}.zip"
60
+ pnpm build
74
61
 
75
62
  - name: Create GitHub Release
76
63
  env:
@@ -14,15 +14,17 @@
14
14
  "typecheck": "tsc --noEmit"
15
15
  },
16
16
  "dependencies": {
17
- "@vttforge/core": "^0.19.0"
17
+ "@vttforge/core": "^0.20.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@vttforge/cli": "^0.17.0",
21
- "@vttforge/vite-plugin": "^0.5.0",
20
+ "@vttforge/cli": "^0.18.0",
21
+ "@vttforge/types": "^0.5.0",
22
+ "@vttforge/vite-plugin": "^0.6.0",
22
23
  "typescript": "^5.4.0",
23
24
  "vite": "^8.2.2"
24
25
  },
25
26
  "engines": {
26
27
  "node": ">=26"
27
- }
28
+ },
29
+ "packageManager": "pnpm@11.25.0"
28
30
  }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Foundry runtime globals, typed by `@vttforge/types`.
3
+ *
4
+ * An ambient declaration, so it lives in a `.d.ts` and `include` picks it up.
5
+ * Nothing imports it.
6
+ *
7
+ * `var`, not `const`. Two `declare global` blocks naming the same global have
8
+ * to merge, and only `var` merges. A `const` here collides with the identical
9
+ * declaration `@vttforge/testing` ships, and `tsc` stops with TS2451.
10
+ *
11
+ * `@vttforge/types` describes `game`, `ui`, `CONFIG`, `CONST`, the hook map
12
+ * and the document classes. It does not yet describe the `foundry.*`
13
+ * namespace, so `FoundryNamespace` below narrows the members this scaffold
14
+ * reaches for. Add to it as you use more, rather than widening the whole
15
+ * namespace to `any`: a typo in a namespaced path is the kind of mistake that
16
+ * only shows up at runtime, in front of a player.
17
+ */
18
+ import type {
19
+ ChatMessageConstructor,
20
+ FoundryConfig,
21
+ FoundryConstants,
22
+ Game,
23
+ HooksApi,
24
+ RollConstructor,
25
+ UiApi,
26
+ } from '@vttforge/types';
27
+
28
+ interface TextEditorImplementation {
29
+ enrichHTML(content: string, options?: Record<string, unknown>): Promise<string>;
30
+ }
31
+
32
+ interface FoundryNamespace {
33
+ readonly applications: {
34
+ readonly api: {
35
+ readonly DialogV2: {
36
+ confirm(options: Record<string, unknown>): Promise<boolean>;
37
+ };
38
+ };
39
+ readonly handlebars: {
40
+ renderTemplate(path: string, context: unknown): Promise<string>;
41
+ };
42
+ readonly ux: {
43
+ readonly TextEditor: { readonly implementation: TextEditorImplementation };
44
+ };
45
+ };
46
+ readonly utils: {
47
+ mergeObject<T>(original: T, other?: object, options?: object): T;
48
+ randomID(length?: number): string;
49
+ };
50
+ }
51
+
52
+ declare global {
53
+ var game: Game;
54
+ var CONFIG: FoundryConfig;
55
+ var CONST: FoundryConstants;
56
+ var Hooks: HooksApi;
57
+ var ui: UiApi;
58
+ var foundry: FoundryNamespace;
59
+ var Roll: RollConstructor;
60
+ var ChatMessage: ChatMessageConstructor;
61
+ }
@@ -5,7 +5,6 @@
5
5
  * modules copy from each other: the sub-type, its sheet, the enricher, the
6
6
  * settings, and the public API.
7
7
  */
8
- import './foundry-globals.js';
9
8
  import { registerModule, PackageConfig, VttfError } from '@vttforge/core';
10
9
  import { MODULE_ID, NOTE_TYPE } from './constants.js';
11
10
  import { NoteData } from './data/note-data.js';
@@ -30,13 +30,13 @@ jobs:
30
30
  fi
31
31
  echo "version=$version" >> "$GITHUB_OUTPUT"
32
32
 
33
+ # No `version` here: package.json's `packageManager` is the one source,
34
+ # and the action fails when both are set.
33
35
  - uses: pnpm/action-setup@v4
34
- with:
35
- version: 10
36
36
 
37
37
  - uses: actions/setup-node@v4
38
38
  with:
39
- node-version: 22
39
+ node-version: 26
40
40
 
41
41
  - run: pnpm install
42
42
 
@@ -46,31 +46,18 @@ jobs:
46
46
  run: |
47
47
  node -e "const fs=require('node:fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));p.version=process.env.VERSION;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n');"
48
48
 
49
- # We invoke vite directly (not `pnpm build` → `vttforge build`) because
50
- # the release workflow needs to:
51
- # 1. Run vite build → emit dist/system.json
52
- # 2. Patch manifest/download URLs into dist/system.json
53
- # 3. Zip dist/ → release artifact (so the zipped manifest carries URLs)
54
- # `vttforge build` zips at step 1, which would freeze the un-patched
55
- # manifest. Eventually the vite-plugin will support env-driven URL
56
- # injection and this dance disappears.
57
- - run: pnpm exec vite build
58
-
59
- - name: Inject release URLs into manifest
49
+ # `vttforge build` emits dist/ and zips it in one step. The plugin
50
+ # writes the two release URLs into the manifest before the zip is made,
51
+ # so the archive carries them.
52
+ - name: Build
60
53
  env:
61
54
  VERSION: ${{ steps.version.outputs.version }}
62
55
  REPO: ${{ github.repository }}
63
56
  PKG_ID: '{{ID}}'
57
+ VTTFORGE_MANIFEST_URL: https://github.com/${{ github.repository }}/releases/latest/download/system.json
64
58
  run: |
65
- node -e "const fs=require('node:fs');const path='dist/system.json';const m=JSON.parse(fs.readFileSync(path,'utf8'));const r=process.env.REPO;const v=process.env.VERSION;const id=process.env.PKG_ID;m.manifest=\`https://github.com/\${r}/releases/latest/download/system.json\`;m.download=\`https://github.com/\${r}/releases/download/v\${v}/\${id}-\${v}.zip\`;fs.writeFileSync(path,JSON.stringify(m,null,2)+'\n');"
66
-
67
- - name: Build release zip
68
- env:
69
- VERSION: ${{ steps.version.outputs.version }}
70
- PKG_ID: '{{ID}}'
71
- run: |
72
- cd dist
73
- zip -r "../${PKG_ID}-${VERSION}.zip" .
59
+ export VTTFORGE_DOWNLOAD_URL="https://github.com/$REPO/releases/download/v$VERSION/$PKG_ID-{version}.zip"
60
+ pnpm build
74
61
 
75
62
  - name: Create GitHub Release
76
63
  env:
@@ -13,15 +13,16 @@
13
13
  "format": "vttforge lint --fix"
14
14
  },
15
15
  "dependencies": {
16
- "@vttforge/core": "^0.19.0",
16
+ "@vttforge/core": "^0.20.0",
17
17
  "@vttforge/styles": "^0.5.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@vttforge/cli": "^0.17.0",
21
- "@vttforge/vite-plugin": "^0.5.0",
20
+ "@vttforge/cli": "^0.18.0",
21
+ "@vttforge/vite-plugin": "^0.6.0",
22
22
  "vite": "^8.2.2"
23
23
  },
24
24
  "engines": {
25
25
  "node": ">=26"
26
- }
26
+ },
27
+ "packageManager": "pnpm@11.25.0"
27
28
  }
@@ -30,13 +30,13 @@ jobs:
30
30
  fi
31
31
  echo "version=$version" >> "$GITHUB_OUTPUT"
32
32
 
33
+ # No `version` here: package.json's `packageManager` is the one source,
34
+ # and the action fails when both are set.
33
35
  - uses: pnpm/action-setup@v4
34
- with:
35
- version: 10
36
36
 
37
37
  - uses: actions/setup-node@v4
38
38
  with:
39
- node-version: 22
39
+ node-version: 26
40
40
 
41
41
  - run: pnpm install
42
42
 
@@ -46,31 +46,18 @@ jobs:
46
46
  run: |
47
47
  node -e "const fs=require('node:fs');const p=JSON.parse(fs.readFileSync('package.json','utf8'));p.version=process.env.VERSION;fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n');"
48
48
 
49
- # We invoke vite directly (not `pnpm build` → `vttforge build`) because
50
- # the release workflow needs to:
51
- # 1. Run vite build → emit dist/system.json
52
- # 2. Patch manifest/download URLs into dist/system.json
53
- # 3. Zip dist/ → release artifact (so the zipped manifest carries URLs)
54
- # `vttforge build` zips at step 1, which would freeze the un-patched
55
- # manifest. Eventually the vite-plugin will support env-driven URL
56
- # injection and this dance disappears.
57
- - run: pnpm exec vite build
58
-
59
- - name: Inject release URLs into manifest
49
+ # `vttforge build` emits dist/ and zips it in one step. The plugin
50
+ # writes the two release URLs into the manifest before the zip is made,
51
+ # so the archive carries them.
52
+ - name: Build
60
53
  env:
61
54
  VERSION: ${{ steps.version.outputs.version }}
62
55
  REPO: ${{ github.repository }}
63
56
  PKG_ID: '{{ID}}'
57
+ VTTFORGE_MANIFEST_URL: https://github.com/${{ github.repository }}/releases/latest/download/system.json
64
58
  run: |
65
- node -e "const fs=require('node:fs');const path='dist/system.json';const m=JSON.parse(fs.readFileSync(path,'utf8'));const r=process.env.REPO;const v=process.env.VERSION;const id=process.env.PKG_ID;m.manifest=\`https://github.com/\${r}/releases/latest/download/system.json\`;m.download=\`https://github.com/\${r}/releases/download/v\${v}/\${id}-\${v}.zip\`;fs.writeFileSync(path,JSON.stringify(m,null,2)+'\n');"
66
-
67
- - name: Build release zip
68
- env:
69
- VERSION: ${{ steps.version.outputs.version }}
70
- PKG_ID: '{{ID}}'
71
- run: |
72
- cd dist
73
- zip -r "../${PKG_ID}-${VERSION}.zip" .
59
+ export VTTFORGE_DOWNLOAD_URL="https://github.com/$REPO/releases/download/v$VERSION/$PKG_ID-{version}.zip"
60
+ pnpm build
74
61
 
75
62
  - name: Create GitHub Release
76
63
  env:
@@ -14,16 +14,18 @@
14
14
  "typecheck": "tsc --noEmit"
15
15
  },
16
16
  "dependencies": {
17
- "@vttforge/core": "^0.19.0",
17
+ "@vttforge/core": "^0.20.0",
18
18
  "@vttforge/styles": "^0.5.0"
19
19
  },
20
20
  "devDependencies": {
21
- "@vttforge/cli": "^0.17.0",
22
- "@vttforge/vite-plugin": "^0.5.0",
21
+ "@vttforge/cli": "^0.18.0",
22
+ "@vttforge/types": "^0.5.0",
23
+ "@vttforge/vite-plugin": "^0.6.0",
23
24
  "typescript": "^5.4.0",
24
25
  "vite": "^8.2.2"
25
26
  },
26
27
  "engines": {
27
28
  "node": ">=26"
28
- }
29
+ },
30
+ "packageManager": "pnpm@11.25.0"
29
31
  }
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Foundry runtime globals, typed by `@vttforge/types`.
3
+ *
4
+ * An ambient declaration, so it lives in a `.d.ts` and `include` picks it up.
5
+ * Nothing imports it.
6
+ *
7
+ * `var`, not `const`. Two `declare global` blocks naming the same global have
8
+ * to merge, and only `var` merges. A `const` here collides with the identical
9
+ * declaration `@vttforge/testing` ships, and `tsc` stops with TS2451.
10
+ *
11
+ * `@vttforge/types` describes `game`, `ui`, `CONFIG`, `CONST`, the hook map
12
+ * and the document classes. It does not yet describe the `foundry.*`
13
+ * namespace, so `FoundryNamespace` below narrows the members this scaffold
14
+ * reaches for. Add to it as you use more, rather than widening the whole
15
+ * namespace to `any`: a typo in a namespaced path is the kind of mistake that
16
+ * only shows up at runtime, in front of a player.
17
+ */
18
+ import type {
19
+ ChatMessageConstructor,
20
+ FoundryConfig,
21
+ FoundryConstants,
22
+ Game,
23
+ HooksApi,
24
+ RollConstructor,
25
+ UiApi,
26
+ } from '@vttforge/types';
27
+
28
+ interface TextEditorImplementation {
29
+ enrichHTML(content: string, options?: Record<string, unknown>): Promise<string>;
30
+ }
31
+
32
+ interface FoundryNamespace {
33
+ readonly applications: {
34
+ readonly api: {
35
+ readonly DialogV2: {
36
+ confirm(options: Record<string, unknown>): Promise<boolean>;
37
+ };
38
+ };
39
+ readonly handlebars: {
40
+ renderTemplate(path: string, context: unknown): Promise<string>;
41
+ };
42
+ readonly ux: {
43
+ readonly TextEditor: { readonly implementation: TextEditorImplementation };
44
+ };
45
+ };
46
+ readonly utils: {
47
+ mergeObject<T>(original: T, other?: object, options?: object): T;
48
+ randomID(length?: number): string;
49
+ };
50
+ }
51
+
52
+ declare global {
53
+ var game: Game;
54
+ var CONFIG: FoundryConfig;
55
+ var CONST: FoundryConstants;
56
+ var Hooks: HooksApi;
57
+ var ui: UiApi;
58
+ var foundry: FoundryNamespace;
59
+ var Roll: RollConstructor;
60
+ var ChatMessage: ChatMessageConstructor;
61
+ }
@@ -5,7 +5,6 @@
5
5
  * systems copy from each other: data models, initiative, sheets, settings,
6
6
  * and the `ready`-time migration gate.
7
7
  */
8
- import './foundry-globals.js';
9
8
  import { registerSystem, PackageConfig, VttfError } from '@vttforge/core';
10
9
  import { CharacterData } from './data/character-data.js';
11
10
  import { GearData } from './data/gear-data.js';