create-aomex 0.0.17 → 0.0.19

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
@@ -1171,15 +1171,15 @@ var require_route = __commonJS({
1171
1171
  };
1172
1172
  }
1173
1173
  function wrapConversion(toModel, graph) {
1174
- const path3 = [graph[toModel].parent, toModel];
1174
+ const path4 = [graph[toModel].parent, toModel];
1175
1175
  let fn = conversions[graph[toModel].parent][toModel];
1176
1176
  let cur = graph[toModel].parent;
1177
1177
  while (graph[cur].parent) {
1178
- path3.unshift(graph[cur].parent);
1178
+ path4.unshift(graph[cur].parent);
1179
1179
  fn = link2(conversions[graph[cur].parent][cur], fn);
1180
1180
  cur = graph[cur].parent;
1181
1181
  }
1182
- fn.conversion = path3;
1182
+ fn.conversion = path4;
1183
1183
  return fn;
1184
1184
  }
1185
1185
  module.exports = function(fromModel) {
@@ -1615,16 +1615,16 @@ var require_utils = __commonJS({
1615
1615
  var string_width_1 = __importDefault(require_string_width());
1616
1616
  var strip_ansi_1 = __importDefault(require_strip_ansi());
1617
1617
  var getBorderCharacters_1 = require_getBorderCharacters();
1618
- var normalizeString = (input) => {
1619
- return input.replace(/\r\n/g, "\n");
1618
+ var normalizeString = (input2) => {
1619
+ return input2.replace(/\r\n/g, "\n");
1620
1620
  };
1621
1621
  exports.normalizeString = normalizeString;
1622
- var splitAnsi = (input) => {
1623
- const lengths = (0, strip_ansi_1.default)(input).split("\n").map(string_width_1.default);
1622
+ var splitAnsi = (input2) => {
1623
+ const lengths = (0, strip_ansi_1.default)(input2).split("\n").map(string_width_1.default);
1624
1624
  const result = [];
1625
1625
  let startIndex = 0;
1626
1626
  lengths.forEach((length) => {
1627
- result.push(length === 0 ? "" : (0, slice_ansi_1.default)(input, startIndex, startIndex + length));
1627
+ result.push(length === 0 ? "" : (0, slice_ansi_1.default)(input2, startIndex, startIndex + length));
1628
1628
  startIndex += length + 1;
1629
1629
  });
1630
1630
  return result;
@@ -1646,9 +1646,9 @@ var require_utils = __commonJS({
1646
1646
  });
1647
1647
  };
1648
1648
  exports.groupBySizes = groupBySizes;
1649
- var countSpaceSequence = (input) => {
1649
+ var countSpaceSequence = (input2) => {
1650
1650
  var _a, _b;
1651
- return (_b = (_a = input.match(/\s+/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
1651
+ return (_b = (_a = input2.match(/\s+/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
1652
1652
  };
1653
1653
  exports.countSpaceSequence = countSpaceSequence;
1654
1654
  var distributeUnevenly = (sum, length) => {
@@ -1828,8 +1828,8 @@ var require_wrapWord = __commonJS({
1828
1828
  exports.wrapWord = void 0;
1829
1829
  var slice_ansi_1 = __importDefault(require_slice_ansi());
1830
1830
  var strip_ansi_1 = __importDefault(require_strip_ansi());
1831
- var calculateStringLengths = (input, size) => {
1832
- let subject = (0, strip_ansi_1.default)(input);
1831
+ var calculateStringLengths = (input2, size) => {
1832
+ let subject = (0, strip_ansi_1.default)(input2);
1833
1833
  const chunks = [];
1834
1834
  const re = new RegExp("(^.{1," + String(Math.max(size, 1)) + "}(\\s+|$))|(^.{1," + String(Math.max(size - 1, 1)) + "}(\\\\|/|_|\\.|,|;|-))");
1835
1835
  do {
@@ -1849,11 +1849,11 @@ var require_wrapWord = __commonJS({
1849
1849
  } while (subject.length);
1850
1850
  return chunks;
1851
1851
  };
1852
- var wrapWord2 = (input, size) => {
1852
+ var wrapWord2 = (input2, size) => {
1853
1853
  const result = [];
1854
1854
  let startIndex = 0;
1855
- calculateStringLengths(input, size).forEach(([length, offset]) => {
1856
- result.push((0, slice_ansi_1.default)(input, startIndex, startIndex + length));
1855
+ calculateStringLengths(input2, size).forEach(([length, offset]) => {
1856
+ result.push((0, slice_ansi_1.default)(input2, startIndex, startIndex + length));
1857
1857
  startIndex += length + offset;
1858
1858
  });
1859
1859
  return result;
@@ -4940,8 +4940,8 @@ var require_padTableData = __commonJS({
4940
4940
  "use strict";
4941
4941
  Object.defineProperty(exports, "__esModule", { value: true });
4942
4942
  exports.padTableData = exports.padString = void 0;
4943
- var padString = (input, paddingLeft, paddingRight) => {
4944
- return " ".repeat(paddingLeft) + input + " ".repeat(paddingRight);
4943
+ var padString = (input2, paddingLeft, paddingRight) => {
4944
+ return " ".repeat(paddingLeft) + input2 + " ".repeat(paddingRight);
4945
4945
  };
4946
4946
  exports.padString = padString;
4947
4947
  var padTableData = (rows, config) => {
@@ -5213,8 +5213,8 @@ var require_truncateTableData = __commonJS({
5213
5213
  Object.defineProperty(exports, "__esModule", { value: true });
5214
5214
  exports.truncateTableData = exports.truncateString = void 0;
5215
5215
  var lodash_truncate_1 = __importDefault(require_lodash());
5216
- var truncateString = (input, length) => {
5217
- return (0, lodash_truncate_1.default)(input, {
5216
+ var truncateString = (input2, length) => {
5217
+ return (0, lodash_truncate_1.default)(input2, {
5218
5218
  length,
5219
5219
  omission: "\u2026"
5220
5220
  });
@@ -6084,33 +6084,31 @@ var require_brace_expansion = __commonJS({
6084
6084
  });
6085
6085
 
6086
6086
  // src/index.ts
6087
- import path2 from "node:path/posix";
6087
+ import path3 from "node:path/posix";
6088
6088
  import yargsParser from "yargs-parser";
6089
- import { existsSync } from "node:fs";
6090
6089
  import {
6091
6090
  cp,
6092
6091
  mkdir,
6093
6092
  readdir as readdir2,
6094
6093
  readFile,
6095
- rm,
6096
6094
  stat,
6097
6095
  writeFile as writeFile2
6098
6096
  } from "node:fs/promises";
6099
6097
 
6100
- // node_modules/.pnpm/@aomex+core@3.2.0_@types+node@20.14.12_typescript@5.5.4/node_modules/@aomex/core/dist/index.js
6098
+ // node_modules/.pnpm/@aomex+core@3.2.2_@types+node@20.14.12_typescript@5.5.4/node_modules/@aomex/core/dist/index.js
6101
6099
  var import_openapi_types = __toESM(require_dist(), 1);
6102
6100
  var import_email_validator = __toESM(require_email_validator(), 1);
6103
6101
  import { isIP, isIPv4, isIPv6 } from "node:net";
6104
6102
  import stream from "node:stream";
6105
6103
  import { URL as URL2 } from "node:url";
6106
6104
 
6107
- // node_modules/.pnpm/@aomex+internal-tools@3.2.0/node_modules/@aomex/internal-tools/dist/index.js
6105
+ // node_modules/.pnpm/@aomex+internal-tools@3.2.2/node_modules/@aomex/internal-tools/dist/index.js
6108
6106
  var import_bytes = __toESM(require_bytes(), 1);
6109
6107
  function toArray(data, unique = false) {
6110
6108
  return Array.isArray(data) ? unique ? [...new Set(data)] : data : [data];
6111
6109
  }
6112
6110
 
6113
- // node_modules/.pnpm/@aomex+core@3.2.0_@types+node@20.14.12_typescript@5.5.4/node_modules/@aomex/core/dist/index.js
6111
+ // node_modules/.pnpm/@aomex+core@3.2.2_@types+node@20.14.12_typescript@5.5.4/node_modules/@aomex/core/dist/index.js
6114
6112
  var I18n = class {
6115
6113
  localeName;
6116
6114
  fallbackLocaleName;
@@ -7591,7 +7589,7 @@ var Rule = class {
7591
7589
  };
7592
7590
  var rule = new Rule();
7593
7591
 
7594
- // node_modules/.pnpm/@aomex+console@3.2.0_@aomex+core@3.2.0_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
7592
+ // node_modules/.pnpm/@aomex+console@3.2.2_@aomex+core@3.2.2_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
7595
7593
  import { styleText } from "node:util";
7596
7594
 
7597
7595
  // node_modules/.pnpm/log-symbols@7.0.0/node_modules/log-symbols/symbols.js
@@ -7608,12 +7606,12 @@ import tty from "node:tty";
7608
7606
  var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
7609
7607
  var format = (open, close) => {
7610
7608
  if (!hasColors) {
7611
- return (input) => input;
7609
+ return (input2) => input2;
7612
7610
  }
7613
7611
  const openCode = `\x1B[${open}m`;
7614
7612
  const closeCode = `\x1B[${close}m`;
7615
- return (input) => {
7616
- const string = input + "";
7613
+ return (input2) => {
7614
+ const string = input2 + "";
7617
7615
  let index = string.indexOf(closeCode);
7618
7616
  if (index === -1) {
7619
7617
  return openCode + string + closeCode;
@@ -7862,7 +7860,7 @@ var iTerm = {
7862
7860
  }
7863
7861
  };
7864
7862
 
7865
- // node_modules/.pnpm/@aomex+console@3.2.0_@aomex+core@3.2.0_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
7863
+ // node_modules/.pnpm/@aomex+console@3.2.2_@aomex+core@3.2.2_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
7866
7864
  var import_table = __toESM(require_src(), 1);
7867
7865
 
7868
7866
  // node_modules/.pnpm/log-update@6.1.0/node_modules/log-update/index.js
@@ -9509,7 +9507,7 @@ var esm_default = {
9509
9507
  })
9510
9508
  };
9511
9509
 
9512
- // node_modules/.pnpm/@aomex+console@3.2.0_@aomex+core@3.2.0_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
9510
+ // node_modules/.pnpm/@aomex+console@3.2.2_@aomex+core@3.2.2_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
9513
9511
  import parse from "yargs-parser";
9514
9512
 
9515
9513
  // node_modules/.pnpm/yargs@17.7.2/node_modules/yargs/build/lib/typings/common-types.js
@@ -16580,12 +16578,12 @@ var PathBase = class {
16580
16578
  /**
16581
16579
  * Get the Path object referenced by the string path, resolved from this Path
16582
16580
  */
16583
- resolve(path3) {
16584
- if (!path3) {
16581
+ resolve(path4) {
16582
+ if (!path4) {
16585
16583
  return this;
16586
16584
  }
16587
- const rootPath = this.getRootString(path3);
16588
- const dir = path3.substring(rootPath.length);
16585
+ const rootPath = this.getRootString(path4);
16586
+ const dir = path4.substring(rootPath.length);
16589
16587
  const dirParts = dir.split(this.splitSep);
16590
16588
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
16591
16589
  return result;
@@ -17337,8 +17335,8 @@ var PathWin32 = class _PathWin32 extends PathBase {
17337
17335
  /**
17338
17336
  * @internal
17339
17337
  */
17340
- getRootString(path3) {
17341
- return win32.parse(path3).root;
17338
+ getRootString(path4) {
17339
+ return win32.parse(path4).root;
17342
17340
  }
17343
17341
  /**
17344
17342
  * @internal
@@ -17384,8 +17382,8 @@ var PathPosix = class _PathPosix extends PathBase {
17384
17382
  /**
17385
17383
  * @internal
17386
17384
  */
17387
- getRootString(path3) {
17388
- return path3.startsWith("/") ? "/" : "";
17385
+ getRootString(path4) {
17386
+ return path4.startsWith("/") ? "/" : "";
17389
17387
  }
17390
17388
  /**
17391
17389
  * @internal
@@ -17474,11 +17472,11 @@ var PathScurryBase = class {
17474
17472
  /**
17475
17473
  * Get the depth of a provided path, string, or the cwd
17476
17474
  */
17477
- depth(path3 = this.cwd) {
17478
- if (typeof path3 === "string") {
17479
- path3 = this.cwd.resolve(path3);
17475
+ depth(path4 = this.cwd) {
17476
+ if (typeof path4 === "string") {
17477
+ path4 = this.cwd.resolve(path4);
17480
17478
  }
17481
- return path3.depth();
17479
+ return path4.depth();
17482
17480
  }
17483
17481
  /**
17484
17482
  * Return the cache of child entries. Exposed so subclasses can create
@@ -17965,9 +17963,9 @@ var PathScurryBase = class {
17965
17963
  process8();
17966
17964
  return results;
17967
17965
  }
17968
- chdir(path3 = this.cwd) {
17966
+ chdir(path4 = this.cwd) {
17969
17967
  const oldCwd = this.cwd;
17970
- this.cwd = typeof path3 === "string" ? this.cwd.resolve(path3) : path3;
17968
+ this.cwd = typeof path4 === "string" ? this.cwd.resolve(path4) : path4;
17971
17969
  this.cwd[setAsCwd](oldCwd);
17972
17970
  }
17973
17971
  };
@@ -18323,8 +18321,8 @@ var MatchRecord = class {
18323
18321
  }
18324
18322
  // match, absolute, ifdir
18325
18323
  entries() {
18326
- return [...this.store.entries()].map(([path3, n]) => [
18327
- path3,
18324
+ return [...this.store.entries()].map(([path4, n]) => [
18325
+ path4,
18328
18326
  !!(n & 2),
18329
18327
  !!(n & 1)
18330
18328
  ]);
@@ -18529,9 +18527,9 @@ var GlobUtil = class {
18529
18527
  signal;
18530
18528
  maxDepth;
18531
18529
  includeChildMatches;
18532
- constructor(patterns, path3, opts) {
18530
+ constructor(patterns, path4, opts) {
18533
18531
  this.patterns = patterns;
18534
- this.path = path3;
18532
+ this.path = path4;
18535
18533
  this.opts = opts;
18536
18534
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
18537
18535
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -18550,11 +18548,11 @@ var GlobUtil = class {
18550
18548
  });
18551
18549
  }
18552
18550
  }
18553
- #ignored(path3) {
18554
- return this.seen.has(path3) || !!this.#ignore?.ignored?.(path3);
18551
+ #ignored(path4) {
18552
+ return this.seen.has(path4) || !!this.#ignore?.ignored?.(path4);
18555
18553
  }
18556
- #childrenIgnored(path3) {
18557
- return !!this.#ignore?.childrenIgnored?.(path3);
18554
+ #childrenIgnored(path4) {
18555
+ return !!this.#ignore?.childrenIgnored?.(path4);
18558
18556
  }
18559
18557
  // backpressure mechanism
18560
18558
  pause() {
@@ -18769,8 +18767,8 @@ var GlobUtil = class {
18769
18767
  };
18770
18768
  var GlobWalker = class extends GlobUtil {
18771
18769
  matches = /* @__PURE__ */ new Set();
18772
- constructor(patterns, path3, opts) {
18773
- super(patterns, path3, opts);
18770
+ constructor(patterns, path4, opts) {
18771
+ super(patterns, path4, opts);
18774
18772
  }
18775
18773
  matchEmit(e) {
18776
18774
  this.matches.add(e);
@@ -18807,8 +18805,8 @@ var GlobWalker = class extends GlobUtil {
18807
18805
  };
18808
18806
  var GlobStream = class extends GlobUtil {
18809
18807
  results;
18810
- constructor(patterns, path3, opts) {
18811
- super(patterns, path3, opts);
18808
+ constructor(patterns, path4, opts) {
18809
+ super(patterns, path4, opts);
18812
18810
  this.results = new Minipass({
18813
18811
  signal: this.signal,
18814
18812
  objectMode: true
@@ -19101,7 +19099,7 @@ var glob = Object.assign(glob_, {
19101
19099
  });
19102
19100
  glob.glob = glob;
19103
19101
 
19104
- // node_modules/.pnpm/@aomex+console@3.2.0_@aomex+core@3.2.0_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
19102
+ // node_modules/.pnpm/@aomex+console@3.2.2_@aomex+core@3.2.2_@types+node@20.14.12_typescript@5.5.4_/node_modules/@aomex/console/dist/index.js
19105
19103
  i18n.register("zh_CN", "console", {
19106
19104
  command_not_found: '\u6307\u4EE4 "{{command}}" \u4E0D\u5B58\u5728',
19107
19105
  command_found_recommended: '\u6307\u4EE4 "{{command}}" \u4E0D\u5B58\u5728\uFF0C\u4F60\u662F\u8BF4 "aomex {{recommended}}" \u5417\uFF1F',
@@ -19202,7 +19200,7 @@ var Terminal = class {
19202
19200
  * @link https://www.npmjs.com/package/table
19203
19201
  */
19204
19202
  generateTable(data, config) {
19205
- return (0, import_table.table)(data, config);
19203
+ return (0, import_table.table)(data, config).replace(/\n$/, "");
19206
19204
  }
19207
19205
  /**
19208
19206
  * 打印对象,自动展开深层级属性
@@ -19318,8 +19316,18 @@ var Terminal = class {
19318
19316
  task.status = status;
19319
19317
  statusChanged = true;
19320
19318
  },
19321
- title: task.title,
19322
- suffix: task.suffix
19319
+ get title() {
19320
+ return task.title;
19321
+ },
19322
+ set title(t) {
19323
+ task.title = t;
19324
+ },
19325
+ get suffix() {
19326
+ return task.suffix;
19327
+ },
19328
+ set suffix(s) {
19329
+ task.suffix = s;
19330
+ }
19323
19331
  });
19324
19332
  if (!statusChanged) {
19325
19333
  task.status = "success";
@@ -19384,28 +19392,111 @@ var Terminal = class {
19384
19392
  var terminal2 = new Terminal();
19385
19393
 
19386
19394
  // src/index.ts
19387
- import { execSync, spawn } from "node:child_process";
19395
+ import { execSync as execSync2, spawn } from "node:child_process";
19396
+ import { setTimeout as setTimeout2 } from "node:timers/promises";
19397
+
19398
+ // src/input-project.ts
19399
+ import { input } from "@inquirer/prompts";
19400
+ import { existsSync, readdirSync as readdirSync3 } from "node:fs";
19388
19401
  import kebabCase from "lodash.kebabcase";
19389
- var argv = yargsParser(process.argv.slice(2));
19390
- var templateDir = path2.join(import.meta.dirname, "..", "templates");
19391
- var projectName = kebabCase(argv["project"] || "my-aomex-project");
19392
- var targetDir = path2.resolve(projectName);
19393
- if (existsSync(targetDir)) {
19394
- terminal2.printError(`\u76EE\u5F55 "${targetDir}" \u5DF2\u5B58\u5728\uFF01`);
19395
- process.exit(1);
19396
- }
19397
- var nodeVersion = process.versions.node;
19398
- var packageManager = "pnpm";
19399
- for (const item of ["pnpm", "npm", "yarn"]) {
19400
- if (argv[item]) {
19401
- packageManager = item;
19402
- break;
19402
+ import path2 from "path";
19403
+ var inputProject = async (argv2) => {
19404
+ let projectName2 = argv2["project"];
19405
+ if (projectName2) {
19406
+ projectName2 = kebabCase(projectName2);
19407
+ const available = isProjectDirAvailable(projectName2);
19408
+ if (typeof available === "string") {
19409
+ terminal2.printError(available);
19410
+ process.exit(1);
19411
+ }
19412
+ } else {
19413
+ projectName2 = await input({
19414
+ message: "\u8BF7\u8F93\u5165\u9879\u76EE",
19415
+ validate(value) {
19416
+ return isProjectDirAvailable(value);
19417
+ },
19418
+ transformer(value) {
19419
+ return kebabCase(value);
19420
+ }
19421
+ });
19403
19422
  }
19404
- }
19405
- var packageManagerVersion = execSync(
19406
- packageManager === "npm" ? "npm -v" : `npm view ${packageManager} version`,
19407
- { encoding: "utf8" }
19408
- ).replaceAll("\n", "") || "0.0.0";
19423
+ return projectName2;
19424
+ };
19425
+ var isProjectDirAvailable = (projectName2) => {
19426
+ projectName2 = projectName2.trim();
19427
+ if (!projectName2.trim()) return "\u9879\u76EE\u540D\u4E0D\u80FD\u4E3A\u7A7A";
19428
+ const targetDir2 = path2.resolve(projectName2);
19429
+ if (!existsSync(targetDir2)) return true;
19430
+ if (!readdirSync3(targetDir2).length) return true;
19431
+ return `\u76EE\u5F55 "${targetDir2}" \u5305\u542B\u5176\u5B83\u6587\u4EF6\uFF0C\u8BF7\u624B\u52A8\u5220\u9664\u6216\u9009\u62E9\u65B0\u7684\u9879\u76EE\u540D`;
19432
+ };
19433
+
19434
+ // src/select-package-manager.ts
19435
+ import { select } from "@inquirer/prompts";
19436
+ import { execSync } from "node:child_process";
19437
+ var packageManagers = ["pnpm", "npm", "yarn"];
19438
+ var selectPackageManager = async (argv2) => {
19439
+ let packageManager2;
19440
+ for (const item of ["pnpm", "npm", "yarn"]) {
19441
+ if (argv2[item]) {
19442
+ packageManager2 = item;
19443
+ break;
19444
+ }
19445
+ }
19446
+ if (!packageManager2) {
19447
+ packageManager2 = await select({
19448
+ message: "\u8BF7\u9009\u62E9\u5305\u7BA1\u7406\u5668",
19449
+ default: "pnpm",
19450
+ choices: packageManagers
19451
+ });
19452
+ }
19453
+ const packageManagerVersion2 = execSync(
19454
+ packageManager2 === "npm" ? "npm -v" : `npm view ${packageManager2} version`,
19455
+ { encoding: "utf8" }
19456
+ ).replaceAll("\n", "") || "0.0.0";
19457
+ return { packageManager: packageManager2, packageManagerVersion: packageManagerVersion2 };
19458
+ };
19459
+
19460
+ // src/select-node-version.ts
19461
+ import { select as select2 } from "@inquirer/prompts";
19462
+ var selectNodeVersion = async (argv2) => {
19463
+ let nodeVersion2 = argv2["node"];
19464
+ if (!nodeVersion2) {
19465
+ const nodes = await promise;
19466
+ nodeVersion2 = await select2({
19467
+ message: "\u8BF7\u9009\u62E9node.js\u7A33\u5B9A\u7248\u672C",
19468
+ choices: nodes.map((item) => {
19469
+ return {
19470
+ name: `${item.version} ${terminal2.style(["gray", "dim"], item.date)}`,
19471
+ value: item.version,
19472
+ short: item.version
19473
+ };
19474
+ }),
19475
+ loop: false
19476
+ });
19477
+ }
19478
+ return nodeVersion2.replace(/^v/, "");
19479
+ };
19480
+ var fetchNodes = async () => {
19481
+ const response = await fetch(
19482
+ "https://nodejs.org/download/release/index.json"
19483
+ );
19484
+ const nodes = await response.json();
19485
+ return nodes.map((item) => {
19486
+ return {
19487
+ ...item,
19488
+ versions: item.version.slice(1).split(".").map(Number)
19489
+ };
19490
+ }).filter((item) => {
19491
+ if (!item.lts) return false;
19492
+ if (item.versions[0] === 20 && item.versions[1] >= 13) return true;
19493
+ if (item.versions[0] >= 22) return true;
19494
+ return false;
19495
+ });
19496
+ };
19497
+ var promise = fetchNodes();
19498
+
19499
+ // src/index.ts
19409
19500
  var runShell = async (command2) => {
19410
19501
  await new Promise((resolve4, reject) => {
19411
19502
  const stream3 = spawn(command2, {
@@ -19417,16 +19508,21 @@ var runShell = async (command2) => {
19417
19508
  stream3.on("error", reject);
19418
19509
  });
19419
19510
  };
19420
- var sleep = () => new Promise((resolve4) => setTimeout(resolve4, 500));
19511
+ var argv = yargsParser(process.argv.slice(2));
19512
+ var templateDir = path3.join(import.meta.dirname, "..", "templates");
19513
+ var projectName = await inputProject(argv);
19514
+ var { packageManager, packageManagerVersion } = await selectPackageManager(
19515
+ argv
19516
+ );
19517
+ var nodeVersion = await selectNodeVersion(argv);
19518
+ var targetDir = path3.resolve(projectName);
19421
19519
  var { error: error2 } = await terminal2.runTasks([
19422
19520
  {
19423
19521
  title: "\u521B\u5EFA\u76EE\u5F55",
19424
19522
  task: async () => {
19425
- if (existsSync(targetDir)) {
19426
- await rm(targetDir, { recursive: true, force: true });
19427
- }
19428
19523
  await mkdir(targetDir, { recursive: true });
19429
- process.chdir(path2.resolve(projectName));
19524
+ process.chdir(targetDir);
19525
+ await setTimeout2(500);
19430
19526
  }
19431
19527
  },
19432
19528
  {
@@ -19441,32 +19537,32 @@ var { error: error2 } = await terminal2.runTasks([
19441
19537
  await cp(templateDir, targetDir, { recursive: true });
19442
19538
  const files = await readdir2(targetDir, { recursive: true });
19443
19539
  for (const file of files) {
19444
- const isFile = (await stat(path2.join(targetDir, file))).isFile();
19540
+ const isFile = (await stat(path3.join(targetDir, file))).isFile();
19445
19541
  if (!isFile) continue;
19446
- const fileAbsolutePath = path2.resolve(file);
19542
+ const fileAbsolutePath = path3.resolve(file);
19447
19543
  let fileContent = await readFile(fileAbsolutePath, "utf8");
19448
19544
  Object.entries(variables).forEach(([key, value]) => {
19449
19545
  fileContent = fileContent.replaceAll(`{{${key}}}`, value);
19450
19546
  });
19451
19547
  await writeFile2(fileAbsolutePath, fileContent);
19452
19548
  }
19453
- await sleep();
19549
+ await setTimeout2(500);
19454
19550
  }
19455
19551
  },
19456
19552
  {
19457
19553
  title: "git\u521D\u59CB\u5316",
19458
19554
  skip: async () => {
19459
- return !/\d\.\d/.test(execSync("git -v", { encoding: "utf8" }));
19555
+ return !/\d\.\d/.test(execSync2("git -v", { encoding: "utf8" }));
19460
19556
  },
19461
19557
  task: async () => {
19462
19558
  await runShell("git init");
19463
- await sleep();
19559
+ await setTimeout2(500);
19464
19560
  }
19465
19561
  },
19466
19562
  {
19467
19563
  title: "\u589E\u52A0volta\u914D\u7F6E",
19468
19564
  skip: async () => {
19469
- return !/\d\.\d/.test(execSync("volta -v", { encoding: "utf8" }));
19565
+ return !/\d\.\d/.test(execSync2("volta -v", { encoding: "utf8" }));
19470
19566
  },
19471
19567
  task: async () => {
19472
19568
  await runShell(`volta pin node@${nodeVersion}`);
@@ -19537,7 +19633,6 @@ var { error: error2 } = await terminal2.runTasks([
19537
19633
  title: "\u751F\u6210prisma\u5BA2\u6237\u7AEF",
19538
19634
  task: async () => {
19539
19635
  await runShell("npx prisma generate");
19540
- await sleep();
19541
19636
  }
19542
19637
  }
19543
19638
  ]);