@dhzh/eslint-config 1.26.0 → 1.27.0
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 +123 -279
- package/dist/cli/index.d.cts +1 -2
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +253 -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,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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.0";
|
|
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"
|
|
15
33
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
|
|
25
|
-
// src/cli/index.ts
|
|
26
|
-
var p6 = __toESM(require("@clack/prompts"), 1);
|
|
27
|
-
var import_ansis6 = __toESM(require("ansis"), 1);
|
|
28
|
-
var import_cac = require("cac");
|
|
29
|
-
|
|
30
|
-
// package.json
|
|
31
|
-
var version = "1.26.0";
|
|
32
|
-
var package_default = {
|
|
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
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
// src/cli/run.ts
|
|
154
|
-
var p5 = __toESM(require("@clack/prompts"), 1);
|
|
155
|
-
var import_ansis5 = __toESM(require("ansis"), 1);
|
|
156
|
-
|
|
157
|
-
// src/cli/stages/update-package-json.ts
|
|
158
|
-
var import_promises = __toESM(require("fs/promises"), 1);
|
|
159
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
160
|
-
var import_node_process = __toESM(require("process"), 1);
|
|
161
|
-
var p = __toESM(require("@clack/prompts"), 1);
|
|
162
|
-
var import_ansis = __toESM(require("ansis"), 1);
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/cli/stages/update-package-json.ts
|
|
163
36
|
async function updatePackageJson() {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
37
|
+
const cwd = node_process.default.cwd();
|
|
38
|
+
const pathPackageJSON = node_path.default.join(cwd, "package.json");
|
|
39
|
+
_clack_prompts.log.step(ansis.default.cyan`Bumping @dhzh/eslint-config to v${version}`);
|
|
40
|
+
const pkgContent = await node_fs_promises.default.readFile(pathPackageJSON, "utf8");
|
|
41
|
+
const pkg = JSON.parse(pkgContent);
|
|
42
|
+
pkg.devDependencies ??= {};
|
|
43
|
+
pkg.devDependencies["@dhzh/eslint-config"] = `^${version}`;
|
|
44
|
+
pkg.devDependencies.eslint ??= devDependencies.eslint;
|
|
45
|
+
pkg.scripts ??= {};
|
|
46
|
+
pkg.scripts.lint = "eslint .";
|
|
47
|
+
pkg.scripts["lint-fix"] = "eslint --fix .";
|
|
48
|
+
await node_fs_promises.default.writeFile(pathPackageJSON, JSON.stringify(pkg, null, 2));
|
|
49
|
+
_clack_prompts.log.success(ansis.default.green`Changes wrote to package.json`);
|
|
177
50
|
}
|
|
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 = `
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/cli/constants.ts
|
|
53
|
+
const vscodeSettingsString = `
|
|
188
54
|
// Entry
|
|
189
55
|
"eslint.format.enable": true,
|
|
190
56
|
"eslint.ignoreUntitled": true,
|
|
@@ -292,7 +158,7 @@ var vscodeSettingsString = `
|
|
|
292
158
|
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
293
159
|
}
|
|
294
160
|
`;
|
|
295
|
-
|
|
161
|
+
const eslintConfigContent = (options) => `import { defineConfig } from '@dhzh/eslint-config';
|
|
296
162
|
|
|
297
163
|
export default defineConfig(${options.hasNest ? `{
|
|
298
164
|
configs: {
|
|
@@ -302,114 +168,92 @@ export default defineConfig(${options.hasNest ? `{
|
|
|
302
168
|
},
|
|
303
169
|
}` : ""});
|
|
304
170
|
`;
|
|
305
|
-
|
|
171
|
+
const npmignoreString = `# If these files (ESLint flat config files) are not included in .npmignore,
|
|
306
172
|
# they will be published, and importing devDependencies in published files will trigger \`n/no-unpublished-import\` errors.
|
|
307
173
|
eslint.config.js
|
|
308
174
|
eslint.config.mjs
|
|
309
175
|
`;
|
|
310
|
-
|
|
311
|
-
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/cli/stages/update-eslint-config.ts
|
|
312
178
|
async function updateEslintConfig(options) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
p2.log.success(import_ansis2.default.green`Created ${configFileName}`);
|
|
179
|
+
const cwd = node_process.default.cwd();
|
|
180
|
+
const pathPackageJSON = node_path.default.join(cwd, "package.json");
|
|
181
|
+
const pkgContent = await node_fs_promises.default.readFile(pathPackageJSON, "utf8");
|
|
182
|
+
const configFileName = JSON.parse(pkgContent).type === "module" ? "eslint.config.js" : "eslint.config.mjs";
|
|
183
|
+
const pathFlatConfig = node_path.default.join(cwd, configFileName);
|
|
184
|
+
await node_fs_promises.default.writeFile(pathFlatConfig, eslintConfigContent(options));
|
|
185
|
+
_clack_prompts.log.success(ansis.default.green`Created ${configFileName}`);
|
|
321
186
|
}
|
|
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);
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/cli/stages/update-npmignore.ts
|
|
329
189
|
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}`);
|
|
190
|
+
const cwd = node_process.default.cwd();
|
|
191
|
+
const npmignoreFileName = ".npmignore";
|
|
192
|
+
const npmignoreFilePath = node_path.default.join(cwd, npmignoreFileName);
|
|
193
|
+
let action = "Created";
|
|
194
|
+
try {
|
|
195
|
+
await node_fs_promises.default.access(npmignoreFilePath);
|
|
196
|
+
const trimmedContent = (await node_fs_promises.default.readFile(npmignoreFilePath, "utf8")).trimEnd();
|
|
197
|
+
await node_fs_promises.default.writeFile(npmignoreFilePath, `${trimmedContent}\n${npmignoreString}`);
|
|
198
|
+
action = "Updated";
|
|
199
|
+
} catch {
|
|
200
|
+
await node_fs_promises.default.writeFile(npmignoreFilePath, npmignoreString);
|
|
201
|
+
}
|
|
202
|
+
_clack_prompts.log.success(ansis.default.green`${action} ${npmignoreFileName}`);
|
|
345
203
|
}
|
|
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);
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/cli/stages/update-vscode-settings.ts
|
|
354
206
|
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
|
-
}
|
|
207
|
+
const cwd = node_process.default.cwd();
|
|
208
|
+
const dotVscodePath = node_path.default.join(cwd, ".vscode");
|
|
209
|
+
const settingsPath = node_path.default.join(dotVscodePath, "settings.json");
|
|
210
|
+
if (!node_fs.default.existsSync(dotVscodePath)) await node_fs_promises.default.mkdir(dotVscodePath, { recursive: true });
|
|
211
|
+
if (node_fs.default.existsSync(settingsPath)) {
|
|
212
|
+
let settingsContent = await node_fs_promises.default.readFile(settingsPath, "utf8");
|
|
213
|
+
settingsContent = settingsContent.trim().replace(/\s*\}$/, "");
|
|
214
|
+
settingsContent += settingsContent.endsWith(",") || settingsContent.endsWith("{") ? "" : ",";
|
|
215
|
+
settingsContent += `${vscodeSettingsString}}\n`;
|
|
216
|
+
await node_fs_promises.default.writeFile(settingsPath, settingsContent, "utf8");
|
|
217
|
+
_clack_prompts.log.success(ansis.green`Updated .vscode/settings.json`);
|
|
218
|
+
} else {
|
|
219
|
+
await node_fs_promises.default.writeFile(settingsPath, `{${vscodeSettingsString}}\n`, "utf8");
|
|
220
|
+
_clack_prompts.log.success(ansis.green`Created .vscode/settings.json`);
|
|
221
|
+
}
|
|
374
222
|
}
|
|
375
|
-
|
|
376
|
-
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/cli/run.ts
|
|
377
225
|
async function run(options) {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
`);
|
|
226
|
+
await updatePackageJson();
|
|
227
|
+
await updateEslintConfig(options);
|
|
228
|
+
await updateNpmignore();
|
|
229
|
+
await updateVscodeSettings();
|
|
230
|
+
_clack_prompts.log.success(ansis.default.green`Setup completed`);
|
|
231
|
+
_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
232
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/cli/index.ts
|
|
235
|
+
const cli = (0, cac.cac)("@dhzh/eslint-config");
|
|
389
236
|
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
|
-
}
|
|
237
|
+
console.log("\n");
|
|
238
|
+
_clack_prompts.intro(`${ansis.default.green`@dhzh/eslint-config `}${ansis.default.dim`v${version}`}`);
|
|
239
|
+
const options = { hasNest: false };
|
|
240
|
+
const hasNest = await _clack_prompts.confirm({
|
|
241
|
+
message: "Is NestJS a part of the current project?",
|
|
242
|
+
initialValue: false
|
|
243
|
+
});
|
|
244
|
+
if (_clack_prompts.isCancel(hasNest)) {
|
|
245
|
+
_clack_prompts.cancel("Operation cancelled");
|
|
246
|
+
throw new Error("Operation cancelled");
|
|
247
|
+
} else options.hasNest = hasNest;
|
|
248
|
+
try {
|
|
249
|
+
await run(options);
|
|
250
|
+
} catch (error) {
|
|
251
|
+
_clack_prompts.log.error(ansis.default.inverse.red(" Failed to migrate "));
|
|
252
|
+
_clack_prompts.log.error(ansis.default.red`✘ ${String(error)}`);
|
|
253
|
+
throw error;
|
|
254
|
+
}
|
|
412
255
|
});
|
|
413
256
|
cli.help();
|
|
414
257
|
cli.version(version);
|
|
415
258
|
cli.parse();
|
|
259
|
+
//#endregion
|
package/dist/cli/index.d.cts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|