fg-devkit 1.8.1 → 1.8.3
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/lefthook.yml
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fg-devkit",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "Shared configs, scripts, and DX tooling for Vue / TypeScript frontend repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"./scripts/poeditor-upload.mjs": "./scripts/poeditor-upload.mjs",
|
|
46
46
|
"./scripts/scaffold-vue.mjs": "./scripts/scaffold-vue.mjs",
|
|
47
47
|
"./scripts/fg-devkit.mjs": "./scripts/fg-devkit.mjs",
|
|
48
|
-
"./scripts/lefthook-audit-if-enabled.mjs": "./scripts/lefthook-audit-if-enabled.mjs",
|
|
49
48
|
"./scripts/release.sh": "./scripts/release.sh",
|
|
50
49
|
"./scripts/cz/.cz-config.cjs": "./scripts/cz/.cz-config.cjs",
|
|
51
50
|
"./cursor-rules/core-coding-standards.mdc": "./.cursor/rules/core-coding-standards.mdc"
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* cz-git config used by fg-devkit commit flows.
|
|
3
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).
|
|
7
4
|
*/
|
|
8
5
|
module.exports = {
|
|
9
6
|
types: [
|
package/scripts/fg-devkit.mjs
CHANGED
|
@@ -273,18 +273,6 @@ async function runCzg(args = [], extraEnv = {}) {
|
|
|
273
273
|
})
|
|
274
274
|
}
|
|
275
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
276
|
if (!isDepOrVuln) {
|
|
289
277
|
shortcutId = await ask('Shortcut ID digits only (optional, e.g. 1234):')
|
|
290
278
|
subject = await ask('Commit subject (imperative, no trailing period):', {
|
|
@@ -305,16 +293,10 @@ async function runCzg(args = [], extraEnv = {}) {
|
|
|
305
293
|
const finalSubject = selectedType === 'dep' ? depSubject : selectedType === 'vuln' ? vulnSubject : subject
|
|
306
294
|
const commitMessage = `${selectedType}${scopePart}: ${finalSubject}${shortcutPart}${bodyPart}`
|
|
307
295
|
|
|
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
296
|
const r = spawnSync('git', ['commit', ...args, '-m', commitMessage], {
|
|
315
297
|
stdio: 'inherit',
|
|
316
298
|
cwd: process.cwd(),
|
|
317
|
-
env:
|
|
299
|
+
env: { ...process.env, ...extraEnv },
|
|
318
300
|
})
|
|
319
301
|
if (r.error) {
|
|
320
302
|
console.error('[fg-devkit]', r.error.message)
|
|
@@ -6,8 +6,6 @@
|
|
|
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
|
-
*
|
|
11
9
|
* Usage:
|
|
12
10
|
* node node_modules/fg-devkit/scripts/sync-consumer-lefthook.mjs
|
|
13
11
|
* pnpm exec fg-devkit setup-lefthook
|
|
@@ -1,23 +0,0 @@
|
|
|
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)
|