fg-devkit 1.17.0 → 1.17.2
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/.cursor/rules/core-coding-standards.mdc +13 -0
- package/README.md +2 -1
- package/configs/dependency-policy.vue-workspace.json +1 -1
- package/package.json +1 -1
- package/scaffold/vue/.gitignore +13 -0
- package/scaffold/vue/package.json +2 -2
- package/scripts/fg-devkit.mjs +5 -4
- package/scripts/prune-overrides.mjs +73 -8
|
@@ -49,6 +49,14 @@ alwaysApply: true
|
|
|
49
49
|
- Centralize HTTP and endpoint wiring in a dedicated API layer (for example `src/api/endpoints/*` or the convention used in the repo).
|
|
50
50
|
- Consume server state through query/mutation hooks (for example `src/queries/*` or equivalent), not ad-hoc fetches in UI code.
|
|
51
51
|
|
|
52
|
+
## Query strings
|
|
53
|
+
|
|
54
|
+
- Build query strings with `URLSearchParams` (or a shared helper that wraps it).
|
|
55
|
+
- Do not concatenate `key=value` fragments with `&`.
|
|
56
|
+
- Let `URLSearchParams` encode values. Do not interpolate untrusted or user-entered values into URLs.
|
|
57
|
+
- `toString()` has no leading `?`. Prefix it when appending to a path, and skip empty values instead of emitting empty keys.
|
|
58
|
+
- For list views, derive the query string in the view from route filter state (`requestQueryParams` computed). The API layer should accept the query string, not reconstruct filters.
|
|
59
|
+
|
|
52
60
|
## State-management boundaries
|
|
53
61
|
|
|
54
62
|
- Use TanStack Query for server state and caching. Do not add Vuex for new work.
|
|
@@ -85,6 +93,11 @@ alwaysApply: true
|
|
|
85
93
|
- Prefer named-route navigation for internal flows (`{ name, params, query }`) and reserve raw path pushes for simple/static redirects.
|
|
86
94
|
- Preserve existing query params intentionally when updating filters, pagination, or tab state.
|
|
87
95
|
- Lazy-load route components with dynamic imports to keep initial bundles smaller.
|
|
96
|
+
- Name organisation route params by domain meaning, not generic `id`:
|
|
97
|
+
- top org: `:topClientNumber`
|
|
98
|
+
- unit/sub-org: `:unitClientNumber`
|
|
99
|
+
- Prefer `/organisations/:topClientNumber/units/:unitClientNumber` over `:id` / `:clino`.
|
|
100
|
+
- Keep route param names aligned with component props when using `props: true`.
|
|
88
101
|
|
|
89
102
|
## Vue and UI expectations
|
|
90
103
|
|
package/README.md
CHANGED
|
@@ -152,11 +152,12 @@ Fix one or more vulnerability overrides interactively, prune unused overrides, a
|
|
|
152
152
|
pnpm exec fgd audit-override-commit
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
Report or remove workspace overrides that no longer change `pnpm audit`:
|
|
155
|
+
Report, remove, or remove and auto-commit workspace overrides that no longer change `pnpm audit`:
|
|
156
156
|
|
|
157
157
|
```bash
|
|
158
158
|
pnpm exec fgd prune-overrides
|
|
159
159
|
pnpm exec fgd prune-overrides --fix
|
|
160
|
+
pnpm exec fgd prune-overrides --commit
|
|
160
161
|
```
|
|
161
162
|
|
|
162
163
|
## tsconfig in consuming repos
|
package/package.json
CHANGED
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"@intlify/unplugin-vue-i18n": "11.2.5",
|
|
33
33
|
"@tanstack/vue-query-devtools": "6.1.48",
|
|
34
34
|
"@types/node": "22.16.5",
|
|
35
|
-
"fg-devkit": "1.17.
|
|
35
|
+
"fg-devkit": "1.17.2",
|
|
36
36
|
"@vitejs/plugin-vue": "6.0.9",
|
|
37
37
|
"tailwindcss": "4.3.3",
|
|
38
38
|
"tsx": "4.23.13",
|
|
39
39
|
"vite": "7.3.5",
|
|
40
40
|
"vite-plugin-vue-inspector": "7.0.0"
|
|
41
41
|
},
|
|
42
|
-
"packageManager": "pnpm@
|
|
42
|
+
"packageManager": "pnpm@12.4.2",
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=22.13.0"
|
|
45
45
|
}
|
package/scripts/fg-devkit.mjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* pnpm exec fg-devkit policy-upgrade [policy-file] [ncu-args...]
|
|
18
18
|
* pnpm exec fg-devkit policy-upgrade-commit [--prune-overrides] [ncu-args...]
|
|
19
19
|
* pnpm exec fg-devkit audit-override-commit [pnpm-audit-args...]
|
|
20
|
-
* pnpm exec fg-devkit prune-overrides [--fix]
|
|
20
|
+
* pnpm exec fg-devkit prune-overrides [--fix] [--commit]
|
|
21
21
|
* pnpm exec fg-devkit sync-project-configs (VS Code + tooling sync; overwrites config files)
|
|
22
22
|
* pnpm exec fg-devkit sync-tooling-configs (tooling sync only; overwrites config files)
|
|
23
23
|
* pnpm exec fg-devkit sync-vscode-settings
|
|
@@ -539,7 +539,8 @@ Commands:
|
|
|
539
539
|
--prune-overrides also drops unused workspace overrides in a second commit
|
|
540
540
|
audit-override-commit [pnpm-audit-args...]
|
|
541
541
|
Fix vulnerability overrides via pnpm audit, prune unused ones, auto-commit
|
|
542
|
-
prune-overrides [--fix]
|
|
542
|
+
prune-overrides [--fix] [--commit]
|
|
543
|
+
Report unused workspace overrides; --fix removes them; --commit also auto-commits
|
|
543
544
|
sync-project-configs VS Code + tooling sync (overwrites config files)
|
|
544
545
|
sync-tooling-configs Tooling sync only (overwrites config files)
|
|
545
546
|
sync-vscode-settings Copy shared VS Code settings into .vscode/settings.json
|
|
@@ -818,7 +819,7 @@ async function runInteractiveMenu() {
|
|
|
818
819
|
{ name: 'Upgrade package.json packages and auto-commit', value: 'upgrade-commit' },
|
|
819
820
|
{ name: 'Upgrade package.json packages, prune overrides, and auto-commit', value: 'upgrade-commit-prune' },
|
|
820
821
|
{ name: 'Fix vulnerability overrides and auto-commit', value: 'audit-override-commit' },
|
|
821
|
-
{ name: 'Prune unused vulnerability overrides', value: 'prune-overrides' },
|
|
822
|
+
{ name: 'Prune unused vulnerability overrides and auto-commit', value: 'prune-overrides' },
|
|
822
823
|
{ name: 'Cancel', value: 'cancel' },
|
|
823
824
|
],
|
|
824
825
|
default: 'check',
|
|
@@ -839,7 +840,7 @@ async function runInteractiveMenu() {
|
|
|
839
840
|
return runSelectedAction(() => runNode('audit-override-commit.mjs'))
|
|
840
841
|
}
|
|
841
842
|
if (choice === 'prune-overrides') {
|
|
842
|
-
return runSelectedAction(() => runNode('prune-overrides.mjs', ['--
|
|
843
|
+
return runSelectedAction(() => runNode('prune-overrides.mjs', ['--commit']))
|
|
843
844
|
}
|
|
844
845
|
return 1
|
|
845
846
|
}
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* dropped just because each is redundant while the others exist.
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
|
-
* pnpm exec fg-devkit prune-overrides
|
|
12
|
-
* pnpm exec fg-devkit prune-overrides --fix
|
|
11
|
+
* pnpm exec fg-devkit prune-overrides # report only
|
|
12
|
+
* pnpm exec fg-devkit prune-overrides --fix # drop the prunable entries
|
|
13
|
+
* pnpm exec fg-devkit prune-overrides --commit # drop them and auto-commit
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
import { mkdtempSync, rmSync, cpSync, readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
@@ -17,6 +18,12 @@ import { tmpdir } from 'node:os'
|
|
|
17
18
|
import { join } from 'node:path'
|
|
18
19
|
import { spawnSync } from 'node:child_process'
|
|
19
20
|
import { parseArgs } from 'node:util'
|
|
21
|
+
import {
|
|
22
|
+
buildOverrideCommitMessage,
|
|
23
|
+
collectOverrideChanges,
|
|
24
|
+
collectOverrides,
|
|
25
|
+
formatOverrideValue,
|
|
26
|
+
} from './override-changes.mjs'
|
|
20
27
|
|
|
21
28
|
const ROOT = process.cwd()
|
|
22
29
|
const WORKSPACE_FILE = 'pnpm-workspace.yaml'
|
|
@@ -25,19 +32,71 @@ const COPIED_FILES = ['package.json', 'pnpm-lock.yaml', WORKSPACE_FILE, '.npmrc'
|
|
|
25
32
|
const { values: args } = parseArgs({
|
|
26
33
|
options: {
|
|
27
34
|
fix: { type: 'boolean', default: false },
|
|
35
|
+
commit: { type: 'boolean', default: false },
|
|
28
36
|
help: { type: 'boolean', short: 'h', default: false },
|
|
29
37
|
},
|
|
30
38
|
strict: true,
|
|
31
39
|
})
|
|
32
40
|
|
|
33
41
|
if (args.help) {
|
|
34
|
-
console.log(`Usage: pnpm exec fg-devkit prune-overrides [--fix]
|
|
42
|
+
console.log(`Usage: pnpm exec fg-devkit prune-overrides [--fix] [--commit]
|
|
35
43
|
|
|
36
44
|
Reports workspace overrides that can be removed without introducing new
|
|
37
|
-
pnpm audit findings. Pass --fix to delete those entries in place
|
|
45
|
+
pnpm audit findings. Pass --fix to delete those entries in place.
|
|
46
|
+
Pass --commit to apply the deletions and auto-commit.`)
|
|
38
47
|
process.exit(0)
|
|
39
48
|
}
|
|
40
49
|
|
|
50
|
+
const shouldFix = args.fix || args.commit
|
|
51
|
+
|
|
52
|
+
function runGit(gitArgs) {
|
|
53
|
+
const result = spawnSync('git', gitArgs, {
|
|
54
|
+
stdio: 'inherit',
|
|
55
|
+
cwd: ROOT,
|
|
56
|
+
env: process.env,
|
|
57
|
+
})
|
|
58
|
+
if (result.error) {
|
|
59
|
+
console.error('[prune-overrides]', result.error.message)
|
|
60
|
+
return 1
|
|
61
|
+
}
|
|
62
|
+
return result.status ?? 1
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function commitOverrideChanges(beforeOverrides, afterOverrides) {
|
|
66
|
+
const changed = collectOverrideChanges(beforeOverrides, afterOverrides)
|
|
67
|
+
if (changed.length === 0) {
|
|
68
|
+
console.log('[prune-overrides] No override changes to commit.')
|
|
69
|
+
return 0
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
console.log('[prune-overrides] Override changes detected:')
|
|
73
|
+
for (const item of changed) {
|
|
74
|
+
const fromLabel = item.from ?? '(missing)'
|
|
75
|
+
console.log(` - ${item.name}: ${fromLabel} -> ${formatOverrideValue(item.to)}`)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const files = ['package.json', 'pnpm-lock.yaml', WORKSPACE_FILE].filter((file) =>
|
|
79
|
+
existsSync(join(ROOT, file)),
|
|
80
|
+
)
|
|
81
|
+
if (files.length === 0) {
|
|
82
|
+
console.error('[prune-overrides] No files to stage.')
|
|
83
|
+
return 1
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const stageExitCode = runGit(['add', '--', ...files])
|
|
87
|
+
if (stageExitCode !== 0) {
|
|
88
|
+
return stageExitCode
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const { subject, body } = buildOverrideCommitMessage(changed)
|
|
92
|
+
console.log(`[prune-overrides] Auto-committing: ${subject}`)
|
|
93
|
+
if (body) {
|
|
94
|
+
console.log(body)
|
|
95
|
+
}
|
|
96
|
+
const commitArgs = body ? ['commit', '-m', subject, '-m', body] : ['commit', '-m', subject]
|
|
97
|
+
return runGit(commitArgs)
|
|
98
|
+
}
|
|
99
|
+
|
|
41
100
|
function runPnpm(cwd, pnpmArgs, { allowFailure = false } = {}) {
|
|
42
101
|
const result = spawnSync('pnpm', pnpmArgs, {
|
|
43
102
|
cwd,
|
|
@@ -252,16 +311,22 @@ function main() {
|
|
|
252
311
|
console.log(` - ${key}`)
|
|
253
312
|
}
|
|
254
313
|
|
|
255
|
-
if (!
|
|
256
|
-
console.log('\nRe-run with --fix to remove them
|
|
314
|
+
if (!shouldFix) {
|
|
315
|
+
console.log('\nRe-run with --fix to remove them, or --commit to remove and auto-commit.')
|
|
257
316
|
return 0
|
|
258
317
|
}
|
|
259
318
|
|
|
319
|
+
const beforeOverrides = collectOverrides(ROOT)
|
|
260
320
|
writeFileSync(workspacePath, writeOverrides(original, remaining.keys()))
|
|
261
321
|
console.log('\nUpdated pnpm-workspace.yaml. Refreshing lockfile…')
|
|
262
322
|
runPnpm(ROOT, ['install', '--no-frozen-lockfile', '--ignore-scripts'])
|
|
263
|
-
|
|
264
|
-
|
|
323
|
+
|
|
324
|
+
if (!args.commit) {
|
|
325
|
+
console.log('Done.')
|
|
326
|
+
return 0
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return commitOverrideChanges(beforeOverrides, collectOverrides(ROOT))
|
|
265
330
|
} finally {
|
|
266
331
|
rmSync(tempDir, { recursive: true, force: true })
|
|
267
332
|
}
|