fg-devkit 1.7.14 → 1.8.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.
- package/configs/dependency-policy.vue-workspace.json +25 -25
- package/configs/lefthook.yml +2 -0
- package/package.json +9 -5
- package/scaffold/vue/package.json +6 -6
- package/scripts/cz/.cz-config.cjs +13 -7
- package/scripts/fg-devkit.mjs +139 -30
- package/scripts/lefthook-audit-if-enabled.mjs +23 -0
- package/scripts/prune-consumer-deps.mjs +3 -1
- package/scripts/sync-consumer-lefthook.mjs +2 -0
- package/scripts/cz/cz-adapter.cjs +0 -127
|
@@ -5,33 +5,33 @@
|
|
|
5
5
|
"@lexical/html": "0.30.0",
|
|
6
6
|
"@lexical/list": "0.30.0",
|
|
7
7
|
"@lexical/rich-text": "0.30.0",
|
|
8
|
-
"@piwikpro/vue-piwik-pro": "1.
|
|
9
|
-
"@sentry/browser": "10.
|
|
8
|
+
"@piwikpro/vue-piwik-pro": "1.7.0",
|
|
9
|
+
"@sentry/browser": "10.52.0",
|
|
10
10
|
"@sentry/tracing": "7.120.4",
|
|
11
|
-
"@sentry/vue": "10.
|
|
12
|
-
"@sentry/wasm": "10.
|
|
13
|
-
"@tailwindcss/postcss": "4.
|
|
11
|
+
"@sentry/vue": "10.52.0",
|
|
12
|
+
"@sentry/wasm": "10.52.0",
|
|
13
|
+
"@tailwindcss/postcss": "4.3.0",
|
|
14
14
|
"@tanstack/vue-query": "5.100.9",
|
|
15
|
-
"@types/leaflet": "1.
|
|
15
|
+
"@types/leaflet": "1.9.21",
|
|
16
16
|
"@unhead/vue": "2.0.5",
|
|
17
17
|
"@vue-leaflet/vue-leaflet": "0.10.1",
|
|
18
18
|
"@vuelidate/core": "2.0.3",
|
|
19
19
|
"@vuelidate/validators": "2.0.4",
|
|
20
20
|
"@vueuse/components": "12.7.0",
|
|
21
|
-
"@vueuse/core": "14.
|
|
21
|
+
"@vueuse/core": "14.3.0",
|
|
22
22
|
"chart.js": "4.5.1",
|
|
23
23
|
"content-disposition-header": "0.6.0",
|
|
24
24
|
"date-fns": "4.1.0",
|
|
25
|
-
"element-plus": "2.
|
|
26
|
-
"fds-vue-core": "7.1.
|
|
25
|
+
"element-plus": "2.14.0",
|
|
26
|
+
"fds-vue-core": "7.1.6",
|
|
27
27
|
"imask": "7.6.1",
|
|
28
|
-
"leaflet": "1.
|
|
28
|
+
"leaflet": "1.9.4",
|
|
29
29
|
"lexical": "0.30.0",
|
|
30
30
|
"lodash": "4.18.1",
|
|
31
31
|
"lodash-es": "4.18.1",
|
|
32
32
|
"markdown-it": "14.1.1",
|
|
33
33
|
"pinia": "3.0.4",
|
|
34
|
-
"playwright": "1.
|
|
34
|
+
"playwright": "1.59.1",
|
|
35
35
|
"quill": "2.0.3",
|
|
36
36
|
"randexp": "0.5.3",
|
|
37
37
|
"register-service-worker": "1.7.2",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"vega-lite": "6.4.3",
|
|
40
40
|
"vue-chartjs": "5.3.3",
|
|
41
41
|
"vue-i18n": "11.4.2",
|
|
42
|
-
"vue-quilly": "1.
|
|
42
|
+
"vue-quilly": "1.1.6",
|
|
43
43
|
"vue-router": "4.6.3",
|
|
44
44
|
"vue3-touch-keyboard": "1.3.9",
|
|
45
45
|
"vuex": "4.1.0",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
"yup": "1.7.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@chromatic-com/storybook": "5.
|
|
50
|
+
"@chromatic-com/storybook": "5.1.2",
|
|
51
51
|
"@eslint/js": "9.39.1",
|
|
52
52
|
"@intlify/unplugin-vue-i18n": "11.1.2",
|
|
53
53
|
"@playwright/test": "1.59.1",
|
|
54
|
-
"@storybook/addon-a11y": "10.
|
|
55
|
-
"@storybook/addon-docs": "10.
|
|
56
|
-
"@storybook/addon-vitest": "10.
|
|
57
|
-
"@storybook/vue3": "10.
|
|
58
|
-
"@storybook/vue3-vite": "10.
|
|
54
|
+
"@storybook/addon-a11y": "10.3.6",
|
|
55
|
+
"@storybook/addon-docs": "10.3.6",
|
|
56
|
+
"@storybook/addon-vitest": "10.3.6",
|
|
57
|
+
"@storybook/vue3": "10.3.6",
|
|
58
|
+
"@storybook/vue3-vite": "10.3.6",
|
|
59
59
|
"@tanstack/vue-query-devtools": "6.1.28",
|
|
60
60
|
"@tsconfig/node22": "22.0.5",
|
|
61
61
|
"@types/lodash-es": "4.17.12",
|
|
@@ -68,28 +68,28 @@
|
|
|
68
68
|
"@vuepic/vue-datepicker": "6.0.3",
|
|
69
69
|
"arg": "5.0.2",
|
|
70
70
|
"babel-eslint": "10.1.0",
|
|
71
|
-
"eslint-plugin-storybook": "10.
|
|
71
|
+
"eslint-plugin-storybook": "10.3.6",
|
|
72
72
|
"globals": "15.11.0",
|
|
73
73
|
"jsdom": "26.1.0",
|
|
74
74
|
"postcss": "8.5.14",
|
|
75
75
|
"sass": "1.99.0",
|
|
76
76
|
"start-server-and-test": "2.1.3",
|
|
77
|
-
"storybook": "10.
|
|
77
|
+
"storybook": "10.3.6",
|
|
78
78
|
"tsx": "4.21.0",
|
|
79
79
|
"vega": "6.2.0",
|
|
80
80
|
"vite-plugin-dts": "4.5.4",
|
|
81
|
-
"vite-plugin-vue-devtools": "8.1.
|
|
81
|
+
"vite-plugin-vue-devtools": "8.1.2",
|
|
82
82
|
"vitest": "3.2.4",
|
|
83
|
-
"yaml": "2.
|
|
83
|
+
"yaml": "2.9.0"
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"managedAnywhere": {
|
|
87
|
-
"@tailwindcss/vite": "4.
|
|
87
|
+
"@tailwindcss/vite": "4.3.0",
|
|
88
88
|
"@vitejs/plugin-vue": "6.0.6",
|
|
89
89
|
"axios": "1.16.0",
|
|
90
90
|
"dotenv": "16.4.5",
|
|
91
|
-
"qrcode.vue": "3.
|
|
92
|
-
"tailwindcss": "4.
|
|
91
|
+
"qrcode.vue": "3.9.0",
|
|
92
|
+
"tailwindcss": "4.3.0",
|
|
93
93
|
"vite": "7.3.2",
|
|
94
94
|
"vue": "3.5.34"
|
|
95
95
|
},
|
package/configs/lefthook.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fg-devkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Shared configs, scripts, and DX tooling for Vue / TypeScript frontend repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"./vscode-settings.json": "./configs/vscode-settings.json",
|
|
20
20
|
"./dependency-policy.vue-workspace.json": "./configs/dependency-policy.vue-workspace.json",
|
|
21
21
|
"./vuln-commit": "./scripts/vuln-commit.mjs",
|
|
22
|
-
"./cz-adapter": "./scripts/cz/cz-adapter.cjs",
|
|
23
22
|
"./cz-config": "./scripts/cz/.cz-config.cjs",
|
|
24
23
|
"./scripts/sync-peers-from-dev.mjs": "./scripts/sync-peers-from-dev.mjs",
|
|
25
24
|
"./scripts/sync-vscode-settings.mjs": "./scripts/sync-vscode-settings.mjs",
|
|
@@ -46,8 +45,8 @@
|
|
|
46
45
|
"./scripts/poeditor-upload.mjs": "./scripts/poeditor-upload.mjs",
|
|
47
46
|
"./scripts/scaffold-vue.mjs": "./scripts/scaffold-vue.mjs",
|
|
48
47
|
"./scripts/fg-devkit.mjs": "./scripts/fg-devkit.mjs",
|
|
48
|
+
"./scripts/lefthook-audit-if-enabled.mjs": "./scripts/lefthook-audit-if-enabled.mjs",
|
|
49
49
|
"./scripts/release.sh": "./scripts/release.sh",
|
|
50
|
-
"./scripts/cz/cz-adapter.cjs": "./scripts/cz/cz-adapter.cjs",
|
|
51
50
|
"./scripts/cz/.cz-config.cjs": "./scripts/cz/.cz-config.cjs",
|
|
52
51
|
"./cursor-rules/core-coding-standards.mdc": "./.cursor/rules/core-coding-standards.mdc"
|
|
53
52
|
},
|
|
@@ -69,11 +68,13 @@
|
|
|
69
68
|
],
|
|
70
69
|
"config": {
|
|
71
70
|
"commitizen": {
|
|
72
|
-
"path": "
|
|
71
|
+
"path": "node_modules/cz-git",
|
|
72
|
+
"czConfig": "./scripts/cz/.cz-config.cjs"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
76
|
"@inquirer/confirm": "^6.0.12",
|
|
77
|
+
"@inquirer/input": "^5.0.12",
|
|
77
78
|
"@inquirer/select": "^5.1.4",
|
|
78
79
|
"@intlify/eslint-plugin-vue-i18n": "4.3.0",
|
|
79
80
|
"@typescript-eslint/eslint-plugin": "8.58.2",
|
|
@@ -82,7 +83,6 @@
|
|
|
82
83
|
"@vue/eslint-config-prettier": "10.2.0",
|
|
83
84
|
"@vue/eslint-config-typescript": "14.7.0",
|
|
84
85
|
"@vue/tsconfig": "0.9.1",
|
|
85
|
-
"commitizen": "4.3.1",
|
|
86
86
|
"eslint": "10.2.1",
|
|
87
87
|
"eslint-plugin-prettier": "5.5.5",
|
|
88
88
|
"eslint-plugin-vue": "10.8.0",
|
|
@@ -94,5 +94,9 @@
|
|
|
94
94
|
"vue-eslint-parser": "10.4.0",
|
|
95
95
|
"vue-tsc": "3.2.7"
|
|
96
96
|
},
|
|
97
|
+
"devDependencies": {
|
|
98
|
+
"cz-git": "^1.13.1",
|
|
99
|
+
"czg": "^1.13.1"
|
|
100
|
+
},
|
|
97
101
|
"scripts": {}
|
|
98
102
|
}
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"poeditor:upload": "pnpm exec fg-devkit poeditor-upload"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@tailwindcss/postcss": "4.
|
|
19
|
-
"@tailwindcss/vite": "4.
|
|
18
|
+
"@tailwindcss/postcss": "4.3.0",
|
|
19
|
+
"@tailwindcss/vite": "4.3.0",
|
|
20
20
|
"@tanstack/vue-query": "5.100.9",
|
|
21
21
|
"axios": "1.16.0",
|
|
22
22
|
"content-disposition-header": "0.6.0",
|
|
23
23
|
"date-fns": "4.1.0",
|
|
24
24
|
"dotenv": "16.4.5",
|
|
25
|
-
"fds-vue-core": "7.1.
|
|
25
|
+
"fds-vue-core": "7.1.6",
|
|
26
26
|
"pinia": "3.0.4",
|
|
27
|
-
"qrcode.vue": "3.
|
|
27
|
+
"qrcode.vue": "3.9.0",
|
|
28
28
|
"vue": "3.5.34",
|
|
29
29
|
"vue-i18n": "11.4.2",
|
|
30
30
|
"vue-router": "4.6.3"
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"@tanstack/vue-query-devtools": "6.1.28",
|
|
35
35
|
"@types/node": "22.16.5",
|
|
36
36
|
"@vitejs/plugin-vue": "6.0.6",
|
|
37
|
-
"fg-devkit": "1.
|
|
37
|
+
"fg-devkit": "1.8.1",
|
|
38
38
|
"start-server-and-test": "2.1.3",
|
|
39
|
-
"tailwindcss": "4.
|
|
39
|
+
"tailwindcss": "4.3.0",
|
|
40
40
|
"tsx": "4.21.0",
|
|
41
41
|
"vite": "7.3.2"
|
|
42
42
|
},
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* cz-git config used by fg-devkit commit flows.
|
|
3
|
+
* Keep this in czrc-compatible shape for `czg --config`.
|
|
4
|
+
*
|
|
5
|
+
* Note: interactive `fg-devkit commit` asks each dep/vuln commit whether Lefthook should run
|
|
6
|
+
* `pnpm audit` for that commit only (via env, not persisted).
|
|
4
7
|
*/
|
|
5
8
|
module.exports = {
|
|
6
9
|
types: [
|
|
@@ -11,16 +14,19 @@ module.exports = {
|
|
|
11
14
|
{ value: 'chore', name: 'chore(scope): Changed' },
|
|
12
15
|
{ value: 'dep', name: 'dep(scope): Dependencies (single package or batch)' },
|
|
13
16
|
{ value: 'vuln', name: 'vuln(scope): Security dependency update (single package or batch)' },
|
|
14
|
-
{ value: 'fix(security)', name: 'fix(security): Security' }
|
|
17
|
+
{ value: 'fix(security)', name: 'fix(security): Security' },
|
|
15
18
|
],
|
|
16
19
|
allowCustomScopes: true,
|
|
20
|
+
allowEmptyScopes: false,
|
|
17
21
|
allowBreakingChanges: [],
|
|
18
|
-
skipQuestions: ['footer', '
|
|
19
|
-
|
|
22
|
+
skipQuestions: ['breaking', 'footer', 'issues', 'issuePrefixes'],
|
|
23
|
+
maxSubjectLength: 120,
|
|
24
|
+
breaklineChar: '|',
|
|
25
|
+
useEmoji: false,
|
|
20
26
|
messages: {
|
|
21
27
|
type: 'Select the type of change you are committing:',
|
|
22
28
|
customScope: 'Packages (for dep/vuln) or scope:',
|
|
23
29
|
subject: 'Commit subject (imperative, no trailing period):',
|
|
24
|
-
body: "Optional body (use '|' for newline):"
|
|
25
|
-
}
|
|
30
|
+
body: "Optional body (use '|' for newline):",
|
|
31
|
+
},
|
|
26
32
|
}
|
package/scripts/fg-devkit.mjs
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* pnpm exec fg-devkit prune-consumer-deps [--dry-run]
|
|
22
22
|
* pnpm exec fg-devkit full-consumer-setup
|
|
23
23
|
* pnpm exec fg-devkit create-release [patch|minor|major]
|
|
24
|
-
* pnpm exec fg-devkit commit [cz-args...] (
|
|
24
|
+
* pnpm exec fg-devkit commit [cz-args...] (czg/cz-git with fg-devkit bundled config)
|
|
25
25
|
* pnpm exec fg-devkit commit-vuln (staged package.json version bumps → vuln() commit)
|
|
26
26
|
* pnpm exec fg-devkit lint [eslint-args...] (run ESLint with fg-devkit bundled packages)
|
|
27
27
|
* pnpm exec fg-devkit lint-fix [eslint-args...] (same as lint plus --fix)
|
|
@@ -171,41 +171,150 @@ function runMaintainerAuditAll() {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
174
|
+
* Prompt for a conventional commit message with fg-devkit's legacy question flow,
|
|
175
|
+
* then run `git commit` directly.
|
|
176
176
|
*/
|
|
177
|
-
function
|
|
178
|
-
let
|
|
179
|
-
let
|
|
180
|
-
const adapterPath = path.join(scriptDir, 'cz', 'cz-adapter.cjs')
|
|
177
|
+
async function runCzg(args = [], extraEnv = {}) {
|
|
178
|
+
let selectPrompt
|
|
179
|
+
let inputPrompt
|
|
181
180
|
try {
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
const inquirerSelect = await import('@inquirer/select')
|
|
182
|
+
const inquirerInput = await import('@inquirer/input')
|
|
183
|
+
selectPrompt = inquirerSelect.default
|
|
184
|
+
inputPrompt = inquirerInput.default
|
|
184
185
|
} catch {
|
|
185
|
-
console.error('[fg-devkit] Could not resolve
|
|
186
|
+
console.error('[fg-devkit] Could not resolve @inquirer/select or @inquirer/input. Reinstall fg-devkit and retry.')
|
|
186
187
|
return 1
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
)
|
|
199
|
-
|
|
190
|
+
const types = [
|
|
191
|
+
{ value: 'feat', name: 'feat(scope): Added' },
|
|
192
|
+
{ value: 'fix', name: 'fix(scope): Fixed' },
|
|
193
|
+
{ value: 'perf', name: 'perf(scope): Performance' },
|
|
194
|
+
{ value: 'refactor', name: 'refactor(scope): Changed' },
|
|
195
|
+
{ value: 'chore', name: 'chore(scope): Changed' },
|
|
196
|
+
{ value: 'docs', name: 'docs(scope): Documentation' },
|
|
197
|
+
{ value: 'dep', name: 'dep(scope): Dependencies (single package or batch)' },
|
|
198
|
+
{ value: 'vuln', name: 'vuln(scope): Security dependency update (single package or batch)' },
|
|
199
|
+
{ value: 'fix(security)', name: 'fix(security): Security' },
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
const defaultType = process.env.FG_DEVKIT_CZ_DEFAULT_TYPE
|
|
203
|
+
const defaultPackages = process.env.FG_DEVKIT_CZ_DEFAULT_PACKAGES
|
|
204
|
+
const defaultDepVersion = process.env.FG_DEVKIT_CZ_DEFAULT_DEP_VERSION
|
|
205
|
+
const defaultDepChangeKind = process.env.FG_DEVKIT_CZ_DEFAULT_DEP_CHANGE_KIND
|
|
206
|
+
|
|
207
|
+
const ask = async (message, cfg = {}) => {
|
|
208
|
+
const value = await inputPrompt({
|
|
209
|
+
message,
|
|
210
|
+
default: cfg.defaultValue,
|
|
211
|
+
validate: cfg.validate,
|
|
212
|
+
})
|
|
213
|
+
return value.trim()
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const selectedType = await selectPrompt({
|
|
217
|
+
message: 'Select the type of change you are committing',
|
|
218
|
+
choices: types,
|
|
219
|
+
default: defaultType && types.some((t) => t.value === defaultType) ? defaultType : undefined,
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
let scope = ''
|
|
223
|
+
let packages = ''
|
|
224
|
+
let depChangeKind = ''
|
|
225
|
+
let depVersion = ''
|
|
226
|
+
let vulnChangeKind = ''
|
|
227
|
+
let vulnTargetVersion = ''
|
|
228
|
+
let shortcutId = ''
|
|
229
|
+
let subject = ''
|
|
230
|
+
const isDepOrVuln = selectedType === 'dep' || selectedType === 'vuln'
|
|
231
|
+
|
|
232
|
+
if (isDepOrVuln) {
|
|
233
|
+
packages = await ask('Packages:', { defaultValue: selectedType === 'dep' ? defaultPackages : undefined })
|
|
234
|
+
if (!packages && selectedType === 'dep' && defaultPackages) {
|
|
235
|
+
packages = defaultPackages
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
scope = await ask('Scope:')
|
|
239
|
+
}
|
|
200
240
|
|
|
201
|
-
|
|
241
|
+
if (selectedType === 'vuln') {
|
|
242
|
+
vulnChangeKind = await selectPrompt({
|
|
243
|
+
message: 'Vulnerability change type:',
|
|
244
|
+
choices: [
|
|
245
|
+
{ value: 'override', name: 'override' },
|
|
246
|
+
{ value: 'bump', name: 'bump' },
|
|
247
|
+
],
|
|
248
|
+
default: 'override',
|
|
249
|
+
})
|
|
250
|
+
while (!vulnTargetVersion) {
|
|
251
|
+
vulnTargetVersion = await ask('Target version/range (e.g. 5.2.2 or >=5.2.2):', {
|
|
252
|
+
validate: (value) => (value?.trim() ? true : 'Provide a target version/range'),
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (selectedType === 'dep') {
|
|
258
|
+
depChangeKind = await selectPrompt({
|
|
259
|
+
message: 'Dependency change type:',
|
|
260
|
+
choices: [
|
|
261
|
+
{ value: 'new', name: 'new package' },
|
|
262
|
+
{ value: 'update', name: 'updated package' },
|
|
263
|
+
{ value: 'remove', name: 'removed package' },
|
|
264
|
+
],
|
|
265
|
+
default:
|
|
266
|
+
defaultDepChangeKind && ['new', 'update', 'remove'].includes(defaultDepChangeKind)
|
|
267
|
+
? defaultDepChangeKind
|
|
268
|
+
: 'update',
|
|
269
|
+
})
|
|
270
|
+
depVersion = await ask('Version (x.y.z):', {
|
|
271
|
+
defaultValue: defaultDepVersion,
|
|
272
|
+
validate: (value) => (/^\d+\.\d+\.\d+$/.test(value?.trim() ?? '') ? true : 'Use format x.y.z'),
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
let runLefthookAuditThisCommit = true
|
|
277
|
+
if (isDepOrVuln) {
|
|
278
|
+
runLefthookAuditThisCommit = await selectPrompt({
|
|
279
|
+
message: 'Run pnpm audit on commit (Lefthook pre-commit)?',
|
|
280
|
+
choices: [
|
|
281
|
+
{ value: true, name: 'Yes' },
|
|
282
|
+
{ value: false, name: 'No' },
|
|
283
|
+
],
|
|
284
|
+
default: true,
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (!isDepOrVuln) {
|
|
289
|
+
shortcutId = await ask('Shortcut ID digits only (optional, e.g. 1234):')
|
|
290
|
+
subject = await ask('Commit subject (imperative, no trailing period):', {
|
|
291
|
+
validate: (value) => (value?.trim() ? true : 'Commit subject is required'),
|
|
292
|
+
})
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const body = await ask("Optional body (use '|' for newline):")
|
|
296
|
+
|
|
297
|
+
const scopeValue = isDepOrVuln ? packages : scope
|
|
298
|
+
const needsEmptyParens = isDepOrVuln && !scopeValue
|
|
299
|
+
const scopePart = scopeValue ? `(${scopeValue})` : needsEmptyParens ? '()' : ''
|
|
300
|
+
const shortcutPart = shortcutId ? ` [sc-${shortcutId}]` : ''
|
|
301
|
+
const bodyPart = body ? `\n\n${body.split('|').join('\n')}` : ''
|
|
302
|
+
const depSubject =
|
|
303
|
+
depChangeKind === 'new' ? `add ${depVersion}` : depChangeKind === 'remove' ? `yeet ${depVersion}` : `bump to ${depVersion}`
|
|
304
|
+
const vulnSubject = vulnChangeKind === 'override' ? `override ${vulnTargetVersion}` : `bump to ${vulnTargetVersion}`
|
|
305
|
+
const finalSubject = selectedType === 'dep' ? depSubject : selectedType === 'vuln' ? vulnSubject : subject
|
|
306
|
+
const commitMessage = `${selectedType}${scopePart}: ${finalSubject}${shortcutPart}${bodyPart}`
|
|
307
|
+
|
|
308
|
+
const gitEnv = { ...process.env, ...extraEnv }
|
|
309
|
+
delete gitEnv.FG_DEVKIT_LEFTHOOK_AUDIT
|
|
310
|
+
if (isDepOrVuln) {
|
|
311
|
+
gitEnv.FG_DEVKIT_LEFTHOOK_AUDIT = runLefthookAuditThisCommit ? '1' : '0'
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const r = spawnSync('git', ['commit', ...args, '-m', commitMessage], {
|
|
202
315
|
stdio: 'inherit',
|
|
203
316
|
cwd: process.cwd(),
|
|
204
|
-
env:
|
|
205
|
-
...process.env,
|
|
206
|
-
FG_DEVKIT_CZ_ARGS: JSON.stringify(args),
|
|
207
|
-
...extraEnv,
|
|
208
|
-
},
|
|
317
|
+
env: gitEnv,
|
|
209
318
|
})
|
|
210
319
|
if (r.error) {
|
|
211
320
|
console.error('[fg-devkit]', r.error.message)
|
|
@@ -404,7 +513,7 @@ Commands:
|
|
|
404
513
|
full-consumer-setup Run: step 7 -> scripts -> lefthook -> step 3 -> step 2 -> pnpm install
|
|
405
514
|
create-release [bump] Version bump, git push, GitHub release (patch|minor|major; omit = prompt)
|
|
406
515
|
(alias: createRelease)
|
|
407
|
-
commit [args...]
|
|
516
|
+
commit [args...] czg/cz-git with fg-devkit bundled config
|
|
408
517
|
commit-vuln Commit staged dependency bumps as vuln() (alias: vuln-commit)
|
|
409
518
|
lint [eslint-args...] Run ESLint using fg-devkit bundled ESLint stack
|
|
410
519
|
lint-fix [eslint-args...] Run ESLint with --fix using fg-devkit bundled ESLint stack
|
|
@@ -540,7 +649,7 @@ async function runInteractiveMenu() {
|
|
|
540
649
|
loop: false,
|
|
541
650
|
})
|
|
542
651
|
if (choice === 'cancel') continue
|
|
543
|
-
return runSelectedAction(() => (choice === 'commit' ?
|
|
652
|
+
return runSelectedAction(() => (choice === 'commit' ? runCzg() : runNode('vuln-commit.mjs')))
|
|
544
653
|
}
|
|
545
654
|
|
|
546
655
|
if (group === 'release') {
|
|
@@ -718,7 +827,7 @@ async function main() {
|
|
|
718
827
|
return
|
|
719
828
|
}
|
|
720
829
|
if (sub === 'commit') {
|
|
721
|
-
process.exitCode =
|
|
830
|
+
process.exitCode = await runCzg(rest)
|
|
722
831
|
return
|
|
723
832
|
}
|
|
724
833
|
if (sub === 'commit-vuln' || sub === 'vuln-commit' || sub === 'commit:vuln') {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Lefthook pre-commit helper: runs `pnpm audit` unless this commit was started with
|
|
4
|
+
* `FG_DEVKIT_LEFTHOOK_AUDIT=0` (set only for the current `git commit` by `fg-devkit commit`
|
|
5
|
+
* when the user chooses "No" on dep/vuln). Unset or `1` runs audit.
|
|
6
|
+
*/
|
|
7
|
+
import { spawnSync } from 'node:child_process'
|
|
8
|
+
|
|
9
|
+
function shouldRunAudit() {
|
|
10
|
+
const v = process.env.FG_DEVKIT_LEFTHOOK_AUDIT
|
|
11
|
+
return v !== '0' && v !== 'false'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!shouldRunAudit()) {
|
|
15
|
+
console.log('[fg-devkit] Skipping pnpm audit (FG_DEVKIT_LEFTHOOK_AUDIT=0 for this commit).')
|
|
16
|
+
process.exit(0)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const r = spawnSync('pnpm', ['audit'], {
|
|
20
|
+
stdio: 'inherit',
|
|
21
|
+
cwd: process.cwd(),
|
|
22
|
+
})
|
|
23
|
+
process.exit(r.status ?? 1)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Removes tooling dependencies from a consuming repo that are now bundled by fg-devkit.
|
|
4
4
|
*
|
|
5
5
|
* By default this script edits package.json in the current working directory and removes
|
|
6
|
-
* known ESLint/Prettier/TypeScript/
|
|
6
|
+
* known ESLint/Prettier/TypeScript/cz-git tooling packages from dependencies/devDependencies.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
9
|
* node node_modules/fg-devkit/scripts/prune-consumer-deps.mjs
|
|
@@ -24,6 +24,8 @@ const BUNDLED_TOOLING_PACKAGES = new Set([
|
|
|
24
24
|
'@vue/tsconfig',
|
|
25
25
|
'@rushstack/eslint-patch',
|
|
26
26
|
'commitizen',
|
|
27
|
+
'cz-git',
|
|
28
|
+
'czg',
|
|
27
29
|
'eslint',
|
|
28
30
|
'eslint-plugin-prettier',
|
|
29
31
|
'eslint-plugin-vue',
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* - removes legacy lint-staged config block from package.json
|
|
7
7
|
* - removes legacy prepare hook scripts for husky/lefthook bootstrap
|
|
8
8
|
*
|
|
9
|
+
* Lefthook `audit` skips only when `FG_DEVKIT_LEFTHOOK_AUDIT=0` for that commit (dep/vuln flow).
|
|
10
|
+
*
|
|
9
11
|
* Usage:
|
|
10
12
|
* node node_modules/fg-devkit/scripts/sync-consumer-lefthook.mjs
|
|
11
13
|
* pnpm exec fg-devkit setup-lefthook
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Custom Commitizen adapter: interactive prompts for type, scope, dep/vuln flows, and message body.
|
|
3
|
-
* Builds the final conventional commit string and passes it to commit().
|
|
4
|
-
*/
|
|
5
|
-
module.exports = {
|
|
6
|
-
prompter(cz, commit) {
|
|
7
|
-
const defaultType = process.env.FG_DEVKIT_CZ_DEFAULT_TYPE;
|
|
8
|
-
const defaultPackages = process.env.FG_DEVKIT_CZ_DEFAULT_PACKAGES;
|
|
9
|
-
const defaultDepVersion = process.env.FG_DEVKIT_CZ_DEFAULT_DEP_VERSION;
|
|
10
|
-
const defaultDepChangeKind = process.env.FG_DEVKIT_CZ_DEFAULT_DEP_CHANGE_KIND;
|
|
11
|
-
const types = [
|
|
12
|
-
{ value: "feat", name: "feat(scope): Added" },
|
|
13
|
-
{ value: "fix", name: "fix(scope): Fixed" },
|
|
14
|
-
{ value: "perf", name: "perf(scope): Performance" },
|
|
15
|
-
{ value: "refactor", name: "refactor(scope): Changed" },
|
|
16
|
-
{ value: "chore", name: "chore(scope): Changed" },
|
|
17
|
-
{ value: "docs", name: "docs(scope): Documentation" },
|
|
18
|
-
{ value: "dep", name: "dep(scope): Dependencies (single package or batch)" },
|
|
19
|
-
{ value: "vuln", name: "vuln(scope): Security dependency update (single package or batch)" },
|
|
20
|
-
{ value: "fix(security)", name: "fix(security): Security" },
|
|
21
|
-
];
|
|
22
|
-
|
|
23
|
-
const questions = [
|
|
24
|
-
{
|
|
25
|
-
type: "list",
|
|
26
|
-
name: "change_type",
|
|
27
|
-
message: "Select the type of change you are committing",
|
|
28
|
-
choices: types,
|
|
29
|
-
default: defaultType && types.some((t) => t.value === defaultType) ? defaultType : undefined,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: "input",
|
|
33
|
-
name: "scope",
|
|
34
|
-
when: (answers) => !["dep", "vuln"].includes(answers.change_type),
|
|
35
|
-
message: "Scope:",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
type: "input",
|
|
39
|
-
name: "packages",
|
|
40
|
-
when: (answers) => ["dep", "vuln"].includes(answers.change_type),
|
|
41
|
-
message: "Packages:",
|
|
42
|
-
default: defaultType === "dep" && defaultPackages ? defaultPackages : undefined,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: "list",
|
|
46
|
-
name: "vuln_change_kind",
|
|
47
|
-
when: (answers) => answers.change_type === "vuln",
|
|
48
|
-
message: "Vulnerability change type:",
|
|
49
|
-
choices: [
|
|
50
|
-
{ value: "override", name: "override" },
|
|
51
|
-
{ value: "bump", name: "bump" },
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: "input",
|
|
56
|
-
name: "vuln_target_version",
|
|
57
|
-
when: (answers) => answers.change_type === "vuln",
|
|
58
|
-
message: "Target version/range (e.g. 5.2.2 or >=5.2.2):",
|
|
59
|
-
validate: (value) => (value && value.trim() ? true : "Provide a target version/range"),
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: "list",
|
|
63
|
-
name: "dep_change_kind",
|
|
64
|
-
when: (answers) => answers.change_type === "dep",
|
|
65
|
-
message: "Dependency change type:",
|
|
66
|
-
choices: [
|
|
67
|
-
{ value: "new", name: "new package" },
|
|
68
|
-
{ value: "update", name: "updated package" },
|
|
69
|
-
{ value: "remove", name: "removed package" },
|
|
70
|
-
],
|
|
71
|
-
default:
|
|
72
|
-
defaultType === "dep" && ["new", "update", "remove"].includes(defaultDepChangeKind)
|
|
73
|
-
? defaultDepChangeKind
|
|
74
|
-
: "update",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
type: "input",
|
|
78
|
-
name: "dep_version",
|
|
79
|
-
when: (answers) => answers.change_type === "dep",
|
|
80
|
-
message: "Version (x.y.z):",
|
|
81
|
-
default: defaultType === "dep" && defaultDepVersion ? defaultDepVersion : undefined,
|
|
82
|
-
validate: (value) => (/^\d+\.\d+\.\d+$/.test(value) ? true : "Use format x.y.z"),
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: "input",
|
|
86
|
-
name: "shortcut_id",
|
|
87
|
-
when: (answers) => !["dep", "vuln"].includes(answers.change_type),
|
|
88
|
-
message: "Shortcut ID digits only (optional, e.g. 1234):",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
type: "input",
|
|
92
|
-
name: "message",
|
|
93
|
-
when: (answers) => !["dep", "vuln"].includes(answers.change_type),
|
|
94
|
-
message: "Commit subject (imperative, no trailing period):",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
type: "input",
|
|
98
|
-
name: "body",
|
|
99
|
-
message: "Optional body (use '|' for newline):",
|
|
100
|
-
},
|
|
101
|
-
];
|
|
102
|
-
|
|
103
|
-
cz.prompt(questions).then((answers) => {
|
|
104
|
-
const type = answers.change_type;
|
|
105
|
-
const scopeValue = ["dep", "vuln"].includes(type) ? answers.packages : answers.scope;
|
|
106
|
-
const needsEmptyParens = ["dep", "vuln"].includes(type) && !scopeValue;
|
|
107
|
-
const scopePart = scopeValue ? `(${scopeValue})` : needsEmptyParens ? "()" : "";
|
|
108
|
-
const shortcutPart = answers.shortcut_id ? ` [sc-${answers.shortcut_id}]` : "";
|
|
109
|
-
const bodyPart = answers.body ? `\n\n${answers.body.split("|").join("\n")}` : "";
|
|
110
|
-
const depSubject =
|
|
111
|
-
answers.dep_change_kind === "new"
|
|
112
|
-
? `add ${answers.dep_version}`
|
|
113
|
-
: answers.dep_change_kind === "remove"
|
|
114
|
-
? `yeet ${answers.dep_version}`
|
|
115
|
-
: `bump to ${answers.dep_version}`;
|
|
116
|
-
const vulnSubject =
|
|
117
|
-
type === "vuln"
|
|
118
|
-
? answers.vuln_change_kind === "override"
|
|
119
|
-
? `override ${answers.vuln_target_version}`
|
|
120
|
-
: `bump to ${answers.vuln_target_version}`
|
|
121
|
-
: "";
|
|
122
|
-
const subject = type === "dep" ? depSubject : type === "vuln" ? vulnSubject : answers.message;
|
|
123
|
-
const commitMessage = `${type}${scopePart}: ${subject}${shortcutPart}${bodyPart}`;
|
|
124
|
-
commit(commitMessage);
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
};
|