zixulu 1.4.1 → 1.5.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/index.js CHANGED
@@ -1,10 +1,34 @@
1
1
  #!/usr/bin/env node
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") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
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
+ ));
2
24
 
3
25
  // src/index.ts
4
26
  var import_commander = require("commander");
5
27
  var import_utils = require("./utils");
28
+ var import_path = require("path");
29
+ var import_consola = __toESM(require("consola"));
6
30
  var program = new import_commander.Command();
7
- var pkg = (0, import_utils.readPackageJson)("./");
31
+ var pkg = (0, import_utils.readPackageJson)((0, import_path.resolve)(__dirname, "../"));
8
32
  program.name("格数科技").version(pkg.version);
9
33
  program.command("eslint").description("删除 ESLint 配置文件").action(import_utils.removeESLint);
10
34
  program.command("prettier").description("添加 prettier 配置文件").option("-t, --tailwind", "是否添加 tailwind 插件").action((options) => {
@@ -14,4 +38,29 @@ program.command("prettier").description("添加 prettier 配置文件").option("
14
38
  program.command("vite").description("删除 vite 模板中的某些配置").action(import_utils.vite);
15
39
  program.command("tailwind").description("添加 tailwind 配置文件").action(import_utils.tailwind);
16
40
  program.command("remove-comment").description("删除所有注释").addArgument(new import_commander.Argument("path")).action(import_utils.removeComment);
41
+ program.command("ts-target").description("设置 tsconfig 中 target 字段").action(async () => {
42
+ const target = await import_consola.default.prompt("Please choose a target", {
43
+ type: "select",
44
+ options: Object.values(import_utils.Target),
45
+ initial: import_utils.Target.ESNext
46
+ });
47
+ (0, import_utils.setTsConfig)("target", target);
48
+ });
49
+ program.command("ts-module").description("设置 tsconfig 中 module 字段").action(async () => {
50
+ const module2 = await import_consola.default.prompt("Please choose a module", {
51
+ type: "select",
52
+ options: Object.values(import_utils.Module),
53
+ initial: import_utils.Module.ESNext
54
+ });
55
+ (0, import_utils.setTsConfig)("module", module2);
56
+ });
57
+ program.command("ts-module-resolution").alias("ts-mr").description("设置 tsconfig 中 module 字段").action(async () => {
58
+ const moduleResolution = await import_consola.default.prompt("Please choose a module resolution", {
59
+ type: "select",
60
+ options: Object.values(import_utils.ModuleResolution),
61
+ initial: import_utils.ModuleResolution.NodeNext
62
+ });
63
+ (0, import_utils.setTsConfig)("moduleResolution", moduleResolution);
64
+ });
17
65
  program.parse();
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["#!/usr/bin/env node\r\n\r\nimport { Argument, Command } from \"commander\"\r\nimport { Module, ModuleResolution, Target, addPrettierConfig, readPackageJson, removeComment, removeESLint, setTsConfig, tailwind, vite } from \"./utils\"\r\nimport { resolve } from \"path\"\r\nimport consola from \"consola\"\r\n\r\nconst program = new Command()\r\n\r\nconst pkg = readPackageJson(resolve(__dirname, \"../\"))\r\n\r\nprogram.name(\"格数科技\").version(pkg.version)\r\n\r\nprogram.command(\"eslint\").description(\"删除 ESLint 配置文件\").action(removeESLint)\r\n\r\nprogram\r\n .command(\"prettier\")\r\n .description(\"添加 prettier 配置文件\")\r\n .option(\"-t, --tailwind\", \"是否添加 tailwind 插件\")\r\n .action(options => {\r\n const { tailwind } = options\r\n addPrettierConfig(tailwind)\r\n })\r\n\r\nprogram.command(\"vite\").description(\"删除 vite 模板中的某些配置\").action(vite)\r\n\r\nprogram.command(\"tailwind\").description(\"添加 tailwind 配置文件\").action(tailwind)\r\n\r\nprogram.command(\"remove-comment\").description(\"删除所有注释\").addArgument(new Argument(\"path\")).action(removeComment)\r\n\r\nprogram\r\n .command(\"ts-target\")\r\n .description(\"设置 tsconfig 中 target 字段\")\r\n .action(async () => {\r\n const target = await consola.prompt(\"Please choose a target\", {\r\n type: \"select\",\r\n options: Object.values(Target),\r\n initial: Target.ESNext\r\n })\r\n setTsConfig(\"target\", target)\r\n })\r\n\r\nprogram\r\n .command(\"ts-module\")\r\n .description(\"设置 tsconfig 中 module 字段\")\r\n .action(async () => {\r\n const module = await consola.prompt(\"Please choose a module\", {\r\n type: \"select\",\r\n options: Object.values(Module),\r\n initial: Module.ESNext\r\n })\r\n setTsConfig(\"module\", module)\r\n })\r\n\r\nprogram\r\n .command(\"ts-module-resolution\")\r\n .alias(\"ts-mr\")\r\n .description(\"设置 tsconfig 中 module 字段\")\r\n .action(async () => {\r\n const moduleResolution = await consola.prompt(\"Please choose a module resolution\", {\r\n type: \"select\",\r\n options: Object.values(ModuleResolution),\r\n initial: ModuleResolution.NodeNext\r\n })\r\n setTsConfig(\"moduleResolution\", moduleResolution)\r\n })\r\n\r\nprogram.parse()\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uBAAkC;AAClC,mBAA+I;AAC/I,kBAAwB;AACxB,qBAAoB;AAEpB,IAAM,UAAU,IAAI,yBAAQ;AAE5B,IAAM,UAAM,kCAAgB,qBAAQ,WAAW,KAAK,CAAC;AAErD,QAAQ,KAAK,MAAM,EAAE,QAAQ,IAAI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D,gCAAY,oBAAoB,gBAAgB;AACpD,CAAC;AAEL,QAAQ,MAAM;",
6
+ "names": ["tailwind", "consola", "module"]
7
+ }
@@ -3,19 +3,25 @@
3
3
  import { Stats } from "fs";
4
4
  import { ParsedPath } from "path";
5
5
  import { Config } from "prettier";
6
- export declare function resolve(...paths: string[]): string;
7
6
  export declare function getPackageJsonPath(path?: string): string;
7
+ export declare function getTsConfigJsonPath(path?: string): string;
8
8
  /** 获取包的最新版本 */
9
9
  export declare function getPackageLatestVersion(packageName: string): Promise<string>;
10
10
  /** 读取 package.json */
11
11
  export declare function readPackageJson(path?: string): Record<string, any>;
12
+ /** 读取 tsconfig.json */
13
+ export declare function readTsconfigJSON(path?: string): Record<string, any>;
12
14
  /** 写入依赖 */
13
15
  export declare function addDependencies(packageJson: Record<string, any>, packageName: string, version?: string): Promise<void>;
14
16
  /** 写入开发依赖 */
15
17
  export declare function addDevDependencies(packageJson: Record<string, any>, packageName: string, version?: string): Promise<void>;
16
18
  /** 写回 package.json */
17
19
  export declare function writePackageJson(packageJson: Record<string, any>, path?: string): void;
18
- export declare function getFiles(path: string, judge: (path: ParsedPath, stats: Stats) => boolean, depth?: number): string[];
20
+ export interface GetFilesOptions {
21
+ depth?: number;
22
+ exclude?: (path: ParsedPath, stats: Stats) => boolean;
23
+ }
24
+ export declare function getFiles(path: string, judge: (path: ParsedPath, stats: Stats) => boolean, depthOrOptions?: number | GetFilesOptions): string[];
19
25
  /** 删除 ESLint 配置文件 */
20
26
  export declare function removeESLint(): void;
21
27
  export declare function vite(): void;
@@ -33,3 +39,41 @@ export declare function addPrettierConfig(tailwind?: boolean): void;
33
39
  /** 配置 tailwind */
34
40
  export declare function tailwind(): Promise<void>;
35
41
  export declare function removeComment(path: string): void;
42
+ export declare enum Target {
43
+ ES2015 = "ES2015",
44
+ ES2016 = "ES2016",
45
+ ES2017 = "ES2017",
46
+ ES2018 = "ES2018",
47
+ ES2019 = "ES2019",
48
+ ES2020 = "ES2020",
49
+ ES2021 = "ES2021",
50
+ ES2022 = "ES2022",
51
+ ES2023 = "ES2023",
52
+ ES3 = "ES3",
53
+ ES5 = "ES5",
54
+ ES6 = "ES6",
55
+ ESNext = "ESNext"
56
+ }
57
+ export declare enum Module {
58
+ AMD = "AMD",
59
+ CommonJS = "CommonJS",
60
+ ES2015 = "ES2015",
61
+ ES2020 = "ES2020",
62
+ ES2022 = "ES2022",
63
+ ES6 = "ES6",
64
+ ESNext = "ESNext",
65
+ Node16 = "Node16",
66
+ NodeNext = "NodeNext",
67
+ None = "None",
68
+ System = "System",
69
+ UMD = "UMD"
70
+ }
71
+ export declare enum ModuleResolution {
72
+ Bundler = "Bundler",
73
+ Classic = "Classic",
74
+ Node = "Node",
75
+ Node10 = "Node10",
76
+ Node16 = "Node16",
77
+ NodeNext = "NodeNext"
78
+ }
79
+ export declare function setTsConfig(key: string, value?: string | undefined): void;
@@ -29,6 +29,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/utils/index.ts
30
30
  var utils_exports = {};
31
31
  __export(utils_exports, {
32
+ Module: () => Module,
33
+ ModuleResolution: () => ModuleResolution,
34
+ Target: () => Target,
32
35
  addDependencies: () => addDependencies,
33
36
  addDevDependencies: () => addDevDependencies,
34
37
  addPostCSSConfig: () => addPostCSSConfig,
@@ -38,13 +41,15 @@ __export(utils_exports, {
38
41
  getFiles: () => getFiles,
39
42
  getPackageJsonPath: () => getPackageJsonPath,
40
43
  getPackageLatestVersion: () => getPackageLatestVersion,
44
+ getTsConfigJsonPath: () => getTsConfigJsonPath,
41
45
  prettierConfig: () => prettierConfig,
42
46
  prettierConfigText: () => prettierConfigText,
43
47
  prettierConfigTextWithTailwind: () => prettierConfigTextWithTailwind,
44
48
  readPackageJson: () => readPackageJson,
49
+ readTsconfigJSON: () => readTsconfigJSON,
45
50
  removeComment: () => removeComment,
46
51
  removeESLint: () => removeESLint,
47
- resolve: () => resolve,
52
+ setTsConfig: () => setTsConfig,
48
53
  tailwind: () => tailwind,
49
54
  vite: () => vite,
50
55
  writePackageJson: () => writePackageJson
@@ -54,11 +59,15 @@ var import_consola = __toESM(require("consola"));
54
59
  var import_fs = require("fs");
55
60
  var import_path = require("path");
56
61
  var import_process = require("process");
57
- function resolve(...paths) {
58
- return (0, import_path.join)((0, import_process.cwd)(), ...paths);
62
+ var JSON5 = __toESM(require("json5"));
63
+ function getAbsolutePath(path) {
64
+ return (0, import_path.isAbsolute)(path) ? path : (0, import_path.join)((0, import_process.cwd)(), path);
59
65
  }
60
66
  function getPackageJsonPath(path) {
61
- return resolve(path ?? (0, import_process.cwd)(), "package.json");
67
+ return (0, import_path.join)(getAbsolutePath(path ?? (0, import_process.cwd)()), "package.json");
68
+ }
69
+ function getTsConfigJsonPath(path) {
70
+ return (0, import_path.join)(getAbsolutePath(path ?? (0, import_process.cwd)()), "tsconfig.json");
62
71
  }
63
72
  async function getPackageLatestVersion(packageName) {
64
73
  try {
@@ -79,10 +88,22 @@ function readPackageJson(path) {
79
88
  import_consola.default.success("读取 package.json 成功");
80
89
  return result;
81
90
  } catch (error) {
91
+ import_consola.default.error(error);
82
92
  import_consola.default.fail("读取 package.json 失败");
83
93
  (0, import_process.exit)();
84
94
  }
85
95
  }
96
+ function readTsconfigJSON(path) {
97
+ try {
98
+ const result = JSON5.parse((0, import_fs.readFileSync)(getTsConfigJsonPath(path), "utf-8"));
99
+ import_consola.default.success("读取 tsconfig.json 成功");
100
+ return result;
101
+ } catch (error) {
102
+ import_consola.default.error(error);
103
+ import_consola.default.fail("读取 tsconfig.json 失败");
104
+ (0, import_process.exit)();
105
+ }
106
+ }
86
107
  async function addDependencies(packageJson, packageName, version) {
87
108
  var _a;
88
109
  try {
@@ -128,25 +149,34 @@ function writePackageJson(packageJson, path) {
128
149
  (0, import_process.exit)();
129
150
  }
130
151
  }
131
- function getFiles(path, judge, depth) {
152
+ function getFiles(path, judge, depthOrOptions) {
132
153
  const result = [];
133
- const files = (0, import_fs.readdirSync)(path);
134
- for (const file of files) {
135
- const filePath = resolve(path, file);
136
- const parsedPath = (0, import_path.parse)(filePath);
137
- const stat = (0, import_fs.statSync)(filePath);
138
- if (judge(parsedPath, stat)) {
139
- result.push(filePath);
140
- }
141
- if (stat.isDirectory() && (depth === void 0 || depth > 0)) {
142
- result.push(...getFiles(filePath, judge, depth === void 0 ? void 0 : depth - 1));
154
+ function _getFiles(path2, judge2, depthOrOptions2) {
155
+ const options = typeof depthOrOptions2 === "number" ? { depth: depthOrOptions2 } : depthOrOptions2 ?? {};
156
+ const { depth, exclude } = options;
157
+ path2 = getAbsolutePath(path2);
158
+ const files = (0, import_fs.readdirSync)(path2);
159
+ for (const file of files) {
160
+ const filePath = (0, import_path.join)(path2, file);
161
+ const parsedPath = (0, import_path.parse)(filePath);
162
+ const stat = (0, import_fs.statSync)(filePath);
163
+ if (judge2(parsedPath, stat)) {
164
+ result.push(filePath);
165
+ }
166
+ if (stat.isDirectory() && (!exclude || exclude(parsedPath, stat)) && (depth === void 0 || depth > 0)) {
167
+ getFiles(filePath, judge2, depth === void 0 ? void 0 : depth - 1);
168
+ }
143
169
  }
144
170
  }
171
+ _getFiles(path, judge, depthOrOptions);
145
172
  return result;
146
173
  }
147
174
  function removeESLint() {
148
175
  try {
149
- const files = getFiles((0, import_process.cwd)(), (path, stats) => /\.eslintrc\.[cm]?js/.test(path.base) && stats.isFile(), 1);
176
+ const files = getFiles((0, import_process.cwd)(), (path, stats) => /\.eslintrc\.[cm]?js/.test(path.base) && stats.isFile(), {
177
+ depth: 1,
178
+ exclude: (path) => path.base !== "node_modules"
179
+ });
150
180
  files.forEach((file) => {
151
181
  try {
152
182
  (0, import_fs.unlinkSync)(file);
@@ -156,6 +186,7 @@ function removeESLint() {
156
186
  });
157
187
  import_consola.default.success("删除 ESLint 配置文件成功");
158
188
  } catch (error) {
189
+ import_consola.default.error(error);
159
190
  import_consola.default.fail("获取 ESLint 配置文件列表失败");
160
191
  }
161
192
  try {
@@ -169,25 +200,22 @@ function removeESLint() {
169
200
  delete pkg.devDependencies[key];
170
201
  });
171
202
  writePackageJson(pkg);
172
- import_consola.default.success("删除 eslintrc 依赖成功");
203
+ import_consola.default.success("删除 ESLint 依赖成功");
173
204
  } catch (error) {
174
- import_consola.default.fail("删除 eslintrc 依赖失败");
205
+ import_consola.default.fail("删除 ESLint 依赖失败");
175
206
  }
176
207
  }
177
208
  function vite() {
178
- try {
179
- const text = (0, import_fs.readFileSync)(resolve("tsconfig.json"), "utf-8");
180
- const newText = text.replace(/^ +?"noUnusedLocals": true,$\n/m, "").replace(/^ +?"noUnusedParameters": true,$\n/m, "");
181
- (0, import_fs.writeFileSync)(resolve("tsconfig.json"), newText, "utf-8");
182
- import_consola.default.success("修改 tsconfig.json 配置成功");
183
- } catch (error) {
184
- import_consola.default.fail("修改 tsconfig.json 配置失败");
185
- }
209
+ setTsConfig("noUnusedLocals");
210
+ setTsConfig("noUnusedParameters");
211
+ const pkg = readPackageJson();
212
+ pkg.scripts.dev = "vite --host";
213
+ writePackageJson(pkg);
186
214
  }
187
215
  function addTailwindConfig() {
188
216
  try {
189
217
  (0, import_fs.writeFileSync)(
190
- resolve("tailwind.config.js"),
218
+ getAbsolutePath("tailwind.config.js"),
191
219
  `/** @type {import('tailwindcss').Config} */
192
220
  export default {
193
221
  content: [
@@ -209,7 +237,7 @@ export default {
209
237
  function addPostCSSConfig() {
210
238
  try {
211
239
  (0, import_fs.writeFileSync)(
212
- resolve("postcss.config.js"),
240
+ getAbsolutePath("postcss.config.js"),
213
241
  `export default {
214
242
  plugins: {
215
243
  tailwindcss: {},
@@ -225,9 +253,9 @@ function addPostCSSConfig() {
225
253
  }
226
254
  function addTailwindToCSS() {
227
255
  try {
228
- const css = (0, import_fs.readFileSync)(resolve("./src/index.css"), "utf-8");
256
+ const css = (0, import_fs.readFileSync)(getAbsolutePath("./src/index.css"), "utf-8");
229
257
  (0, import_fs.writeFileSync)(
230
- resolve("./src/index.css"),
258
+ getAbsolutePath("./src/index.css"),
231
259
  `@tailwind base;
232
260
  @tailwind components;
233
261
  @tailwind utilities;
@@ -251,7 +279,7 @@ var prettierConfigText = `module.exports = ${JSON.stringify(prettierConfig, void
251
279
  var prettierConfigTextWithTailwind = `module.exports = ${JSON.stringify({ plugins: ["prettier-plugin-tailwindcss"], ...prettierConfig }, void 0, 4)}`;
252
280
  function addPrettierConfig(tailwind2) {
253
281
  try {
254
- (0, import_fs.writeFileSync)(resolve("./prettier.config.cjs"), tailwind2 ? prettierConfigTextWithTailwind : prettierConfigText);
282
+ (0, import_fs.writeFileSync)(getAbsolutePath("./prettier.config.cjs"), tailwind2 ? prettierConfigTextWithTailwind : prettierConfigText);
255
283
  import_consola.default.success("添加 prettier 配置成功");
256
284
  } catch (error) {
257
285
  import_consola.default.fail("添加 prettier 配置失败");
@@ -272,16 +300,93 @@ async function tailwind() {
272
300
  }
273
301
  function removeComment(path) {
274
302
  try {
275
- const text = (0, import_fs.readFileSync)(resolve(path), "utf-8");
303
+ const text = (0, import_fs.readFileSync)(getAbsolutePath(path), "utf-8");
276
304
  const newText = text.replace(/^ *?\/\/.*?$/gm, "");
277
- (0, import_fs.writeFileSync)(resolve(path), newText, "utf-8");
305
+ (0, import_fs.writeFileSync)(getAbsolutePath(path), newText, "utf-8");
278
306
  import_consola.default.success("删除注释成功");
279
307
  } catch (error) {
280
308
  import_consola.default.fail("删除注释失败");
281
309
  }
282
310
  }
311
+ var Target = /* @__PURE__ */ ((Target2) => {
312
+ Target2["ES2015"] = "ES2015";
313
+ Target2["ES2016"] = "ES2016";
314
+ Target2["ES2017"] = "ES2017";
315
+ Target2["ES2018"] = "ES2018";
316
+ Target2["ES2019"] = "ES2019";
317
+ Target2["ES2020"] = "ES2020";
318
+ Target2["ES2021"] = "ES2021";
319
+ Target2["ES2022"] = "ES2022";
320
+ Target2["ES2023"] = "ES2023";
321
+ Target2["ES3"] = "ES3";
322
+ Target2["ES5"] = "ES5";
323
+ Target2["ES6"] = "ES6";
324
+ Target2["ESNext"] = "ESNext";
325
+ return Target2;
326
+ })(Target || {});
327
+ var Module = /* @__PURE__ */ ((Module2) => {
328
+ Module2["AMD"] = "AMD";
329
+ Module2["CommonJS"] = "CommonJS";
330
+ Module2["ES2015"] = "ES2015";
331
+ Module2["ES2020"] = "ES2020";
332
+ Module2["ES2022"] = "ES2022";
333
+ Module2["ES6"] = "ES6";
334
+ Module2["ESNext"] = "ESNext";
335
+ Module2["Node16"] = "Node16";
336
+ Module2["NodeNext"] = "NodeNext";
337
+ Module2["None"] = "None";
338
+ Module2["System"] = "System";
339
+ Module2["UMD"] = "UMD";
340
+ return Module2;
341
+ })(Module || {});
342
+ var ModuleResolution = /* @__PURE__ */ ((ModuleResolution2) => {
343
+ ModuleResolution2["Bundler"] = "Bundler";
344
+ ModuleResolution2["Classic"] = "Classic";
345
+ ModuleResolution2["Node"] = "Node";
346
+ ModuleResolution2["Node10"] = "Node10";
347
+ ModuleResolution2["Node16"] = "Node16";
348
+ ModuleResolution2["NodeNext"] = "NodeNext";
349
+ return ModuleResolution2;
350
+ })(ModuleResolution || {});
351
+ function setTsConfig(key, value) {
352
+ const tsconfig = readTsconfigJSON();
353
+ if (value === void 0) {
354
+ delete tsconfig.compilerOptions[key];
355
+ } else {
356
+ if (key === "target") {
357
+ const t = Object.values(Target).find((t2) => t2.toLowerCase() === value.trim().toLowerCase());
358
+ if (!t) {
359
+ import_consola.default.fail("无效的 target 选项");
360
+ (0, import_process.exit)();
361
+ }
362
+ tsconfig.compilerOptions.target = t;
363
+ } else if (key === "module") {
364
+ const m = Object.values(Module).find((m2) => m2.toLowerCase() === value.trim().toLowerCase());
365
+ if (!m) {
366
+ import_consola.default.fail("无效的 module 选项");
367
+ (0, import_process.exit)();
368
+ }
369
+ tsconfig.compilerOptions.module = m;
370
+ } else if (key === "moduleResolution") {
371
+ const mr = Object.values(ModuleResolution).find((mr2) => mr2.toLowerCase() === value.trim().toLowerCase());
372
+ if (!mr) {
373
+ import_consola.default.fail("无效的 moduleResolution 选项");
374
+ (0, import_process.exit)();
375
+ }
376
+ tsconfig.compilerOptions.moduleResolution = mr;
377
+ } else {
378
+ import_consola.default.fail(`暂不支持 ${key} 项`);
379
+ (0, import_process.exit)();
380
+ }
381
+ }
382
+ (0, import_fs.writeFileSync)(getTsConfigJsonPath(), JSON.stringify(tsconfig, void 0, 4), "utf-8");
383
+ import_consola.default.success(`修改 ${key} 成功`);
384
+ }
283
385
  // Annotate the CommonJS export names for ESM import in node:
284
386
  0 && (module.exports = {
387
+ Module,
388
+ ModuleResolution,
389
+ Target,
285
390
  addDependencies,
286
391
  addDevDependencies,
287
392
  addPostCSSConfig,
@@ -291,14 +396,17 @@ function removeComment(path) {
291
396
  getFiles,
292
397
  getPackageJsonPath,
293
398
  getPackageLatestVersion,
399
+ getTsConfigJsonPath,
294
400
  prettierConfig,
295
401
  prettierConfigText,
296
402
  prettierConfigTextWithTailwind,
297
403
  readPackageJson,
404
+ readTsconfigJSON,
298
405
  removeComment,
299
406
  removeESLint,
300
- resolve,
407
+ setTsConfig,
301
408
  tailwind,
302
409
  vite,
303
410
  writePackageJson
304
411
  });
412
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/index.ts"],
4
+ "sourcesContent": ["import consola from \"consola\"\r\nimport { Stats, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from \"fs\"\r\nimport { ParsedPath, isAbsolute, join, parse } from \"path\"\r\nimport { Config } from \"prettier\"\r\nimport { cwd, exit } from \"process\"\r\nimport * as JSON5 from \"json5\"\r\n\r\nfunction getAbsolutePath(path: string) {\r\n return isAbsolute(path) ? path : join(cwd(), path)\r\n}\r\n\r\nexport function getPackageJsonPath(path?: string) {\r\n return join(getAbsolutePath(path ?? cwd()), \"package.json\")\r\n}\r\n\r\nexport function getTsConfigJsonPath(path?: string) {\r\n return join(getAbsolutePath(path ?? cwd()), \"tsconfig.json\")\r\n}\r\n\r\n/** 获取包的最新版本 */\r\nexport async function getPackageLatestVersion(packageName: string) {\r\n try {\r\n consola.start(`开始获取 ${packageName} 最新版本号...`)\r\n const url = `https://registry.npmjs.org/${packageName}/latest`\r\n const response = await fetch(url)\r\n const data = await response.json()\r\n consola.success(`获取 ${packageName} 最新版本号成功`)\r\n return data.version as string\r\n } catch (error) {\r\n consola.fail(`获取 ${packageName} 最新版本号失败`)\r\n exit()\r\n }\r\n}\r\n\r\n/** 读取 package.json */\r\nexport function readPackageJson(path?: string): Record<string, any> {\r\n try {\r\n const result = JSON.parse(readFileSync(getPackageJsonPath(path), \"utf-8\"))\r\n consola.success(\"读取 package.json 成功\")\r\n return result\r\n } catch (error) {\r\n consola.error(error)\r\n consola.fail(\"读取 package.json 失败\")\r\n exit()\r\n }\r\n}\r\n\r\n/** 读取 tsconfig.json */\r\nexport function readTsconfigJSON(path?: string): Record<string, any> {\r\n try {\r\n const result = JSON5.parse(readFileSync(getTsConfigJsonPath(path), \"utf-8\"))\r\n consola.success(\"读取 tsconfig.json 成功\")\r\n return result\r\n } catch (error) {\r\n consola.error(error)\r\n consola.fail(\"读取 tsconfig.json 失败\")\r\n exit()\r\n }\r\n}\r\n\r\n/** 写入依赖 */\r\nexport async function addDependencies(packageJson: Record<string, any>, packageName: string, version?: string) {\r\n try {\r\n packageJson.dependencies ??= {}\r\n packageJson.dependencies[packageName] ??= version?.trim() || `^${await getPackageLatestVersion(packageName)}`\r\n const keys = Object.keys(packageJson.dependencies)\r\n keys.sort()\r\n const sortedDependencies: Record<string, string> = {}\r\n for (const key of keys) {\r\n sortedDependencies[key] = packageJson.dependencies[key]\r\n }\r\n packageJson.dependencies = sortedDependencies\r\n consola.success(`添加 ${packageName} 至依赖成功`)\r\n } catch (error) {\r\n consola.fail(`添加 ${packageName} 至依赖失败`)\r\n exit()\r\n }\r\n}\r\n\r\n/** 写入开发依赖 */\r\nexport async function addDevDependencies(packageJson: Record<string, any>, packageName: string, version?: string) {\r\n try {\r\n packageJson.devDependencies ??= {}\r\n packageJson.devDependencies[packageName] ??= version?.trim() || `^${await getPackageLatestVersion(packageName)}`\r\n const keys = Object.keys(packageJson.devDependencies)\r\n keys.sort()\r\n const sortedDevDependencies: Record<string, string> = {}\r\n for (const key of keys) {\r\n sortedDevDependencies[key] = packageJson.devDependencies[key]\r\n }\r\n packageJson.devDependencies = sortedDevDependencies\r\n consola.success(`添加 ${packageName} 至开发依赖成功`)\r\n } catch (error) {\r\n consola.fail(`添加 ${packageName} 至开发依赖失败`)\r\n exit()\r\n }\r\n}\r\n\r\n/** 写回 package.json */\r\nexport function writePackageJson(packageJson: Record<string, any>, path?: string) {\r\n try {\r\n writeFileSync(getPackageJsonPath(path), JSON.stringify(packageJson, undefined, 4), \"utf-8\")\r\n consola.success(\"修改 package.json 成功\")\r\n } catch (error) {\r\n consola.fail(\"修改 package.json 失败\")\r\n exit()\r\n }\r\n}\r\n\r\nexport interface GetFilesOptions {\r\n depth?: number\r\n exclude?: (path: ParsedPath, stats: Stats) => boolean\r\n}\r\n\r\nexport function getFiles(path: string, judge: (path: ParsedPath, stats: Stats) => boolean, depthOrOptions?: number | GetFilesOptions) {\r\n const result: string[] = []\r\n function _getFiles(path: string, judge: (path: ParsedPath, stats: Stats) => boolean, depthOrOptions?: number | GetFilesOptions) {\r\n const options: GetFilesOptions = typeof depthOrOptions === \"number\" ? { depth: depthOrOptions } : depthOrOptions ?? {}\r\n const { depth, exclude } = options\r\n path = getAbsolutePath(path)\r\n const files = readdirSync(path)\r\n for (const file of files) {\r\n const filePath = join(path, file)\r\n const parsedPath = parse(filePath)\r\n const stat = statSync(filePath)\r\n if (judge(parsedPath, stat)) {\r\n result.push(filePath)\r\n }\r\n if (stat.isDirectory() && (!exclude || exclude(parsedPath, stat)) && (depth === undefined || depth > 0)) {\r\n getFiles(filePath, judge, depth === undefined ? undefined : depth - 1)\r\n }\r\n }\r\n }\r\n _getFiles(path, judge, depthOrOptions)\r\n return result\r\n}\r\n\r\n/** 删除 ESLint 配置文件 */\r\nexport function removeESLint() {\r\n try {\r\n const files = getFiles(cwd(), (path, stats) => /\\.eslintrc\\.[cm]?js/.test(path.base) && stats.isFile(), {\r\n depth: 1,\r\n exclude: path => path.base !== \"node_modules\"\r\n })\r\n files.forEach(file => {\r\n try {\r\n unlinkSync(file)\r\n } catch (error) {\r\n consola.fail(`删除 ${file} 失败`)\r\n }\r\n })\r\n consola.success(\"删除 ESLint 配置文件成功\")\r\n } catch (error) {\r\n consola.error(error)\r\n consola.fail(\"获取 ESLint 配置文件列表失败\")\r\n }\r\n try {\r\n const pkg = readPackageJson()\r\n Object.keys(pkg.dependencies).forEach(key => {\r\n if (key.includes(\"eslint\")) delete pkg.dependencies[key]\r\n })\r\n Object.keys(pkg.devDependencies).forEach(key => {\r\n if (key.includes(\"eslint\")) delete pkg.devDependencies[key]\r\n })\r\n writePackageJson(pkg)\r\n consola.success(\"删除 ESLint 依赖成功\")\r\n } catch (error) {\r\n consola.fail(\"删除 ESLint 依赖失败\")\r\n }\r\n}\r\n\r\nexport function vite() {\r\n setTsConfig(\"noUnusedLocals\")\r\n setTsConfig(\"noUnusedParameters\")\r\n const pkg = readPackageJson()\r\n pkg.scripts.dev = \"vite --host\"\r\n writePackageJson(pkg)\r\n}\r\n\r\n/** 添加 tailwind.config.js 配置成功 */\r\nexport function addTailwindConfig() {\r\n try {\r\n writeFileSync(\r\n getAbsolutePath(\"tailwind.config.js\"),\r\n `/** @type {import('tailwindcss').Config} */\r\nexport default {\r\n content: [\r\n \"./index.html\",\r\n \"./src/**/*.{js,ts,jsx,tsx}\",\r\n ],\r\n theme: {\r\n extend: {},\r\n },\r\n plugins: [],\r\n}`,\r\n \"utf-8\"\r\n )\r\n consola.success(\"添加 tailwind.config.js 配置成功\")\r\n } catch (error) {\r\n consola.fail(\"添加 tailwind.config.js 配置失败\")\r\n }\r\n}\r\n\r\n/** 添加 postcss.config.js 配置成功 */\r\nexport function addPostCSSConfig() {\r\n try {\r\n writeFileSync(\r\n getAbsolutePath(\"postcss.config.js\"),\r\n `export default {\r\n plugins: {\r\n tailwindcss: {},\r\n autoprefixer: {}\r\n }\r\n }`,\r\n \"utf-8\"\r\n )\r\n consola.success(\"添加 postcss.config.js 配置成功\")\r\n } catch (error) {\r\n consola.fail(\"添加 postcss.config.js 配置失败\")\r\n }\r\n}\r\n\r\n/** 添加 tailwind 至 index.css 成功 */\r\nexport function addTailwindToCSS() {\r\n try {\r\n const css = readFileSync(getAbsolutePath(\"./src/index.css\"), \"utf-8\")\r\n writeFileSync(\r\n getAbsolutePath(\"./src/index.css\"),\r\n `@tailwind base; \r\n@tailwind components;\r\n@tailwind utilities;\r\n\r\n${css}`,\r\n \"utf-8\"\r\n )\r\n consola.success(\"添加 tailwind 至 index.css 成功\")\r\n } catch (error) {\r\n consola.fail(\"添加 tailwind 至 index.css 失败\")\r\n }\r\n}\r\n\r\nexport const prettierConfig: Config = {\r\n semi: false,\r\n tabWidth: 4,\r\n arrowParens: \"avoid\",\r\n printWidth: 800,\r\n trailingComma: \"none\"\r\n}\r\n\r\nexport const prettierConfigText = `module.exports = ${JSON.stringify(prettierConfig, undefined, 4)}`\r\n\r\nexport const prettierConfigTextWithTailwind = `module.exports = ${JSON.stringify({ plugins: [\"prettier-plugin-tailwindcss\"], ...prettierConfig }, undefined, 4)}`\r\n\r\n/** 添加 prettier 配置成功 */\r\nexport function addPrettierConfig(tailwind?: boolean) {\r\n try {\r\n writeFileSync(getAbsolutePath(\"./prettier.config.cjs\"), tailwind ? prettierConfigTextWithTailwind : prettierConfigText)\r\n consola.success(\"添加 prettier 配置成功\")\r\n } catch (error) {\r\n consola.fail(\"添加 prettier 配置失败\")\r\n }\r\n}\r\n\r\n/** 配置 tailwind */\r\nexport async function tailwind() {\r\n const pkg = readPackageJson()\r\n await addDevDependencies(pkg, \"tailwindcss\")\r\n await addDevDependencies(pkg, \"autoprefixer\")\r\n await addDevDependencies(pkg, \"postcss\")\r\n await addDevDependencies(pkg, \"prettier\")\r\n await addDevDependencies(pkg, \"prettier-plugin-tailwindcss\")\r\n writePackageJson(pkg)\r\n addTailwindConfig()\r\n addPostCSSConfig()\r\n addTailwindToCSS()\r\n addPrettierConfig(true)\r\n}\r\n\r\nexport function removeComment(path: string) {\r\n try {\r\n const text = readFileSync(getAbsolutePath(path), \"utf-8\")\r\n const newText = text.replace(/^ *?\\/\\/.*?$/gm, \"\")\r\n writeFileSync(getAbsolutePath(path), newText, \"utf-8\")\r\n consola.success(\"删除注释成功\")\r\n } catch (error) {\r\n consola.fail(\"删除注释失败\")\r\n }\r\n}\r\n\r\nexport enum Target {\r\n ES2015 = \"ES2015\",\r\n ES2016 = \"ES2016\",\r\n ES2017 = \"ES2017\",\r\n ES2018 = \"ES2018\",\r\n ES2019 = \"ES2019\",\r\n ES2020 = \"ES2020\",\r\n ES2021 = \"ES2021\",\r\n ES2022 = \"ES2022\",\r\n ES2023 = \"ES2023\",\r\n ES3 = \"ES3\",\r\n ES5 = \"ES5\",\r\n ES6 = \"ES6\",\r\n ESNext = \"ESNext\"\r\n}\r\n\r\nexport enum Module {\r\n AMD = \"AMD\",\r\n CommonJS = \"CommonJS\",\r\n ES2015 = \"ES2015\",\r\n ES2020 = \"ES2020\",\r\n ES2022 = \"ES2022\",\r\n ES6 = \"ES6\",\r\n ESNext = \"ESNext\",\r\n Node16 = \"Node16\",\r\n NodeNext = \"NodeNext\",\r\n None = \"None\",\r\n System = \"System\",\r\n UMD = \"UMD\"\r\n}\r\n\r\nexport enum ModuleResolution {\r\n Bundler = \"Bundler\",\r\n Classic = \"Classic\",\r\n Node = \"Node\",\r\n Node10 = \"Node10\",\r\n Node16 = \"Node16\",\r\n NodeNext = \"NodeNext\"\r\n}\r\n\r\nexport function setTsConfig(key: string, value?: string | undefined) {\r\n const tsconfig = readTsconfigJSON()\r\n if (value === undefined) {\r\n delete tsconfig.compilerOptions[key]\r\n } else {\r\n if (key === \"target\") {\r\n const t = Object.values(Target).find(t => t.toLowerCase() === value.trim().toLowerCase())\r\n if (!t) {\r\n consola.fail(\"无效的 target 选项\")\r\n exit()\r\n }\r\n tsconfig.compilerOptions.target = t\r\n } else if (key === \"module\") {\r\n const m = Object.values(Module).find(m => m.toLowerCase() === value.trim().toLowerCase())\r\n if (!m) {\r\n consola.fail(\"无效的 module 选项\")\r\n exit()\r\n }\r\n tsconfig.compilerOptions.module = m\r\n } else if (key === \"moduleResolution\") {\r\n const mr = Object.values(ModuleResolution).find(mr => mr.toLowerCase() === value.trim().toLowerCase())\r\n if (!mr) {\r\n consola.fail(\"无效的 moduleResolution 选项\")\r\n exit()\r\n }\r\n tsconfig.compilerOptions.moduleResolution = mr\r\n } else {\r\n consola.fail(`暂不支持 ${key} 项`)\r\n exit()\r\n }\r\n }\r\n writeFileSync(getTsConfigJsonPath(), JSON.stringify(tsconfig, undefined, 4), \"utf-8\")\r\n consola.success(`修改 ${key} 成功`)\r\n}\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,gBAAsF;AACtF,kBAAoD;AAEpD,qBAA0B;AAC1B,YAAuB;AAEvB,SAAS,gBAAgB,MAAc;AACnC,aAAO,wBAAW,IAAI,IAAI,WAAO,sBAAK,oBAAI,GAAG,IAAI;AACrD;AAEO,SAAS,mBAAmB,MAAe;AAC9C,aAAO,kBAAK,gBAAgB,YAAQ,oBAAI,CAAC,GAAG,cAAc;AAC9D;AAEO,SAAS,oBAAoB,MAAe;AAC/C,aAAO,kBAAK,gBAAgB,YAAQ,oBAAI,CAAC,GAAG,eAAe;AAC/D;AAGA,eAAsB,wBAAwB,aAAqB;AAC/D,MAAI;AACA,mBAAAA,QAAQ,MAAM,QAAQ,sBAAsB;AAC5C,UAAM,MAAM,8BAA8B;AAC1C,UAA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,KAAK,CAAAU,QAAMA,IAAG,YAAY,MAAM,MAAM,KAAK,EAAE,YAAY,CAAC;AACrG,UAAI,CAAC,IAAI;AACL,uBAAAV,QAAQ,KAAK,yBAAyB;AACtC,iCAAK;AAAA,MACT;AACA,eAAS,gBAAgB,mBAAmB;AAAA,IAChD,OAAO;AACH,qBAAAA,QAAQ,KAAK,QAAQ,OAAO;AAC5B,+BAAK;AAAA,IACT;AAAA,EACJ;AACA,+BAAc,oBAAoB,GAAG,KAAK,UAAU,UAAU,QAAW,CAAC,GAAG,OAAO;AACpF,iBAAAA,QAAQ,QAAQ,MAAM,QAAQ;AAClC;",
6
+ "names": ["consola", "path", "judge", "depthOrOptions", "tailwind", "Target", "Module", "ModuleResolution", "t", "m", "mr"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zixulu",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "bin": "dist/index.js",
@@ -24,6 +24,7 @@
24
24
  "commander": "^11.1.0",
25
25
  "consola": "^3.2.3",
26
26
  "inquirer": "^9.2.12",
27
+ "json5": "^2.2.3",
27
28
  "prettier": "^3.1.1"
28
29
  },
29
30
  "devDependencies": {