zixulu 1.76.2 → 1.76.4
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 +69 -52
- package/dist/index.js.map +1 -1
- package/dist/src/constant/index.d.ts +1 -1
- package/dist/src/utils/addRuleToPrettierIgnore.d.ts +6 -0
- package/dist/src/utils/getFiles.d.ts +2 -2
- package/package.json +2 -2
- 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 +19 -13
- package/src/utils/addPrisma.ts +1 -1
- package/src/utils/addRuleToGitIgnore.ts +1 -1
- package/src/utils/addRuleToPrettierIgnore.ts +31 -0
- 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 +1 -1
- 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 {
|
|
@@ -1390,16 +1389,34 @@ async function addFolderPathAlias() {
|
|
|
1390
1389
|
})));
|
|
1391
1390
|
return getCommitMessage("feature", `add path alias: ${result.join(", ")}`);
|
|
1392
1391
|
}
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
.
|
|
1401
|
-
|
|
1402
|
-
|
|
1392
|
+
async function addRuleToPrettierIgnore(...rules) {
|
|
1393
|
+
const dir = await readdir(".");
|
|
1394
|
+
const message = getCommitMessage("feature", `添加 .prettierignore 规则 ${rules.join(", ")}`);
|
|
1395
|
+
if (!dir.includes(".prettierignore")) {
|
|
1396
|
+
await writeFile(".prettierignore", rules.join("\n"), "utf-8");
|
|
1397
|
+
return message;
|
|
1398
|
+
}
|
|
1399
|
+
const prettierIgnore = await readFile(".prettierignore", "utf-8");
|
|
1400
|
+
const rules2 = prettierIgnore.split("\n").map((v)=>v.trim());
|
|
1401
|
+
for (const rule of rules)if (!rules2.includes(rule)) rules2.push(rule);
|
|
1402
|
+
await writeFile(".prettierignore", rules2.join("\n"), "utf-8");
|
|
1403
|
+
return message;
|
|
1404
|
+
}
|
|
1405
|
+
const prettierIgnoreRules = [
|
|
1406
|
+
"node_modules",
|
|
1407
|
+
"public",
|
|
1408
|
+
"dist",
|
|
1409
|
+
"build",
|
|
1410
|
+
"generated",
|
|
1411
|
+
".next",
|
|
1412
|
+
".vscode",
|
|
1413
|
+
".generated",
|
|
1414
|
+
"**/components/ui/**",
|
|
1415
|
+
"**/components/ai/**",
|
|
1416
|
+
".agent",
|
|
1417
|
+
".cursor",
|
|
1418
|
+
"AGENTS.md"
|
|
1419
|
+
];
|
|
1403
1420
|
const prettierConfig = `// @ts-check
|
|
1404
1421
|
|
|
1405
1422
|
/**
|
|
@@ -1414,7 +1431,7 @@ const config = {
|
|
|
1414
1431
|
plugins: ["@1adybug/prettier"],
|
|
1415
1432
|
controlStatementBraces: "add",
|
|
1416
1433
|
multiLineBraces: "add",
|
|
1417
|
-
nodeProtocol:
|
|
1434
|
+
nodeProtocol: "add",
|
|
1418
1435
|
}
|
|
1419
1436
|
|
|
1420
1437
|
export default config
|
|
@@ -1422,7 +1439,7 @@ export default config
|
|
|
1422
1439
|
async function addPrettier() {
|
|
1423
1440
|
consola_0.start("开始添加 prettier 配置");
|
|
1424
1441
|
await writeFile("prettier.config.mjs", prettierConfig, "utf-8");
|
|
1425
|
-
await
|
|
1442
|
+
await addRuleToPrettierIgnore(...prettierIgnoreRules);
|
|
1426
1443
|
const config2 = {
|
|
1427
1444
|
package: [
|
|
1428
1445
|
"prettier",
|
|
@@ -1499,10 +1516,10 @@ async function addPrisma(manager) {
|
|
|
1499
1516
|
consola_0.success("添加 Prisma 配置成功");
|
|
1500
1517
|
}
|
|
1501
1518
|
const addStartScript_script = `// @ts-check
|
|
1502
|
-
import { spawn } from "child_process"
|
|
1519
|
+
import { spawn } from "node:child_process"
|
|
1503
1520
|
import { config } from "dotenv"
|
|
1504
|
-
import { readFile } from "fs/promises"
|
|
1505
|
-
import { cpus } from "os"
|
|
1521
|
+
import { readFile } from "node:fs/promises"
|
|
1522
|
+
import { cpus } from "node:os"
|
|
1506
1523
|
|
|
1507
1524
|
config()
|
|
1508
1525
|
|
|
@@ -1523,11 +1540,11 @@ import compression from "compression"
|
|
|
1523
1540
|
import cors from "cors"
|
|
1524
1541
|
import { config } from "dotenv"
|
|
1525
1542
|
import express from "express"
|
|
1526
|
-
import { readFileSync } from "fs"
|
|
1527
|
-
import { createServer as createHttpServer } from "http"
|
|
1528
|
-
import { createServer as createHttpsServer } from "https"
|
|
1543
|
+
import { readFileSync } from "node:fs"
|
|
1544
|
+
import { createServer as createHttpServer } from "node:http"
|
|
1545
|
+
import { createServer as createHttpsServer } from "node:https"
|
|
1529
1546
|
import morgan from "morgan"
|
|
1530
|
-
import { join, resolve } from "path"
|
|
1547
|
+
import { join, resolve } from "node:path"
|
|
1531
1548
|
|
|
1532
1549
|
config()
|
|
1533
1550
|
|
|
@@ -1576,12 +1593,12 @@ import compression from "compression"
|
|
|
1576
1593
|
import cors from "cors"
|
|
1577
1594
|
import { config } from "dotenv"
|
|
1578
1595
|
import express from "express"
|
|
1579
|
-
import { readFileSync } from "fs"
|
|
1580
|
-
import { createServer as createHttpServer } from "http"
|
|
1581
|
-
import { createServer as createHttpsServer } from "https"
|
|
1596
|
+
import { readFileSync } from "node:fs"
|
|
1597
|
+
import { createServer as createHttpServer } from "node:http"
|
|
1598
|
+
import { createServer as createHttpsServer } from "node:https"
|
|
1582
1599
|
import morgan from "morgan"
|
|
1583
1600
|
import next from "next"
|
|
1584
|
-
import { join } from "path"
|
|
1601
|
+
import { join } from "node:path"
|
|
1585
1602
|
|
|
1586
1603
|
config()
|
|
1587
1604
|
|
|
@@ -1703,8 +1720,8 @@ function syncPackage(packageName) {
|
|
|
1703
1720
|
}
|
|
1704
1721
|
|
|
1705
1722
|
${monorepo ? `async function main() {
|
|
1706
|
-
const { readdir, readFile, stat } = await import("fs/promises")
|
|
1707
|
-
const { join } = await import("path")
|
|
1723
|
+
const { readdir, readFile, stat } = await import("node:fs/promises")
|
|
1724
|
+
const { join } = await import("node:path")
|
|
1708
1725
|
const dir = "${dir}"
|
|
1709
1726
|
const dir2 = await readdir(dir)
|
|
1710
1727
|
/** @type {string[]} */
|
|
@@ -1720,7 +1737,7 @@ ${monorepo ? `async function main() {
|
|
|
1720
1737
|
}
|
|
1721
1738
|
await Promise.all(packages2.map(syncPackage))
|
|
1722
1739
|
}` : `async function main() {
|
|
1723
|
-
const { readFile } = await import("fs/promises")
|
|
1740
|
+
const { readFile } = await import("node:fs/promises")
|
|
1724
1741
|
const packageJson = JSON.parse(await readFile("package.json", "utf-8"))
|
|
1725
1742
|
await syncPackage(packageJson.name)
|
|
1726
1743
|
}`}
|
|
@@ -1990,7 +2007,7 @@ async function addTailwind() {
|
|
|
1990
2007
|
consola_0.success("添加 tailwind 配置成功");
|
|
1991
2008
|
}
|
|
1992
2009
|
const zipDistContent = `// @ts-check
|
|
1993
|
-
import { rm } from "fs/promises"
|
|
2010
|
+
import { rm } from "node:fs/promises"
|
|
1994
2011
|
import { zip } from "soda-nodejs"
|
|
1995
2012
|
|
|
1996
2013
|
const filename = process.env.FILENAME || "dist.zip"
|
|
@@ -2742,7 +2759,7 @@ async function getHeaders() {
|
|
|
2742
2759
|
});
|
|
2743
2760
|
await clipboardy.write(result.join("\n"));
|
|
2744
2761
|
}
|
|
2745
|
-
const { name: initNode_name } = parse(
|
|
2762
|
+
const { name: initNode_name } = parse(external_node_path_resolve("."));
|
|
2746
2763
|
const initNode_packageJson = `{
|
|
2747
2764
|
"name": "${initNode_name}",
|
|
2748
2765
|
"version": "1.0.0",
|
|
@@ -4694,10 +4711,10 @@ async function syncVscode() {
|
|
|
4694
4711
|
if (options.includes("SETTING") || options.includes("EXTENSION")) {
|
|
4695
4712
|
const script = `// @ts-check
|
|
4696
4713
|
|
|
4697
|
-
import { spawn } from "child_process"
|
|
4698
|
-
import { readdir, copyFile, rm } from "fs/promises"
|
|
4699
|
-
import { homedir } from "os"
|
|
4700
|
-
import { join } from "path"
|
|
4714
|
+
import { spawn } from "node:child_process"
|
|
4715
|
+
import { readdir, copyFile, rm } from "node:fs/promises"
|
|
4716
|
+
import { homedir } from "node:os"
|
|
4717
|
+
import { join } from "node:path"
|
|
4701
4718
|
|
|
4702
4719
|
/**
|
|
4703
4720
|
* @param {string} command
|
|
@@ -5013,7 +5030,7 @@ async function upgradeTailwind() {
|
|
|
5013
5030
|
}
|
|
5014
5031
|
async function upgradeWorkspaceDependceny() {
|
|
5015
5032
|
const { dir, ...rest } = await getUpgradeDependencyConfig();
|
|
5016
|
-
const dir2 =
|
|
5033
|
+
const dir2 = external_node_path_resolve(dir);
|
|
5017
5034
|
const packages = await readdir(dir2);
|
|
5018
5035
|
const packages2 = [];
|
|
5019
5036
|
for (const pkg of packages){
|
|
@@ -5044,8 +5061,8 @@ async function upgradeWorkspaceDependceny() {
|
|
|
5044
5061
|
}))();
|
|
5045
5062
|
}
|
|
5046
5063
|
}
|
|
5047
|
-
const verdaccio_script = `import { spawnSync } from "child_process"
|
|
5048
|
-
import { rmSync } from "fs"
|
|
5064
|
+
const verdaccio_script = `import { spawnSync } from "node:child_process"
|
|
5065
|
+
import { rmSync } from "node:fs"
|
|
5049
5066
|
|
|
5050
5067
|
spawnSync("docker compose down", { cwd: "verdaccio", shell: true, stdio: "inherit" })
|
|
5051
5068
|
|
|
@@ -5076,7 +5093,7 @@ async function verdaccio() {
|
|
|
5076
5093
|
default: setting.verdaccioPath
|
|
5077
5094
|
});
|
|
5078
5095
|
verdaccioPath = verdaccioPath.replace(/^"|"$/g, "");
|
|
5079
|
-
verdaccioPath =
|
|
5096
|
+
verdaccioPath = external_node_path_resolve(verdaccioPath);
|
|
5080
5097
|
const stats = await stat(verdaccioPath);
|
|
5081
5098
|
if (!stats.isDirectory()) throw new Error("verdaccio 文件夹不存在");
|
|
5082
5099
|
setting.verdaccioPath = verdaccioPath;
|
|
@@ -5099,7 +5116,7 @@ async function winget() {
|
|
|
5099
5116
|
}
|
|
5100
5117
|
async function addOpenWith(path, { file, folder, background }) {
|
|
5101
5118
|
if (!file && !folder && !background) throw new Error("至少选择一个");
|
|
5102
|
-
path =
|
|
5119
|
+
path = external_node_path_resolve(path);
|
|
5103
5120
|
try {
|
|
5104
5121
|
const status = await stat(path);
|
|
5105
5122
|
if (!status.isFile()) throw new Error("路径不是文件");
|
|
@@ -5134,9 +5151,9 @@ async function addOpenWith(path, { file, folder, background }) {
|
|
|
5134
5151
|
}
|
|
5135
5152
|
const gdm_script = `// @ts-check
|
|
5136
5153
|
|
|
5137
|
-
import { spawnSync } from "child_process"
|
|
5138
|
-
import { readdirSync, renameSync, rmSync } from "fs"
|
|
5139
|
-
import { styleText } from "util"
|
|
5154
|
+
import { spawnSync } from "node:child_process"
|
|
5155
|
+
import { readdirSync, renameSync, rmSync } from "node:fs"
|
|
5156
|
+
import { styleText } from "node:util"
|
|
5140
5157
|
|
|
5141
5158
|
const dir = readdirSync(".")
|
|
5142
5159
|
|