zixulu 1.76.2 → 1.76.3

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.
Files changed (89) hide show
  1. package/dist/index.js +40 -41
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/constant/index.d.ts +1 -1
  4. package/dist/src/utils/getFiles.d.ts +2 -2
  5. package/package.json +1 -1
  6. package/src/constant/index.ts +1 -1
  7. package/src/utils/addAntd.ts +2 -2
  8. package/src/utils/addApi.ts +3 -3
  9. package/src/utils/addBuildDocker.ts +3 -3
  10. package/src/utils/addGitAttributes.ts +1 -1
  11. package/src/utils/addHusky.ts +1 -1
  12. package/src/utils/addOpenWith.ts +2 -2
  13. package/src/utils/addPathAlias.ts +2 -2
  14. package/src/utils/addPostCSSConfig.ts +1 -1
  15. package/src/utils/addPrettier.ts +2 -2
  16. package/src/utils/addPrisma.ts +1 -1
  17. package/src/utils/addRuleToGitIgnore.ts +1 -1
  18. package/src/utils/addStartScript.ts +12 -12
  19. package/src/utils/addSyncPackageScript.ts +4 -4
  20. package/src/utils/addTailwindConfig.ts +1 -1
  21. package/src/utils/addTailwindToCss.ts +2 -2
  22. package/src/utils/addZipDist.ts +2 -2
  23. package/src/utils/arrowToFunction.ts +1 -1
  24. package/src/utils/backupFirst.ts +1 -1
  25. package/src/utils/code2Snippet.ts +2 -2
  26. package/src/utils/createBrowserlistrc.ts +1 -1
  27. package/src/utils/createEntryCss.ts +2 -2
  28. package/src/utils/createPrismaDebugger.ts +2 -2
  29. package/src/utils/download.ts +3 -3
  30. package/src/utils/downloadBun.ts +2 -2
  31. package/src/utils/downloadDeskGo.ts +2 -2
  32. package/src/utils/downloadFromWinget.ts +2 -2
  33. package/src/utils/downloadGeekUninstaller.ts +2 -2
  34. package/src/utils/downloadLatestSoftware.ts +1 -1
  35. package/src/utils/downloadNpm.ts +2 -2
  36. package/src/utils/downloadVscodeExts.ts +1 -1
  37. package/src/utils/gdm.ts +5 -5
  38. package/src/utils/getEntryCssDir.ts +2 -2
  39. package/src/utils/getFiles.ts +3 -3
  40. package/src/utils/getPackageJsonPath.ts +1 -1
  41. package/src/utils/getPackageManager.ts +1 -1
  42. package/src/utils/getTsConfigPath.ts +2 -2
  43. package/src/utils/getTsFile.ts +2 -2
  44. package/src/utils/hasAntiGravity.ts +3 -3
  45. package/src/utils/hasCode.ts +3 -3
  46. package/src/utils/hasCursor.ts +3 -3
  47. package/src/utils/initNode.ts +2 -2
  48. package/src/utils/installDocker.ts +1 -1
  49. package/src/utils/interfaceToType.ts +1 -1
  50. package/src/utils/json2type.ts +1 -1
  51. package/src/utils/killProcessByPort.ts +1 -1
  52. package/src/utils/pnpm.ts +2 -2
  53. package/src/utils/readBunConfig.ts +4 -4
  54. package/src/utils/readPackageJson.ts +1 -1
  55. package/src/utils/readPackageJsonSync.ts +1 -1
  56. package/src/utils/readTsConfig.ts +1 -1
  57. package/src/utils/readZixuluCache.ts +4 -4
  58. package/src/utils/readZixuluSetting.ts +4 -4
  59. package/src/utils/reinstall.ts +1 -1
  60. package/src/utils/removeComment.ts +1 -1
  61. package/src/utils/removeESLint.ts +1 -1
  62. package/src/utils/removeFileOrFolderFromGit.ts +1 -1
  63. package/src/utils/removeLock.ts +1 -1
  64. package/src/utils/removeOpenWith.ts +1 -1
  65. package/src/utils/removeZixuluCache.ts +3 -3
  66. package/src/utils/replaceAssets.ts +4 -4
  67. package/src/utils/replaceCommitMessage.ts +3 -3
  68. package/src/utils/rollup.ts +2 -2
  69. package/src/utils/rsbuild.ts +1 -1
  70. package/src/utils/rslib.ts +1 -1
  71. package/src/utils/serverToAction.ts +2 -2
  72. package/src/utils/setDockerRegistry.ts +1 -1
  73. package/src/utils/setFatherConfig.ts +1 -1
  74. package/src/utils/setTsConfig.ts +1 -1
  75. package/src/utils/syncAgentRules.ts +3 -3
  76. package/src/utils/syncEditorSetting.ts +4 -4
  77. package/src/utils/syncVscode.ts +7 -7
  78. package/src/utils/tailwindPatch.ts +1 -1
  79. package/src/utils/tar.ts +1 -1
  80. package/src/utils/updateDockerCompose.ts +1 -1
  81. package/src/utils/upgradeTailwind.ts +1 -1
  82. package/src/utils/upgradeWorkspaceDependceny.ts +3 -3
  83. package/src/utils/verdaccio.ts +4 -4
  84. package/src/utils/writeBunConfig.ts +3 -3
  85. package/src/utils/writeJson.ts +1 -1
  86. package/src/utils/writeRsbuildConfig.ts +1 -1
  87. package/src/utils/writeTsConfig.ts +1 -1
  88. package/src/utils/writeZixuluCache.ts +3 -3
  89. package/src/utils/writeZixuluSetting.ts +3 -3
