fg-devkit 1.1.0 → 1.1.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"extends": "
|
|
3
|
+
"extends": "./tsconfig.vue-dom.json",
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"target": "ES2022",
|
|
6
6
|
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
@@ -16,10 +16,7 @@
|
|
|
16
16
|
"allowSyntheticDefaultImports": true,
|
|
17
17
|
"noUnusedLocals": true,
|
|
18
18
|
"noUnusedParameters": true,
|
|
19
|
-
"preserveSymlinks": false
|
|
20
|
-
"paths": {
|
|
21
|
-
"@/*": ["./src/*"]
|
|
22
|
-
}
|
|
19
|
+
"preserveSymlinks": false
|
|
23
20
|
},
|
|
24
21
|
"vueCompilerOptions": {
|
|
25
22
|
"strictTemplates": true,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noEmit": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
9
|
+
"moduleDetection": "force",
|
|
10
|
+
"jsx": "preserve",
|
|
11
|
+
"jsxImportSource": "vue",
|
|
12
|
+
"noImplicitThis": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"target": "ESNext",
|
|
16
|
+
"useDefineForClassFields": true,
|
|
17
|
+
"esModuleInterop": true,
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"libReplacement": false,
|
|
20
|
+
"skipLibCheck": true
|
|
21
|
+
}
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fg-devkit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Shared configs, scripts, and DX tooling for Vue / TypeScript frontend repos",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -48,12 +48,18 @@
|
|
|
48
48
|
"typescript",
|
|
49
49
|
"vue"
|
|
50
50
|
],
|
|
51
|
+
"config": {
|
|
52
|
+
"commitizen": {
|
|
53
|
+
"path": "./scripts/cz/cz-adapter.cjs"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
51
56
|
"dependencies": {
|
|
52
57
|
"@intlify/eslint-plugin-vue-i18n": "4.3.0",
|
|
53
58
|
"@typescript-eslint/eslint-plugin": "8.58.2",
|
|
54
59
|
"@typescript-eslint/parser": "8.58.2",
|
|
55
60
|
"@vitest/eslint-plugin": "1.6.16",
|
|
56
61
|
"@vue/eslint-config-prettier": "10.2.0",
|
|
62
|
+
"@vue/tsconfig": "0.9.1",
|
|
57
63
|
"commitizen": "4.3.1",
|
|
58
64
|
"eslint": "10.2.1",
|
|
59
65
|
"eslint-plugin-prettier": "5.5.5",
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
module.exports = {
|
|
6
6
|
prompter(cz, commit) {
|
|
7
|
+
const defaultType = process.env.FG_DEVKIT_CZ_DEFAULT_TYPE;
|
|
7
8
|
const types = [
|
|
8
9
|
{ value: "feat", name: "feat(scope): Added" },
|
|
9
10
|
{ value: "fix", name: "fix(scope): Fixed" },
|
|
@@ -22,6 +23,7 @@ module.exports = {
|
|
|
22
23
|
name: "change_type",
|
|
23
24
|
message: "Select the type of change you are committing",
|
|
24
25
|
choices: types,
|
|
26
|
+
default: defaultType && types.some((t) => t.value === defaultType) ? defaultType : undefined,
|
|
25
27
|
},
|
|
26
28
|
{
|
|
27
29
|
type: "input",
|
package/scripts/fg-devkit.mjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* pnpm exec fg-devkit sync-tooling-configs (tooling sync only; overwrites config files)
|
|
10
10
|
* pnpm exec fg-devkit sync-vscode-settings
|
|
11
11
|
* pnpm exec fg-devkit create-release [patch|minor|major]
|
|
12
|
-
* pnpm exec fg-devkit commit [cz-args...] (Commitizen; uses
|
|
12
|
+
* pnpm exec fg-devkit commit [cz-args...] (Commitizen; uses fg-devkit bundled cz adapter)
|
|
13
13
|
* pnpm exec fg-devkit commit-vuln (staged package.json version bumps → vuln() commit)
|
|
14
14
|
* pnpm exec fg-devkit lint [eslint-args...] (run ESLint with fg-devkit bundled packages)
|
|
15
15
|
* pnpm exec fg-devkit lint-fix [eslint-args...] (same as lint plus --fix)
|
|
@@ -102,21 +102,40 @@ async function promptReleaseType(rl) {
|
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Run Commitizen from fg-devkit's bundled dependency set.
|
|
105
|
-
*
|
|
105
|
+
* Always forces fg-devkit's bundled cz adapter so it stays interactive.
|
|
106
106
|
*/
|
|
107
|
-
function runCommitizen(args = []) {
|
|
108
|
-
let
|
|
107
|
+
function runCommitizen(args = [], extraEnv = {}) {
|
|
108
|
+
let bootstrapBin
|
|
109
|
+
let commitizenPkgDir
|
|
110
|
+
const adapterPath = path.join(scriptDir, 'cz', 'cz-adapter.cjs')
|
|
109
111
|
try {
|
|
110
|
-
|
|
112
|
+
bootstrapBin = require.resolve('commitizen/dist/cli/git-cz.js')
|
|
113
|
+
commitizenPkgDir = path.dirname(require.resolve('commitizen/package.json'))
|
|
111
114
|
} catch {
|
|
112
115
|
console.error('[fg-devkit] Could not resolve bundled commitizen. Reinstall fg-devkit and retry.')
|
|
113
116
|
return 1
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
const
|
|
119
|
+
const launcher = `
|
|
120
|
+
const { bootstrap } = require(${JSON.stringify(bootstrapBin)});
|
|
121
|
+
const argv = ['node', 'git-cz', ...JSON.parse(process.env.FG_DEVKIT_CZ_ARGS || '[]')];
|
|
122
|
+
bootstrap(
|
|
123
|
+
{
|
|
124
|
+
cliPath: ${JSON.stringify(commitizenPkgDir)},
|
|
125
|
+
config: { path: ${JSON.stringify(adapterPath)} },
|
|
126
|
+
},
|
|
127
|
+
argv
|
|
128
|
+
);
|
|
129
|
+
`
|
|
130
|
+
|
|
131
|
+
const r = spawnSync(process.execPath, ['-e', launcher], {
|
|
117
132
|
stdio: 'inherit',
|
|
118
133
|
cwd: process.cwd(),
|
|
119
|
-
env:
|
|
134
|
+
env: {
|
|
135
|
+
...process.env,
|
|
136
|
+
FG_DEVKIT_CZ_ARGS: JSON.stringify(args),
|
|
137
|
+
...extraEnv,
|
|
138
|
+
},
|
|
120
139
|
})
|
|
121
140
|
if (r.error) {
|
|
122
141
|
console.error('[fg-devkit]', r.error.message)
|
|
@@ -214,7 +233,7 @@ Commands:
|
|
|
214
233
|
sync-vscode-settings Copy shared VS Code settings into .vscode/settings.json
|
|
215
234
|
create-release [bump] Version bump, git push, GitHub release (patch|minor|major; omit = prompt)
|
|
216
235
|
(alias: createRelease)
|
|
217
|
-
commit [args...] Commitizen (git-cz)
|
|
236
|
+
commit [args...] Commitizen (git-cz) with fg-devkit bundled adapter
|
|
218
237
|
commit-vuln Commit staged dependency bumps as vuln() (alias: vuln-commit)
|
|
219
238
|
lint [eslint-args...] Run ESLint using fg-devkit bundled ESLint stack
|
|
220
239
|
lint-fix [eslint-args...] Run ESLint with --fix using fg-devkit bundled ESLint stack
|
|
@@ -259,7 +278,7 @@ const MENU = [
|
|
|
259
278
|
{
|
|
260
279
|
key: '6',
|
|
261
280
|
label: 'Commit vulnerability (Commitizen)',
|
|
262
|
-
run: () =>
|
|
281
|
+
run: () => runCommitizen([], { FG_DEVKIT_CZ_DEFAULT_TYPE: 'vuln' }),
|
|
263
282
|
},
|
|
264
283
|
]
|
|
265
284
|
|
|
@@ -287,27 +306,29 @@ async function runInteractiveMenu() {
|
|
|
287
306
|
return 1
|
|
288
307
|
}
|
|
289
308
|
|
|
290
|
-
let
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
if (
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return 0
|
|
297
|
-
}
|
|
298
|
-
out = runReleaseScript([bumpType])
|
|
299
|
-
} else {
|
|
300
|
-
out = item.run()
|
|
309
|
+
let out
|
|
310
|
+
if (item.key === '4') {
|
|
311
|
+
const bumpType = await promptReleaseType(rl)
|
|
312
|
+
if (!bumpType) {
|
|
313
|
+
rl.close()
|
|
314
|
+
return 0
|
|
301
315
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
} finally {
|
|
316
|
+
// Close menu readline before spawning interactive child processes.
|
|
317
|
+
rl.close()
|
|
318
|
+
out = runReleaseScript([bumpType])
|
|
319
|
+
} else {
|
|
320
|
+
// Close menu readline before spawning interactive child processes.
|
|
308
321
|
rl.close()
|
|
322
|
+
out = item.run()
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
if (typeof out === 'object' && out !== null && typeof out.then === 'function') {
|
|
326
|
+
return await out
|
|
327
|
+
}
|
|
328
|
+
if (typeof out === 'number') {
|
|
329
|
+
return out
|
|
309
330
|
}
|
|
310
|
-
return
|
|
331
|
+
return 0
|
|
311
332
|
}
|
|
312
333
|
|
|
313
334
|
async function main() {
|