@dhzh/eslint-config 1.26.0 → 1.27.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/dist/chunk-CKQMccvm.cjs +28 -0
- package/dist/cli/index.cjs +139 -279
- package/dist/cli/index.d.cts +1 -2
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +269 -0
- package/dist/index.cjs +1398 -1800
- package/dist/index.d.cts +8617 -9986
- package/dist/{index.d.ts → index.d.mts} +8617 -9986
- package/dist/index.mjs +1417 -0
- package/package.json +3 -3
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +0 -391
- package/dist/index.js +0 -1812
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
Object.defineProperty(exports, "__toESM", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return __toESM;
|
|
27
|
+
}
|
|
28
|
+
});
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1,190 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
name: "@dhzh/eslint-config",
|
|
34
|
-
type: "module",
|
|
35
|
-
version,
|
|
36
|
-
packageManager: "pnpm@10.33.2",
|
|
37
|
-
description: "tinywaves's ESLint config",
|
|
38
|
-
author: {
|
|
39
|
-
name: "Lyle Zheng",
|
|
40
|
-
email: "dhzhme@gmail.com"
|
|
41
|
-
},
|
|
42
|
-
license: "MIT",
|
|
43
|
-
homepage: "https://github.com/tinywaves/eslint-config",
|
|
44
|
-
repository: {
|
|
45
|
-
type: "git",
|
|
46
|
-
url: "git+https://github.com/tinywaves/eslint-config"
|
|
47
|
-
},
|
|
48
|
-
bugs: {
|
|
49
|
-
url: "https://github.com/tinywaves/eslint-config/issues"
|
|
50
|
-
},
|
|
51
|
-
keywords: [
|
|
52
|
-
"eslint",
|
|
53
|
-
"eslint-config"
|
|
54
|
-
],
|
|
55
|
-
sideEffects: false,
|
|
56
|
-
exports: {
|
|
57
|
-
".": {
|
|
58
|
-
import: "./dist/index.js",
|
|
59
|
-
require: "./dist/index.cjs"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
main: "./dist/index.js",
|
|
63
|
-
types: "./dist/index.d.ts",
|
|
64
|
-
bin: "./bin/index.js",
|
|
65
|
-
files: [
|
|
66
|
-
"bin",
|
|
67
|
-
"dist"
|
|
68
|
-
],
|
|
69
|
-
engines: {
|
|
70
|
-
node: "^22.13.0 || >=24"
|
|
71
|
-
},
|
|
72
|
-
scripts: {
|
|
73
|
-
build: "pnpm run typegen && tsup --clean --dts",
|
|
74
|
-
"build:inspector": "pnpm run build && npx @eslint/config-inspector build",
|
|
75
|
-
dev: "pnpm run typegen && npx @eslint/config-inspector --config eslint.config.ts",
|
|
76
|
-
lint: "eslint",
|
|
77
|
-
"lint-fix": "eslint --fix .",
|
|
78
|
-
prepack: "pnpm run build",
|
|
79
|
-
prepare: "simple-git-hooks",
|
|
80
|
-
release: "bumpp",
|
|
81
|
-
typecheck: "tsc --noEmit",
|
|
82
|
-
typegen: "tsx scripts/eslint-typegen.ts"
|
|
83
|
-
},
|
|
84
|
-
peerDependencies: {
|
|
85
|
-
"@prettier/plugin-xml": "^3.4.2",
|
|
86
|
-
eslint: "^10.2.1"
|
|
87
|
-
},
|
|
88
|
-
peerDependenciesMeta: {
|
|
89
|
-
"@prettier/plugin-xml": {
|
|
90
|
-
optional: true
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
dependencies: {
|
|
94
|
-
"@clack/prompts": "^1.2.0",
|
|
95
|
-
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
|
|
96
|
-
"@eslint-react/eslint-plugin": "^4.2.3",
|
|
97
|
-
"@eslint/js": "^10.0.1",
|
|
98
|
-
"@stylistic/eslint-plugin": "^5.10.0",
|
|
99
|
-
"@unocss/eslint-config": "66.6.8",
|
|
100
|
-
ansis: "^4.2.0",
|
|
101
|
-
cac: "^7.0.0",
|
|
102
|
-
"eslint-merge-processors": "^2.0.0",
|
|
103
|
-
"eslint-plugin-antfu": "^3.2.2",
|
|
104
|
-
"eslint-plugin-format": "^2.0.1",
|
|
105
|
-
"eslint-plugin-import-x": "^4.16.2",
|
|
106
|
-
"eslint-plugin-jsonc": "^3.1.2",
|
|
107
|
-
"eslint-plugin-n": "^17.24.0",
|
|
108
|
-
"eslint-plugin-package-json": "^0.91.1",
|
|
109
|
-
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
110
|
-
"eslint-plugin-react-google-translate": "^1.0.4",
|
|
111
|
-
"eslint-plugin-react-hooks": "^7.1.1",
|
|
112
|
-
"eslint-plugin-react-refresh": "^0.5.2",
|
|
113
|
-
"eslint-plugin-regexp": "^3.1.0",
|
|
114
|
-
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
115
|
-
"eslint-plugin-tailwindcss": "4.0.0-beta.0",
|
|
116
|
-
"eslint-plugin-toml": "^1.3.1",
|
|
117
|
-
"eslint-plugin-unicorn": "^64.0.0",
|
|
118
|
-
"eslint-plugin-unused-imports": "^4.4.1",
|
|
119
|
-
"eslint-plugin-vue": "^10.9.0",
|
|
120
|
-
"eslint-plugin-yml": "^3.3.1",
|
|
121
|
-
"eslint-processor-vue-blocks": "^2.0.0",
|
|
122
|
-
globals: "^17.5.0",
|
|
123
|
-
"local-pkg": "^1.1.2",
|
|
124
|
-
"toml-eslint-parser": "^1.0.3",
|
|
125
|
-
"typescript-eslint": "^8.59.0",
|
|
126
|
-
"vue-eslint-parser": "^10.4.0"
|
|
127
|
-
},
|
|
128
|
-
devDependencies: {
|
|
129
|
-
"@eslint/config-inspector": "^2.0.0",
|
|
130
|
-
"@prettier/plugin-xml": "^3.4.2",
|
|
131
|
-
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
|
132
|
-
"@types/node": "^24.12.2",
|
|
133
|
-
"@typescript-eslint/types": "^8.59.0",
|
|
134
|
-
bumpp: "^11.0.1",
|
|
135
|
-
"bundle-require": "^5.1.0",
|
|
136
|
-
eslint: "^10.2.1",
|
|
137
|
-
"eslint-typegen": "^2.3.1",
|
|
138
|
-
"lint-staged": "^16.4.0",
|
|
139
|
-
"simple-git-hooks": "^2.13.1",
|
|
140
|
-
tailwindcss: "^4.2.4",
|
|
141
|
-
tsup: "^8.5.1",
|
|
142
|
-
tsx: "^4.21.0",
|
|
143
|
-
typescript: "^6.0.3"
|
|
144
|
-
},
|
|
145
|
-
"simple-git-hooks": {
|
|
146
|
-
"pre-commit": "npx lint-staged"
|
|
147
|
-
},
|
|
148
|
-
"lint-staged": {
|
|
149
|
-
"*": "eslint --fix"
|
|
150
|
-
}
|
|
1
|
+
const require_chunk = require("../chunk-CKQMccvm.cjs");
|
|
2
|
+
let node_process = require("node:process");
|
|
3
|
+
node_process = require_chunk.__toESM(node_process, 1);
|
|
4
|
+
let _clack_prompts = require("@clack/prompts");
|
|
5
|
+
_clack_prompts = require_chunk.__toESM(_clack_prompts, 1);
|
|
6
|
+
let ansis = require("ansis");
|
|
7
|
+
ansis = require_chunk.__toESM(ansis, 1);
|
|
8
|
+
let cac = require("cac");
|
|
9
|
+
let node_fs_promises = require("node:fs/promises");
|
|
10
|
+
node_fs_promises = require_chunk.__toESM(node_fs_promises, 1);
|
|
11
|
+
let node_path = require("node:path");
|
|
12
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
13
|
+
let node_fs = require("node:fs");
|
|
14
|
+
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
15
|
+
//#region package.json
|
|
16
|
+
var version = "1.27.1";
|
|
17
|
+
var devDependencies = {
|
|
18
|
+
"@eslint/config-inspector": "^2.0.0",
|
|
19
|
+
"@prettier/plugin-xml": "^3.4.2",
|
|
20
|
+
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
|
21
|
+
"@types/node": "^24.12.2",
|
|
22
|
+
"@typescript-eslint/types": "^8.59.0",
|
|
23
|
+
"bumpp": "^11.0.1",
|
|
24
|
+
"bundle-require": "^5.1.0",
|
|
25
|
+
"eslint": "^10.2.1",
|
|
26
|
+
"eslint-typegen": "^2.3.1",
|
|
27
|
+
"lint-staged": "^16.4.0",
|
|
28
|
+
"simple-git-hooks": "^2.13.1",
|
|
29
|
+
"tailwindcss": "^4.2.4",
|
|
30
|
+
"tsdown": "^0.21.10",
|
|
31
|
+
"tsx": "^4.21.0",
|
|
32
|
+
"typescript": "^6.0.3"
|
|
151
33
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/cli/stages/update-package-json.ts
|
|
36
|
+
async function ensureScript(scripts, name, command) {
|
|
37
|
+
if (scripts[name] == null) {
|
|
38
|
+
scripts[name] = command;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (scripts[name] === command) return;
|
|
42
|
+
const shouldOverride = await _clack_prompts.confirm({
|
|
43
|
+
message: `Script "${name}" already exists as "${String(scripts[name])}". Replace it with "${command}"?`,
|
|
44
|
+
initialValue: true
|
|
45
|
+
});
|
|
46
|
+
if (_clack_prompts.isCancel(shouldOverride)) {
|
|
47
|
+
_clack_prompts.cancel("Operation cancelled");
|
|
48
|
+
throw new Error("Operation cancelled");
|
|
49
|
+
}
|
|
50
|
+
if (shouldOverride) scripts[name] = command;
|
|
51
|
+
}
|
|
163
52
|
async function updatePackageJson() {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
53
|
+
const cwd = node_process.default.cwd();
|
|
54
|
+
const pathPackageJSON = node_path.default.join(cwd, "package.json");
|
|
55
|
+
_clack_prompts.log.step(ansis.default.cyan`Bumping @dhzh/eslint-config to v${version}`);
|
|
56
|
+
const pkgContent = await node_fs_promises.default.readFile(pathPackageJSON, "utf8");
|
|
57
|
+
const pkg = JSON.parse(pkgContent);
|
|
58
|
+
pkg.devDependencies ??= {};
|
|
59
|
+
pkg.devDependencies["@dhzh/eslint-config"] = `^${version}`;
|
|
60
|
+
pkg.devDependencies.eslint ??= devDependencies.eslint;
|
|
61
|
+
pkg.scripts ??= {};
|
|
62
|
+
await ensureScript(pkg.scripts, "lint", "eslint");
|
|
63
|
+
await ensureScript(pkg.scripts, "lint-fix", "eslint --fix .");
|
|
64
|
+
await node_fs_promises.default.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
65
|
+
_clack_prompts.log.success(ansis.default.green`Changes wrote to package.json`);
|
|
177
66
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
|
182
|
-
var import_node_process2 = __toESM(require("process"), 1);
|
|
183
|
-
var import_ansis2 = __toESM(require("ansis"), 1);
|
|
184
|
-
var p2 = __toESM(require("@clack/prompts"), 1);
|
|
185
|
-
|
|
186
|
-
// src/cli/constants.ts
|
|
187
|
-
var vscodeSettingsString = `
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/cli/constants.ts
|
|
69
|
+
const vscodeSettingsString = `
|
|
188
70
|
// Entry
|
|
189
71
|
"eslint.format.enable": true,
|
|
190
72
|
"eslint.ignoreUntitled": true,
|
|
@@ -292,7 +174,7 @@ var vscodeSettingsString = `
|
|
|
292
174
|
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
293
175
|
}
|
|
294
176
|
`;
|
|
295
|
-
|
|
177
|
+
const eslintConfigContent = (options) => `import { defineConfig } from '@dhzh/eslint-config';
|
|
296
178
|
|
|
297
179
|
export default defineConfig(${options.hasNest ? `{
|
|
298
180
|
configs: {
|
|
@@ -302,114 +184,92 @@ export default defineConfig(${options.hasNest ? `{
|
|
|
302
184
|
},
|
|
303
185
|
}` : ""});
|
|
304
186
|
`;
|
|
305
|
-
|
|
187
|
+
const npmignoreString = `# If these files (ESLint flat config files) are not included in .npmignore,
|
|
306
188
|
# they will be published, and importing devDependencies in published files will trigger \`n/no-unpublished-import\` errors.
|
|
307
189
|
eslint.config.js
|
|
308
190
|
eslint.config.mjs
|
|
309
191
|
`;
|
|
310
|
-
|
|
311
|
-
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/cli/stages/update-eslint-config.ts
|
|
312
194
|
async function updateEslintConfig(options) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
p2.log.success(import_ansis2.default.green`Created ${configFileName}`);
|
|
195
|
+
const cwd = node_process.default.cwd();
|
|
196
|
+
const pathPackageJSON = node_path.default.join(cwd, "package.json");
|
|
197
|
+
const pkgContent = await node_fs_promises.default.readFile(pathPackageJSON, "utf8");
|
|
198
|
+
const configFileName = JSON.parse(pkgContent).type === "module" ? "eslint.config.js" : "eslint.config.mjs";
|
|
199
|
+
const pathFlatConfig = node_path.default.join(cwd, configFileName);
|
|
200
|
+
await node_fs_promises.default.writeFile(pathFlatConfig, eslintConfigContent(options));
|
|
201
|
+
_clack_prompts.log.success(ansis.default.green`Created ${configFileName}`);
|
|
321
202
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
var import_promises3 = __toESM(require("fs/promises"), 1);
|
|
325
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
326
|
-
var import_node_process3 = __toESM(require("process"), 1);
|
|
327
|
-
var import_ansis3 = __toESM(require("ansis"), 1);
|
|
328
|
-
var p3 = __toESM(require("@clack/prompts"), 1);
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/cli/stages/update-npmignore.ts
|
|
329
205
|
async function updateNpmignore() {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
p3.log.success(import_ansis3.default.green`${action} ${npmignoreFileName}`);
|
|
206
|
+
const cwd = node_process.default.cwd();
|
|
207
|
+
const npmignoreFileName = ".npmignore";
|
|
208
|
+
const npmignoreFilePath = node_path.default.join(cwd, npmignoreFileName);
|
|
209
|
+
let action = "Created";
|
|
210
|
+
try {
|
|
211
|
+
await node_fs_promises.default.access(npmignoreFilePath);
|
|
212
|
+
const trimmedContent = (await node_fs_promises.default.readFile(npmignoreFilePath, "utf8")).trimEnd();
|
|
213
|
+
await node_fs_promises.default.writeFile(npmignoreFilePath, `${trimmedContent}\n${npmignoreString}`);
|
|
214
|
+
action = "Updated";
|
|
215
|
+
} catch {
|
|
216
|
+
await node_fs_promises.default.writeFile(npmignoreFilePath, npmignoreString);
|
|
217
|
+
}
|
|
218
|
+
_clack_prompts.log.success(ansis.default.green`${action} ${npmignoreFileName}`);
|
|
345
219
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
349
|
-
var import_promises4 = __toESM(require("fs/promises"), 1);
|
|
350
|
-
var import_node_path4 = __toESM(require("path"), 1);
|
|
351
|
-
var import_node_process4 = __toESM(require("process"), 1);
|
|
352
|
-
var import_ansis4 = require("ansis");
|
|
353
|
-
var p4 = __toESM(require("@clack/prompts"), 1);
|
|
220
|
+
//#endregion
|
|
221
|
+
//#region src/cli/stages/update-vscode-settings.ts
|
|
354
222
|
async function updateVscodeSettings() {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
await import_promises4.default.writeFile(settingsPath, `{${vscodeSettingsString}}
|
|
371
|
-
`, "utf8");
|
|
372
|
-
p4.log.success(import_ansis4.green`Created .vscode/settings.json`);
|
|
373
|
-
}
|
|
223
|
+
const cwd = node_process.default.cwd();
|
|
224
|
+
const dotVscodePath = node_path.default.join(cwd, ".vscode");
|
|
225
|
+
const settingsPath = node_path.default.join(dotVscodePath, "settings.json");
|
|
226
|
+
if (!node_fs.default.existsSync(dotVscodePath)) await node_fs_promises.default.mkdir(dotVscodePath, { recursive: true });
|
|
227
|
+
if (node_fs.default.existsSync(settingsPath)) {
|
|
228
|
+
let settingsContent = await node_fs_promises.default.readFile(settingsPath, "utf8");
|
|
229
|
+
settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
|
|
230
|
+
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
231
|
+
settingsContent += `${vscodeSettingsString}}\n`;
|
|
232
|
+
await node_fs_promises.default.writeFile(settingsPath, settingsContent, "utf8");
|
|
233
|
+
_clack_prompts.log.success(ansis.green`Updated .vscode/settings.json`);
|
|
234
|
+
} else {
|
|
235
|
+
await node_fs_promises.default.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
|
|
236
|
+
_clack_prompts.log.success(ansis.green`Created .vscode/settings.json`);
|
|
237
|
+
}
|
|
374
238
|
}
|
|
375
|
-
|
|
376
|
-
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region src/cli/run.ts
|
|
377
241
|
async function run(options) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
`);
|
|
242
|
+
await updatePackageJson();
|
|
243
|
+
await updateEslintConfig(options);
|
|
244
|
+
await updateNpmignore();
|
|
245
|
+
await updateVscodeSettings();
|
|
246
|
+
_clack_prompts.log.success(ansis.default.green`Setup completed`);
|
|
247
|
+
_clack_prompts.outro(`Now you can update the dependencies by run ${ansis.default.blue("pnpm i")} and run ${ansis.default.blue("eslint --fix")}\n`);
|
|
385
248
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/cli/index.ts
|
|
251
|
+
const cli = (0, cac.cac)("@dhzh/eslint-config");
|
|
389
252
|
cli.command("", "Run the initialization or migration").action(async () => {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
p6.log.error(import_ansis6.default.inverse.red(" Failed to migrate "));
|
|
409
|
-
p6.log.error(import_ansis6.default.red`✘ ${String(error)}`);
|
|
410
|
-
throw error;
|
|
411
|
-
}
|
|
253
|
+
console.log("\n");
|
|
254
|
+
_clack_prompts.intro(`${ansis.default.green`@dhzh/eslint-config `}${ansis.default.dim`v${version}`}`);
|
|
255
|
+
const options = { hasNest: false };
|
|
256
|
+
const hasNest = await _clack_prompts.confirm({
|
|
257
|
+
message: "Is NestJS a part of the current project?",
|
|
258
|
+
initialValue: false
|
|
259
|
+
});
|
|
260
|
+
if (_clack_prompts.isCancel(hasNest)) {
|
|
261
|
+
_clack_prompts.cancel("Operation cancelled");
|
|
262
|
+
throw new Error("Operation cancelled");
|
|
263
|
+
} else options.hasNest = hasNest;
|
|
264
|
+
try {
|
|
265
|
+
await run(options);
|
|
266
|
+
} catch (error) {
|
|
267
|
+
_clack_prompts.log.error(ansis.default.inverse.red(" Failed to migrate "));
|
|
268
|
+
_clack_prompts.log.error(ansis.default.red`✘ ${String(error)}`);
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
412
271
|
});
|
|
413
272
|
cli.help();
|
|
414
273
|
cli.version(version);
|
|
415
274
|
cli.parse();
|
|
275
|
+
//#endregion
|
package/dist/cli/index.d.cts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|