package/dist/index.js CHANGED
@@ -5,24 +5,23 @@ import consola_0, { consola } from "consola";
5
5
  import { capitalize, emailReg, getEnumEntries, getEnumKeys, getEnumValues, isNonNullable, json2type } from "deepsea-tools";
6
6
  import { compress, execAsync, isPathLike, setDefaultOptions, spawnAsync, unzip, zip } from "soda-nodejs";
7
7
  import inquirer_0 from "inquirer";
8
- import { chdir, cwd as external_process_cwd, exit } from "process";
9
- import { copyFile, mkdir, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
10
- import { join, parse, resolve as external_path_resolve } from "path";
8
+ import { chdir, cwd as external_node_process_cwd, exit } from "node:process";
9
+ import { copyFile, mkdir, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
10
+ import { join, parse, resolve as external_node_path_resolve } from "node:path";
11
11
  import node_fetch, { Headers as external_node_fetch_Headers } from "node-fetch";
12
12
  import semver from "semver";
13
13
  import { HttpsProxyAgent } from "https-proxy-agent";
14
- import { createWriteStream, existsSync, readFileSync } from "fs";
15
- import { homedir, tmpdir } from "os";
14
+ import { createWriteStream, existsSync, readFileSync } from "node:fs";
15
+ import { homedir, tmpdir } from "node:os";
16
16
  import { parse as toml_parse, stringify } from "@iarna/toml";
17
- import { writeFile as promises_writeFile } from "node:fs/promises";
18
17
  import simple_git, { simpleGit } from "simple-git";
19
18
  import json5 from "json5";
20
19
  import dayjs from "dayjs";
21
20
  import clipboardy from "clipboardy";
22
21
  import yaml_0 from "yaml";
23
- import { Readable } from "stream";
22
+ import { Readable } from "node:stream";
24
23
  import { JSDOM } from "jsdom";
25
- import { exec } from "child_process";
24
+ import { exec } from "node:child_process";
26
25
  import md5 from "md5";
27
26
  import { applyEdits, modify } from "jsonc-parser";
28
27
  async function addGitCommit(messageOrParams) {
@@ -829,9 +828,9 @@ ${insertWhen(versions.includes("custom"), 'import consola from "consola"', {
829
828
  breakBefore: true
830
829
  })}${insertWhen("Day.js version" === versionSource, 'import dayjs from "dayjs"', {
831
830
  breakBefore: true
832
- })}${insertWhen("package.json version" === versionSource, 'import { readFile } from "fs/promises"', {
831
+ })}${insertWhen("package.json version" === versionSource, 'import { readFile } from "node:fs/promises"', {
833
832
  breakBefore: true
834
- })}${insertWhen(local, 'import { join } from "path"', {
833
+ })}${insertWhen(local, 'import { join } from "node:path"', {
835
834
  breakBefore: true
836
835
  })}
837
836
  import { spawnAsync } from "soda-nodejs"
@@ -1133,7 +1132,7 @@ async function addEslint() {
1133
1132
  const config = getEslintConfig({
1134
1133
  isReact
1135
1134
  });
1136
- await promises_writeFile("eslint.config.mjs", config);
1135
+ await writeFile("eslint.config.mjs", config);
1137
1136
  const packages = [
1138
1137
  "@eslint/js",
1139
1138
  "eslint",
@@ -1274,7 +1273,7 @@ function getTsFile(path) {
1274
1273
  throw new Error(`找不到 ${path} 对应的 ts 或 tsx 文件`);
1275
1274
  }
1276
1275
  function getTsConfigJsonPath(path) {
1277
- return join(path ?? external_process_cwd(), "tsconfig.json");
1276
+ return join(path ?? external_node_process_cwd(), "tsconfig.json");
1278
1277
  }
1279
1278
  async function readTsConfig(path) {
1280
1279
  try {
@@ -1414,7 +1413,7 @@ const config = {
1414
1413
  plugins: ["@1adybug/prettier"],
1415
1414
  controlStatementBraces: "add",
1416
1415
  multiLineBraces: "add",
1417
- nodeProtocol: true,
1416
+ nodeProtocol: "add",
1418
1417
  }
1419
1418
 
1420
1419
  export default config
@@ -1499,10 +1498,10 @@ async function addPrisma(manager) {
1499
1498
  consola_0.success("添加 Prisma 配置成功");
1500
1499
  }
1501
1500
  const addStartScript_script = `// @ts-check
1502
- import { spawn } from "child_process"
1501
+ import { spawn } from "node:child_process"
1503
1502
  import { config } from "dotenv"
1504
- import { readFile } from "fs/promises"
1505
- import { cpus } from "os"
1503
+ import { readFile } from "node:fs/promises"
1504
+ import { cpus } from "node:os"
1506
1505
 
1507
1506
  config()
1508
1507
 
@@ -1523,11 +1522,11 @@ import compression from "compression"
1523
1522
  import cors from "cors"
1524
1523
  import { config } from "dotenv"
1525
1524
  import express from "express"
1526
- import { readFileSync } from "fs"
1527
- import { createServer as createHttpServer } from "http"
1528
- import { createServer as createHttpsServer } from "https"
1525
+ import { readFileSync } from "node:fs"
1526
+ import { createServer as createHttpServer } from "node:http"
1527
+ import { createServer as createHttpsServer } from "node:https"
1529
1528
  import morgan from "morgan"
1530
- import { join, resolve } from "path"
1529
+ import { join, resolve } from "node:path"
1531
1530
 
1532
1531
  config()
1533
1532
 
@@ -1576,12 +1575,12 @@ import compression from "compression"
1576
1575
  import cors from "cors"
1577
1576
  import { config } from "dotenv"
1578
1577
  import express from "express"
1579
- import { readFileSync } from "fs"
1580
- import { createServer as createHttpServer } from "http"
1581
- import { createServer as createHttpsServer } from "https"
1578
+ import { readFileSync } from "node:fs"
1579
+ import { createServer as createHttpServer } from "node:http"
1580
+ import { createServer as createHttpsServer } from "node:https"
1582
1581
  import morgan from "morgan"
1583
1582
  import next from "next"
1584
- import { join } from "path"
1583
+ import { join } from "node:path"
1585
1584
 
1586
1585
  config()
1587
1586
 
@@ -1703,8 +1702,8 @@ function syncPackage(packageName) {
1703
1702
  }
1704
1703
 
1705
1704
  ${monorepo ? `async function main() {
1706
- const { readdir, readFile, stat } = await import("fs/promises")
1707
- const { join } = await import("path")
1705
+ const { readdir, readFile, stat } = await import("node:fs/promises")
1706
+ const { join } = await import("node:path")
1708
1707
  const dir = "${dir}"
1709
1708
  const dir2 = await readdir(dir)
1710
1709
  /** @type {string[]} */
@@ -1720,7 +1719,7 @@ ${monorepo ? `async function main() {
1720
1719
  }
1721
1720
  await Promise.all(packages2.map(syncPackage))
1722
1721
  }` : `async function main() {
1723
- const { readFile } = await import("fs/promises")
1722
+ const { readFile } = await import("node:fs/promises")
1724
1723
  const packageJson = JSON.parse(await readFile("package.json", "utf-8"))
1725
1724
  await syncPackage(packageJson.name)
1726
1725
  }`}
@@ -1990,7 +1989,7 @@ async function addTailwind() {
1990
1989
  consola_0.success("添加 tailwind 配置成功");
1991
1990
  }
1992
1991
  const zipDistContent = `// @ts-check
1993
- import { rm } from "fs/promises"
1992
+ import { rm } from "node:fs/promises"
1994
1993
  import { zip } from "soda-nodejs"
1995
1994
 
1996
1995
  const filename = process.env.FILENAME || "dist.zip"
@@ -2742,7 +2741,7 @@ async function getHeaders() {
2742
2741
  });
2743
2742
  await clipboardy.write(result.join("\n"));
2744
2743
  }
2745
- const { name: initNode_name } = parse(external_path_resolve("."));
2744
+ const { name: initNode_name } = parse(external_node_path_resolve("."));
2746
2745
  const initNode_packageJson = `{
2747
2746
  "name": "${initNode_name}",
2748
2747
  "version": "1.0.0",
@@ -4694,10 +4693,10 @@ async function syncVscode() {
4694
4693
  if (options.includes("SETTING") || options.includes("EXTENSION")) {
4695
4694
  const script = `// @ts-check
4696
4695
 
4697
- import { spawn } from "child_process"
4698
- import { readdir, copyFile, rm } from "fs/promises"
4699
- import { homedir } from "os"
4700
- import { join } from "path"
4696
+ import { spawn } from "node:child_process"
4697
+ import { readdir, copyFile, rm } from "node:fs/promises"
4698
+ import { homedir } from "node:os"
4699
+ import { join } from "node:path"
4701
4700
 
4702
4701
  /**
4703
4702
  * @param {string} command
@@ -5013,7 +5012,7 @@ async function upgradeTailwind() {
5013
5012
  }
5014
5013
  async function upgradeWorkspaceDependceny() {
5015
5014
  const { dir, ...rest } = await getUpgradeDependencyConfig();
5016
- const dir2 = external_path_resolve(dir);
5015
+ const dir2 = external_node_path_resolve(dir);
5017
5016
  const packages = await readdir(dir2);
5018
5017
  const packages2 = [];
5019
5018
  for (const pkg of packages){
@@ -5044,8 +5043,8 @@ async function upgradeWorkspaceDependceny() {
5044
5043
  }))();
5045
5044
  }
5046
5045
  }
5047
- const verdaccio_script = `import { spawnSync } from "child_process"
5048
- import { rmSync } from "fs"
5046
+ const verdaccio_script = `import { spawnSync } from "node:child_process"
5047
+ import { rmSync } from "node:fs"
5049
5048
 
5050
5049
  spawnSync("docker compose down", { cwd: "verdaccio", shell: true, stdio: "inherit" })
5051
5050
 
@@ -5076,7 +5075,7 @@ async function verdaccio() {
5076
5075
  default: setting.verdaccioPath
5077
5076
  });
5078
5077
  verdaccioPath = verdaccioPath.replace(/^"|"$/g, "");
5079
- verdaccioPath = external_path_resolve(verdaccioPath);
5078
+ verdaccioPath = external_node_path_resolve(verdaccioPath);
5080
5079
  const stats = await stat(verdaccioPath);
5081
5080
  if (!stats.isDirectory()) throw new Error("verdaccio 文件夹不存在");
5082
5081
  setting.verdaccioPath = verdaccioPath;
@@ -5099,7 +5098,7 @@ async function winget() {
5099
5098
  }
5100
5099
  async function addOpenWith(path, { file, folder, background }) {
5101
5100
  if (!file && !folder && !background) throw new Error("至少选择一个");
5102
- path = external_path_resolve(path);
5101
+ path = external_node_path_resolve(path);
5103
5102
  try {
5104
5103
  const status = await stat(path);
5105
5104
  if (!status.isFile()) throw new Error("路径不是文件");
@@ -5134,9 +5133,9 @@ async function addOpenWith(path, { file, folder, background }) {
5134
5133
  }
5135
5134
  const gdm_script = `// @ts-check
5136
5135
 
5137
- import { spawnSync } from "child_process"
5138
- import { readdirSync, renameSync, rmSync } from "fs"
5139
- import { styleText } from "util"
5136
+ import { spawnSync } from "node:child_process"
5137
+ import { readdirSync, renameSync, rmSync } from "node:fs"
5138
+ import { styleText } from "node:util"
5140
5139
 
5141
5140
  const dir = readdirSync(".")
5142
5141