zixulu 1.76.1 → 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.
- package/dist/index.js +41 -43
- package/dist/index.js.map +1 -1
- package/dist/src/constant/index.d.ts +1 -1
- package/dist/src/utils/getFiles.d.ts +2 -2
- package/package.json +1 -1
- package/src/constant/index.ts +1 -1
- package/src/utils/addAntd.ts +2 -2
- package/src/utils/addApi.ts +3 -3
- package/src/utils/addBuildDocker.ts +3 -3
- package/src/utils/addGitAttributes.ts +1 -1
- package/src/utils/addHusky.ts +1 -1
- package/src/utils/addOpenWith.ts +2 -2
- package/src/utils/addPathAlias.ts +2 -2
- package/src/utils/addPostCSSConfig.ts +1 -1
- package/src/utils/addPrettier.ts +2 -2
- package/src/utils/addPrisma.ts +1 -1
- package/src/utils/addRuleToGitIgnore.ts +1 -1
- package/src/utils/addStartScript.ts +12 -12
- package/src/utils/addSyncPackageScript.ts +4 -4
- package/src/utils/addTailwindConfig.ts +1 -1
- package/src/utils/addTailwindToCss.ts +2 -2
- package/src/utils/addZipDist.ts +2 -2
- package/src/utils/arrowToFunction.ts +1 -1
- package/src/utils/backupFirst.ts +1 -1
- package/src/utils/code2Snippet.ts +2 -2
- package/src/utils/createBrowserlistrc.ts +1 -1
- package/src/utils/createEntryCss.ts +2 -2
- package/src/utils/createPrismaDebugger.ts +2 -2
- package/src/utils/download.ts +3 -3
- package/src/utils/downloadBun.ts +2 -2
- package/src/utils/downloadDeskGo.ts +2 -2
- package/src/utils/downloadFromWinget.ts +2 -2
- package/src/utils/downloadGeekUninstaller.ts +2 -2
- package/src/utils/downloadLatestSoftware.ts +1 -1
- package/src/utils/downloadNpm.ts +2 -2
- package/src/utils/downloadVscodeExts.ts +1 -1
- package/src/utils/gdm.ts +5 -5
- package/src/utils/getEntryCssDir.ts +2 -2
- package/src/utils/getFiles.ts +3 -3
- package/src/utils/getPackageJsonPath.ts +1 -1
- package/src/utils/getPackageManager.ts +1 -1
- package/src/utils/getTsConfigPath.ts +2 -2
- package/src/utils/getTsFile.ts +2 -2
- package/src/utils/hasAntiGravity.ts +3 -3
- package/src/utils/hasCode.ts +3 -3
- package/src/utils/hasCursor.ts +3 -3
- package/src/utils/initNode.ts +2 -2
- package/src/utils/installDocker.ts +1 -1
- package/src/utils/interfaceToType.ts +1 -1
- package/src/utils/json2type.ts +1 -1
- package/src/utils/killProcessByPort.ts +1 -1
- package/src/utils/pnpm.ts +2 -2
- package/src/utils/readBunConfig.ts +4 -4
- package/src/utils/readPackageJson.ts +1 -1
- package/src/utils/readPackageJsonSync.ts +1 -1
- package/src/utils/readTsConfig.ts +1 -1
- package/src/utils/readZixuluCache.ts +4 -4
- package/src/utils/readZixuluSetting.ts +4 -4
- package/src/utils/reinstall.ts +1 -1
- package/src/utils/removeComment.ts +1 -1
- package/src/utils/removeESLint.ts +1 -1
- package/src/utils/removeFileOrFolderFromGit.ts +1 -1
- package/src/utils/removeLock.ts +1 -1
- package/src/utils/removeOpenWith.ts +1 -1
- package/src/utils/removeZixuluCache.ts +3 -3
- package/src/utils/replaceAssets.ts +4 -4
- package/src/utils/replaceCommitMessage.ts +3 -3
- package/src/utils/rollup.ts +2 -2
- package/src/utils/rsbuild.ts +1 -1
- package/src/utils/rslib.ts +1 -1
- package/src/utils/serverToAction.ts +2 -2
- package/src/utils/setDockerRegistry.ts +1 -1
- package/src/utils/setFatherConfig.ts +1 -1
- package/src/utils/setTsConfig.ts +1 -1
- package/src/utils/syncAgentRules.ts +3 -3
- package/src/utils/syncEditorSetting.ts +4 -4
- package/src/utils/syncVscode.ts +7 -7
- package/src/utils/tailwindPatch.ts +1 -1
- package/src/utils/tar.ts +1 -1
- package/src/utils/updateDockerCompose.ts +2 -5
- package/src/utils/upgradeTailwind.ts +1 -1
- package/src/utils/upgradeWorkspaceDependceny.ts +3 -3
- package/src/utils/verdaccio.ts +4 -4
- package/src/utils/writeBunConfig.ts +3 -3
- package/src/utils/writeJson.ts +1 -1
- package/src/utils/writeRsbuildConfig.ts +1 -1
- package/src/utils/writeTsConfig.ts +1 -1
- package/src/utils/writeZixuluCache.ts +3 -3
- 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
|
|
9
|
-
import { copyFile, mkdir, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
|
|
10
|
-
import { join, parse, resolve as
|
|
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
|
|
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 ??
|
|
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:
|
|
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(
|
|
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
|
|
@@ -4818,8 +4817,8 @@ async function updateDockerCompose() {
|
|
|
4818
4817
|
const content = await readFile(file, "utf-8");
|
|
4819
4818
|
const data = yaml_0.parse(content);
|
|
4820
4819
|
const images = Object.values(data.services).map((service)=>service.image);
|
|
4821
|
-
consola_0.start("开始更新镜像");
|
|
4822
4820
|
for (const image of images){
|
|
4821
|
+
consola_0.start(`开始更新镜像 ${image}`);
|
|
4823
4822
|
const match = image.match(/^(.+):(.+)$/);
|
|
4824
4823
|
const name = match ? match[1] : image;
|
|
4825
4824
|
const tag = match ? match[2] : "latest";
|
|
@@ -4834,7 +4833,6 @@ async function updateDockerCompose() {
|
|
|
4834
4833
|
});
|
|
4835
4834
|
consola_0.info(`更新镜像 ${image} 完成`);
|
|
4836
4835
|
}
|
|
4837
|
-
consola_0.success("更新镜像完成");
|
|
4838
4836
|
await spawnAsync("docker compose down", {
|
|
4839
4837
|
shell: true,
|
|
4840
4838
|
stdio: "inherit"
|
|
@@ -5014,7 +5012,7 @@ async function upgradeTailwind() {
|
|
|
5014
5012
|
}
|
|
5015
5013
|
async function upgradeWorkspaceDependceny() {
|
|
5016
5014
|
const { dir, ...rest } = await getUpgradeDependencyConfig();
|
|
5017
|
-
const dir2 =
|
|
5015
|
+
const dir2 = external_node_path_resolve(dir);
|
|
5018
5016
|
const packages = await readdir(dir2);
|
|
5019
5017
|
const packages2 = [];
|
|
5020
5018
|
for (const pkg of packages){
|
|
@@ -5045,8 +5043,8 @@ async function upgradeWorkspaceDependceny() {
|
|
|
5045
5043
|
}))();
|
|
5046
5044
|
}
|
|
5047
5045
|
}
|
|
5048
|
-
const verdaccio_script = `import { spawnSync } from "child_process"
|
|
5049
|
-
import { rmSync } from "fs"
|
|
5046
|
+
const verdaccio_script = `import { spawnSync } from "node:child_process"
|
|
5047
|
+
import { rmSync } from "node:fs"
|
|
5050
5048
|
|
|
5051
5049
|
spawnSync("docker compose down", { cwd: "verdaccio", shell: true, stdio: "inherit" })
|
|
5052
5050
|
|
|
@@ -5077,7 +5075,7 @@ async function verdaccio() {
|
|
|
5077
5075
|
default: setting.verdaccioPath
|
|
5078
5076
|
});
|
|
5079
5077
|
verdaccioPath = verdaccioPath.replace(/^"|"$/g, "");
|
|
5080
|
-
verdaccioPath =
|
|
5078
|
+
verdaccioPath = external_node_path_resolve(verdaccioPath);
|
|
5081
5079
|
const stats = await stat(verdaccioPath);
|
|
5082
5080
|
if (!stats.isDirectory()) throw new Error("verdaccio 文件夹不存在");
|
|
5083
5081
|
setting.verdaccioPath = verdaccioPath;
|
|
@@ -5100,7 +5098,7 @@ async function winget() {
|
|
|
5100
5098
|
}
|
|
5101
5099
|
async function addOpenWith(path, { file, folder, background }) {
|
|
5102
5100
|
if (!file && !folder && !background) throw new Error("至少选择一个");
|
|
5103
|
-
path =
|
|
5101
|
+
path = external_node_path_resolve(path);
|
|
5104
5102
|
try {
|
|
5105
5103
|
const status = await stat(path);
|
|
5106
5104
|
if (!status.isFile()) throw new Error("路径不是文件");
|
|
@@ -5135,9 +5133,9 @@ async function addOpenWith(path, { file, folder, background }) {
|
|
|
5135
5133
|
}
|
|
5136
5134
|
const gdm_script = `// @ts-check
|
|
5137
5135
|
|
|
5138
|
-
import { spawnSync } from "child_process"
|
|
5139
|
-
import { readdirSync, renameSync, rmSync } from "fs"
|
|
5140
|
-
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"
|
|
5141
5139
|
|
|
5142
5140
|
const dir = readdirSync(".")
|
|
5143
5141
|
|