zixulu 1.80.7 → 1.81.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 +123 -137
- package/dist/index.js.map +1 -1
- package/dist/src/constant/index.d.ts +2 -11
- package/dist/src/utils/addPrisma.d.ts +1 -1
- package/dist/src/utils/getCommitMessage.d.ts +1 -1
- package/dist/src/utils/getFiles.d.ts +2 -2
- package/dist/src/utils/getPackageUpgradeVersion.d.ts +1 -1
- package/dist/src/utils/modifyJsonc.d.ts +1 -1
- package/dist/src/utils/readZixuluSetting.d.ts +1 -1
- package/dist/src/utils/removeOpenWith.d.ts +1 -1
- package/dist/src/utils/syncAgentRules.d.ts +37 -24
- package/dist/src/utils/upgradeDependency.d.ts +1 -1
- package/dist/src/utils/writeBunConfig.d.ts +1 -1
- package/dist/src/utils/writeZixuluCache.d.ts +1 -1
- package/dist/src/utils/writeZixuluSetting.d.ts +1 -1
- package/package.json +6 -6
- package/src/constant/index.ts +2 -12
- package/src/index.ts +16 -16
- package/src/utils/addEslint.ts +3 -3
- package/src/utils/addHusky.ts +1 -1
- package/src/utils/addPathAlias.ts +2 -2
- package/src/utils/addPrettier.ts +3 -2
- package/src/utils/addPrisma.ts +1 -1
- package/src/utils/addRuleToGitIgnore.ts +1 -1
- package/src/utils/addRuleToPrettierIgnore.ts +1 -1
- package/src/utils/addStartScript.ts +1 -1
- package/src/utils/addSyncPackageScript.ts +1 -1
- package/src/utils/addTailwind.ts +21 -21
- package/src/utils/addZipDist.ts +1 -1
- package/src/utils/checkTailwind.ts +9 -9
- package/src/utils/checkType.ts +9 -9
- package/src/utils/clearDockerLog.ts +8 -8
- package/src/utils/download7Zip.ts +14 -14
- package/src/utils/downloadAnydesk.ts +14 -14
- package/src/utils/downloadChrome.ts +14 -14
- package/src/utils/downloadFirefox.ts +14 -14
- package/src/utils/downloadGit.ts +14 -14
- package/src/utils/downloadHoneyview.ts +9 -9
- package/src/utils/downloadNodeJS.ts +14 -14
- package/src/utils/downloadPeazip.ts +14 -14
- package/src/utils/downloadPotPlayer.ts +14 -14
- package/src/utils/downloadPowerToys.ts +14 -14
- package/src/utils/downloadVscode.ts +14 -14
- package/src/utils/getCommitMessage.ts +2 -2
- package/src/utils/getDependcy.ts +16 -16
- package/src/utils/getFiles.ts +2 -2
- package/src/utils/getPackageUpgradeVersion.ts +43 -43
- package/src/utils/getPackageVersionFromRange.ts +8 -8
- package/src/utils/getRelativePath.ts +11 -11
- package/src/utils/getUpgradeDependencyConfig.ts +1 -1
- package/src/utils/hasChangeNoCommit.ts +6 -6
- package/src/utils/isAsset.ts +26 -26
- package/src/utils/isShellProxy.ts +12 -12
- package/src/utils/isStableVersion.ts +3 -3
- package/src/utils/isUrl.ts +5 -5
- package/src/utils/modifyJsonc.ts +1 -1
- package/src/utils/next.ts +12 -12
- package/src/utils/readZixuluSetting.ts +1 -1
- package/src/utils/removeLock.ts +1 -1
- package/src/utils/removeOpenWith.ts +1 -1
- package/src/utils/replaceAssets.ts +1 -1
- package/src/utils/replaceCommitAuthor.ts +57 -57
- package/src/utils/rsbuild.ts +1 -1
- package/src/utils/setBun.ts +10 -10
- package/src/utils/setEnv.ts +24 -24
- package/src/utils/sleep.ts +3 -3
- package/src/utils/sortPackageJson.ts +16 -16
- package/src/utils/sudoCommand.ts +17 -17
- package/src/utils/syncAgentRules.ts +111 -112
- package/src/utils/syncEditorSetting.ts +1 -1
- package/src/utils/unique.ts +3 -3
- package/src/utils/upgradeDependency.ts +2 -2
- package/src/utils/upgradeRsbuild.ts +1 -1
- package/src/utils/upgradeTailwind.ts +1 -1
- package/src/utils/vite.ts +15 -15
- package/src/utils/writeBunConfig.ts +1 -1
- package/src/utils/writeZixuluCache.ts +1 -1
- package/src/utils/writeZixuluSetting.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -130,15 +130,6 @@ var constant_Software = /*#__PURE__*/ function(Software) {
|
|
|
130
130
|
Software["PowerShell"] = "PowerShell";
|
|
131
131
|
return Software;
|
|
132
132
|
}({});
|
|
133
|
-
const CommitTypeMap = {
|
|
134
|
-
["feature"]: "✨feature: ",
|
|
135
|
-
["fix"]: "🐞 fix: ",
|
|
136
|
-
["docs"]: "📄 docs: ",
|
|
137
|
-
["wip"]: "🖥️ wip: ",
|
|
138
|
-
["perfs"]: "🚅 perfs: ",
|
|
139
|
-
["rollback"]: "⏪ rollback: ",
|
|
140
|
-
["other"]: "🔵 other: "
|
|
141
|
-
};
|
|
142
133
|
const agent = await checkPort(7890, "127.0.0.1") ? void 0 : new HttpsProxyAgent("http://127.0.0.1:7890");
|
|
143
134
|
const addedRules = [
|
|
144
135
|
"package-lock.json",
|
|
@@ -669,11 +660,11 @@ export function useDelete${type}<TContext = never>({ onMutate, onSuccess, onErro
|
|
|
669
660
|
if (items.includes("delete")) await addApi_writeFile(join(hook, `useDelete${type}.ts`), useDelete);
|
|
670
661
|
}
|
|
671
662
|
function getCommitMessage(type, message) {
|
|
672
|
-
return `${
|
|
663
|
+
return `${type}: ${message}`;
|
|
673
664
|
}
|
|
674
665
|
async function addRuleToGitIgnore(...rules) {
|
|
675
666
|
const dir = await readdir(".");
|
|
676
|
-
const message = getCommitMessage("
|
|
667
|
+
const message = getCommitMessage("feat", `添加 .gitignore 规则 ${rules.join(", ")}`);
|
|
677
668
|
if (!dir.includes(".gitignore")) {
|
|
678
669
|
await writeFile(".gitignore", rules.join("\n"), "utf-8");
|
|
679
670
|
return message;
|
|
@@ -1081,7 +1072,7 @@ async function installDependceny(config) {
|
|
|
1081
1072
|
return true;
|
|
1082
1073
|
}
|
|
1083
1074
|
async function addEslint() {
|
|
1084
|
-
await writeFile("eslint.config.mjs",
|
|
1075
|
+
await writeFile("eslint.config.mjs", `// eslint-disable-next-line n/no-unpublished-import\nexport { default } from "@1adybug/eslint"\n`);
|
|
1085
1076
|
const packages = [
|
|
1086
1077
|
{
|
|
1087
1078
|
packageName: "eslint",
|
|
@@ -1097,7 +1088,7 @@ async function addEslint() {
|
|
|
1097
1088
|
await addScript({
|
|
1098
1089
|
lint: "eslint ."
|
|
1099
1090
|
});
|
|
1100
|
-
return getCommitMessage("
|
|
1091
|
+
return getCommitMessage("feat", "add eslint");
|
|
1101
1092
|
}
|
|
1102
1093
|
async function addGitAttributes() {
|
|
1103
1094
|
await writeFile(".gitattributes", `# 将所有文本文件在提交到 Git 仓库时,自动转换为 LF 换行符
|
|
@@ -1308,7 +1299,7 @@ async function replacePathAlias() {
|
|
|
1308
1299
|
});
|
|
1309
1300
|
await writeFile(file, code, "utf-8");
|
|
1310
1301
|
}
|
|
1311
|
-
return getCommitMessage("
|
|
1302
|
+
return getCommitMessage("feat", "replace path alias");
|
|
1312
1303
|
}
|
|
1313
1304
|
async function addFolderPathAlias() {
|
|
1314
1305
|
const { folder } = await inquirer_0.prompt({
|
|
@@ -1336,11 +1327,11 @@ async function addFolderPathAlias() {
|
|
|
1336
1327
|
name: item,
|
|
1337
1328
|
path: getRelativePath_getRelativePath(join(folder, item))
|
|
1338
1329
|
})));
|
|
1339
|
-
return getCommitMessage("
|
|
1330
|
+
return getCommitMessage("feat", `add path alias: ${result.join(", ")}`);
|
|
1340
1331
|
}
|
|
1341
1332
|
async function addRuleToPrettierIgnore(...rules) {
|
|
1342
1333
|
const dir = await readdir(".");
|
|
1343
|
-
const message = getCommitMessage("
|
|
1334
|
+
const message = getCommitMessage("feat", `添加 .prettierignore 规则 ${rules.join(", ")}`);
|
|
1344
1335
|
if (!dir.includes(".prettierignore")) {
|
|
1345
1336
|
await writeFile(".prettierignore", rules.join("\n"), "utf-8");
|
|
1346
1337
|
return message;
|
|
@@ -1379,6 +1370,7 @@ const config = {
|
|
|
1379
1370
|
controlStatementBraces: "add",
|
|
1380
1371
|
multiLineBraces: "add",
|
|
1381
1372
|
nodeProtocol: "add",
|
|
1373
|
+
markTypeOnlyImports: true,
|
|
1382
1374
|
}
|
|
1383
1375
|
|
|
1384
1376
|
export default config
|
|
@@ -1398,7 +1390,7 @@ async function addPrettier() {
|
|
|
1398
1390
|
const packageJson2 = await readPackageJson();
|
|
1399
1391
|
packageJson2.scripts ??= {};
|
|
1400
1392
|
packageJson2.scripts.format = "prettier --write .";
|
|
1401
|
-
packageJson2.scripts.fg = 'npm run format && git add . && git commit -m "
|
|
1393
|
+
packageJson2.scripts.fg = 'npm run format && git add . && git commit -m "feat: format"';
|
|
1402
1394
|
await writePackageJson({
|
|
1403
1395
|
data: packageJson2
|
|
1404
1396
|
});
|
|
@@ -1635,7 +1627,7 @@ async function addStartScript({ type, pemPath, port, core, hostname }) {
|
|
|
1635
1627
|
});
|
|
1636
1628
|
consola.success("已添加启动命令 start");
|
|
1637
1629
|
await installDependceny();
|
|
1638
|
-
return getCommitMessage("
|
|
1630
|
+
return getCommitMessage("feat", "添加启动命令");
|
|
1639
1631
|
}
|
|
1640
1632
|
async function addSyncPackageScript({ monorepo } = {}) {
|
|
1641
1633
|
let dir;
|
|
@@ -1725,7 +1717,7 @@ main()
|
|
|
1725
1717
|
await writePackageJson({
|
|
1726
1718
|
data: packageJson
|
|
1727
1719
|
});
|
|
1728
|
-
return getCommitMessage("
|
|
1720
|
+
return getCommitMessage("feat", "添加同步包脚本");
|
|
1729
1721
|
}
|
|
1730
1722
|
const regexPlaceholders = [
|
|
1731
1723
|
{
|
|
@@ -2565,7 +2557,7 @@ async function addZipDist({ install } = {}) {
|
|
|
2565
2557
|
data: packageJson
|
|
2566
2558
|
});
|
|
2567
2559
|
if (install) await installDependceny();
|
|
2568
|
-
return getCommitMessage("
|
|
2560
|
+
return getCommitMessage("feat", "添加压缩脚本");
|
|
2569
2561
|
}
|
|
2570
2562
|
function getTypeInGenerics(str, start = 0) {
|
|
2571
2563
|
if ("<" !== str[start]) throw new Error("无效的泛型");
|
|
@@ -3969,7 +3961,7 @@ async function removeLock() {
|
|
|
3969
3961
|
recursive: true
|
|
3970
3962
|
});
|
|
3971
3963
|
await addRuleToGitIgnore("package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock");
|
|
3972
|
-
return getCommitMessage("
|
|
3964
|
+
return getCommitMessage("feat", "删除包管理 lock 文件");
|
|
3973
3965
|
}
|
|
3974
3966
|
async function removeTag({ reg, flags, push, remote = "origin" }) {
|
|
3975
3967
|
const git = simpleGit();
|
|
@@ -4788,26 +4780,22 @@ async function sortPackageJson() {
|
|
|
4788
4780
|
});
|
|
4789
4781
|
consola.success("排序 package.json 中的依赖成功");
|
|
4790
4782
|
}
|
|
4791
|
-
const
|
|
4792
|
-
|
|
4793
|
-
cursor: "Cursor",
|
|
4794
|
-
antiGravity: "AntiGravity"
|
|
4795
|
-
};
|
|
4796
|
-
const syncAgentRules_source = join(".cursor-rules");
|
|
4797
|
-
const cursorRulesTarget = join(".cursor", "rules");
|
|
4798
|
-
const antiGravityRulesTarget = join(".agent", "rules");
|
|
4783
|
+
const syncAgentRules_source = join(".agent-rules");
|
|
4784
|
+
const agentsMdTarget = "AGENTS.md";
|
|
4799
4785
|
const orders = [
|
|
4800
|
-
"base.
|
|
4801
|
-
"
|
|
4802
|
-
"
|
|
4803
|
-
"
|
|
4786
|
+
"base.md",
|
|
4787
|
+
"style.md",
|
|
4788
|
+
"react.md",
|
|
4789
|
+
"api.md",
|
|
4790
|
+
"next.md"
|
|
4804
4791
|
];
|
|
4805
|
-
function
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4792
|
+
async function pathExists(path) {
|
|
4793
|
+
try {
|
|
4794
|
+
await access(path);
|
|
4795
|
+
return true;
|
|
4796
|
+
} catch {
|
|
4797
|
+
return false;
|
|
4798
|
+
}
|
|
4811
4799
|
}
|
|
4812
4800
|
function sortAgentRuleFiles(files) {
|
|
4813
4801
|
return files.toSorted((a, b)=>{
|
|
@@ -4819,72 +4807,70 @@ function sortAgentRuleFiles(files) {
|
|
|
4819
4807
|
return aIndex - bIndex;
|
|
4820
4808
|
});
|
|
4821
4809
|
}
|
|
4822
|
-
function
|
|
4823
|
-
return
|
|
4824
|
-
trigger: ${"true" === p1 ? "always_on" : "model_decision"}
|
|
4825
|
-
glob:
|
|
4826
|
-
description:
|
|
4827
|
-
---`);
|
|
4810
|
+
function normalizeMarkdownHeading(heading) {
|
|
4811
|
+
return heading.replace(/\s+#+$/, "").trim().toLocaleLowerCase();
|
|
4828
4812
|
}
|
|
4829
|
-
function
|
|
4830
|
-
|
|
4813
|
+
function getMarkdownHeadings(content, level) {
|
|
4814
|
+
const hashes = "#".repeat(level);
|
|
4815
|
+
const regexp = new RegExp(`^${hashes}(?!#)\\s+(.+?)\\s*$`, "gm");
|
|
4816
|
+
return Array.from(content.matchAll(regexp), ([, heading])=>heading.replace(/\s+#+$/, "").trim());
|
|
4831
4817
|
}
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4818
|
+
function getMarkdownFirstHeading(content) {
|
|
4819
|
+
return getMarkdownHeadings(content, 1)[0] ?? "";
|
|
4820
|
+
}
|
|
4821
|
+
function transformMarkdownRuleToAgentsRule(source) {
|
|
4822
|
+
return source.replace(/^(#+ )/gm, "#$1").replace(/\n+$/, "");
|
|
4823
|
+
}
|
|
4824
|
+
async function getMarkdownRuleFilenames() {
|
|
4825
|
+
const entries = await readdir(syncAgentRules_source, {
|
|
4826
|
+
withFileTypes: true
|
|
4827
|
+
});
|
|
4828
|
+
return sortAgentRuleFiles(entries.filter((entry)=>entry.isFile()).map((entry)=>entry.name).filter((filename)=>filename.toLowerCase().endsWith(".md")));
|
|
4829
|
+
}
|
|
4830
|
+
async function readAgentRuleFiles(files) {
|
|
4831
|
+
const rules = [];
|
|
4832
|
+
for (const filename of files){
|
|
4833
|
+
const content = await readFile(join(syncAgentRules_source, filename), "utf-8");
|
|
4834
|
+
const title = getMarkdownFirstHeading(content) || filename;
|
|
4835
|
+
rules.push({
|
|
4836
|
+
filename,
|
|
4837
|
+
title,
|
|
4838
|
+
content
|
|
4839
|
+
});
|
|
4847
4840
|
}
|
|
4848
|
-
return
|
|
4841
|
+
return rules;
|
|
4842
|
+
}
|
|
4843
|
+
async function readOriginalAgentsMd() {
|
|
4844
|
+
if (!await pathExists(agentsMdTarget)) return;
|
|
4845
|
+
return await readFile(agentsMdTarget, "utf-8");
|
|
4846
|
+
}
|
|
4847
|
+
function getDefaultAgentRuleFiles(params) {
|
|
4848
|
+
const { rules, originalContent } = params;
|
|
4849
|
+
if (!originalContent) return rules.map((rule)=>rule.filename);
|
|
4850
|
+
const originalSecondHeadings = new Set(getMarkdownHeadings(originalContent, 2).map(normalizeMarkdownHeading));
|
|
4851
|
+
return rules.filter((rule)=>originalSecondHeadings.has(normalizeMarkdownHeading(rule.title))).map((rule)=>rule.filename);
|
|
4849
4852
|
}
|
|
4850
|
-
async function
|
|
4851
|
-
const
|
|
4852
|
-
const
|
|
4853
|
-
if (0 === changedFiles.length) return;
|
|
4854
|
-
const { files: selectedFiles } = await inquirer_0.prompt({
|
|
4853
|
+
async function selectAgentRuleFiles(params) {
|
|
4854
|
+
const { rules, defaultFiles } = params;
|
|
4855
|
+
const { files } = await inquirer_0.prompt({
|
|
4855
4856
|
type: "checkbox",
|
|
4856
4857
|
name: "files",
|
|
4857
|
-
message: "
|
|
4858
|
-
choices:
|
|
4859
|
-
name: `${
|
|
4860
|
-
value:
|
|
4858
|
+
message: "请选择要同步到 AGENTS.md 的规则",
|
|
4859
|
+
choices: rules.map((rule)=>({
|
|
4860
|
+
name: `${rule.title} (${rule.filename})`,
|
|
4861
|
+
value: rule.filename
|
|
4861
4862
|
})),
|
|
4862
|
-
default:
|
|
4863
|
+
default: defaultFiles
|
|
4863
4864
|
});
|
|
4864
|
-
|
|
4865
|
-
recursive: true
|
|
4866
|
-
});
|
|
4867
|
-
for (const file of selectedFiles)await copyFile(join(syncAgentRules_source, file), join(cursorRulesTarget, file));
|
|
4865
|
+
return files;
|
|
4868
4866
|
}
|
|
4869
|
-
async function
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
await writeFile(join(antiGravityRulesTarget, file.replace(/\.mdc$/, ".md")), content);
|
|
4877
|
-
}
|
|
4878
|
-
}
|
|
4879
|
-
async function syncAgentsMdRules(files) {
|
|
4880
|
-
let agentsRule = "# Agent Rules";
|
|
4881
|
-
for (const file of files){
|
|
4882
|
-
const sourceContent = await readFile(join(syncAgentRules_source, file), "utf-8");
|
|
4883
|
-
const content = transformCursorRuleToAgentsRule(sourceContent);
|
|
4884
|
-
agentsRule = `${agentsRule}${content}`.replace(/\n+$/, "");
|
|
4885
|
-
}
|
|
4886
|
-
agentsRule = `${agentsRule}\n`;
|
|
4887
|
-
await writeFile("AGENTS.md", agentsRule);
|
|
4867
|
+
async function syncAgentsMdRules(rules) {
|
|
4868
|
+
const sections = rules.map((rule)=>transformMarkdownRuleToAgentsRule(rule.content)).filter(Boolean);
|
|
4869
|
+
const agentsRule = `${[
|
|
4870
|
+
"# Agent Rules",
|
|
4871
|
+
...sections
|
|
4872
|
+
].join("\n\n").replace(/\n+$/, "")}\n`;
|
|
4873
|
+
await writeFile(agentsMdTarget, agentsRule);
|
|
4888
4874
|
}
|
|
4889
4875
|
async function asyncAgentRules() {
|
|
4890
4876
|
try {
|
|
@@ -4893,33 +4879,33 @@ async function asyncAgentRules() {
|
|
|
4893
4879
|
await writePackageJson({
|
|
4894
4880
|
data: packageJson
|
|
4895
4881
|
});
|
|
4896
|
-
} catch
|
|
4897
|
-
await
|
|
4882
|
+
} catch {}
|
|
4883
|
+
await rm(syncAgentRules_source, {
|
|
4884
|
+
recursive: true,
|
|
4885
|
+
force: true
|
|
4886
|
+
});
|
|
4898
4887
|
try {
|
|
4899
|
-
|
|
4900
|
-
const
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4888
|
+
await spawnAsync(`npx gitpick 1adybug/cursor-rule ${syncAgentRules_source}`);
|
|
4889
|
+
const sourceDir = await getMarkdownRuleFilenames();
|
|
4890
|
+
if (0 === sourceDir.length) throw new Error("未找到 Agent 规则文件");
|
|
4891
|
+
const rules = await readAgentRuleFiles(sourceDir);
|
|
4892
|
+
const originalAgentsMd = await readOriginalAgentsMd();
|
|
4893
|
+
const defaultFiles = getDefaultAgentRuleFiles({
|
|
4894
|
+
rules,
|
|
4895
|
+
originalContent: originalAgentsMd
|
|
4907
4896
|
});
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
if (targets.includes(AgentRulesSyncTarget.agentsMd)) await syncAgentsMdRules(sourceDir);
|
|
4912
|
-
await rm(syncAgentRules_source, {
|
|
4913
|
-
recursive: true,
|
|
4914
|
-
force: true
|
|
4897
|
+
const selectedFiles = await selectAgentRuleFiles({
|
|
4898
|
+
rules,
|
|
4899
|
+
defaultFiles
|
|
4915
4900
|
});
|
|
4916
|
-
|
|
4917
|
-
|
|
4901
|
+
if (0 === selectedFiles.length) throw new Error("未选择 Agent 规则");
|
|
4902
|
+
await syncAgentsMdRules(rules.filter((rule)=>selectedFiles.includes(rule.filename)));
|
|
4903
|
+
return getCommitMessage("feat", "同步 Agent 规则");
|
|
4904
|
+
} finally{
|
|
4918
4905
|
await rm(syncAgentRules_source, {
|
|
4919
4906
|
recursive: true,
|
|
4920
4907
|
force: true
|
|
4921
4908
|
});
|
|
4922
|
-
throw error;
|
|
4923
4909
|
}
|
|
4924
4910
|
}
|
|
4925
4911
|
const EditorExtensionCommandMap = {
|
|
@@ -4928,7 +4914,7 @@ const EditorExtensionCommandMap = {
|
|
|
4928
4914
|
Antigravity: "antigravity"
|
|
4929
4915
|
};
|
|
4930
4916
|
const editorExtensionCommandCache = new Map();
|
|
4931
|
-
async function
|
|
4917
|
+
async function getEditorExtensions_pathExists({ path }) {
|
|
4932
4918
|
try {
|
|
4933
4919
|
await access(path);
|
|
4934
4920
|
return true;
|
|
@@ -4994,7 +4980,7 @@ async function getEditorExtensionCommand({ editor }) {
|
|
|
4994
4980
|
for (const candidate of getEditorWindowsCliCandidates({
|
|
4995
4981
|
editor
|
|
4996
4982
|
})){
|
|
4997
|
-
if (!await
|
|
4983
|
+
if (!await getEditorExtensions_pathExists({
|
|
4998
4984
|
path: candidate
|
|
4999
4985
|
})) continue;
|
|
5000
4986
|
const command = quoteShellCommand({
|
|
@@ -5344,7 +5330,7 @@ async function syncEditorSetting() {
|
|
|
5344
5330
|
});
|
|
5345
5331
|
if (await hasChangeNoCommit(onlinePath)) {
|
|
5346
5332
|
await addGitCommit({
|
|
5347
|
-
message: getCommitMessage("
|
|
5333
|
+
message: getCommitMessage("feat", "sync editor setting"),
|
|
5348
5334
|
cwd: onlinePath
|
|
5349
5335
|
});
|
|
5350
5336
|
await execAsync("git push", {
|
|
@@ -5824,7 +5810,7 @@ async function upgradeDependency(config) {
|
|
|
5824
5810
|
dir
|
|
5825
5811
|
});
|
|
5826
5812
|
await installDependceny();
|
|
5827
|
-
return getCommitMessage("
|
|
5813
|
+
return getCommitMessage("feat", `upgrade dependencies: ${upgradeLogs.join(", ")}`);
|
|
5828
5814
|
}
|
|
5829
5815
|
async function getPackageLatestVersion(packageName) {
|
|
5830
5816
|
const registry = await getRegistry();
|
|
@@ -5858,7 +5844,7 @@ async function upgradeRsbuild() {
|
|
|
5858
5844
|
await installDependceny();
|
|
5859
5845
|
const upgradeLog = `upgrade dependencies: ${upgradeLogs.join(", ")}`;
|
|
5860
5846
|
consola.success(upgradeLog);
|
|
5861
|
-
return getCommitMessage("
|
|
5847
|
+
return getCommitMessage("feat", upgradeLog);
|
|
5862
5848
|
}
|
|
5863
5849
|
async function upgradeTailwind() {
|
|
5864
5850
|
const version = await getPackageVersionInDependcy("tailwindcss");
|
|
@@ -5881,7 +5867,7 @@ async function upgradeTailwind() {
|
|
|
5881
5867
|
await installDependceny();
|
|
5882
5868
|
const upgradeLog = `upgrade dependencies: tailwindcss ${version} => ${newVersion}`;
|
|
5883
5869
|
consola.success(upgradeLog);
|
|
5884
|
-
return getCommitMessage("
|
|
5870
|
+
return getCommitMessage("feat", upgradeLog);
|
|
5885
5871
|
}
|
|
5886
5872
|
async function upgradeWorkspaceDependceny() {
|
|
5887
5873
|
const { dir, ...rest } = await getUpgradeDependencyConfig();
|
|
@@ -6378,15 +6364,15 @@ const program = new Command();
|
|
|
6378
6364
|
const src_pkg = readPackageJsonSync("win32" === process.platform ? import.meta.resolve("../").replace(/^file:\/\/\//, "") : import.meta.resolve("../").replace(/^file:\/\//, ""));
|
|
6379
6365
|
program.name("格数科技").version(src_pkg.version);
|
|
6380
6366
|
console.log(chalk.redBright.bold(`zixulu ${src_pkg.version}`));
|
|
6381
|
-
program.command("eslint").description("添加 ESLint 相关配置").action(actionWithBackup(addEslint, getCommitMessage("
|
|
6382
|
-
program.command("prettier").description("添加 prettier 配置").action(actionWithBackup(addPrettier, getCommitMessage("
|
|
6383
|
-
program.command("husky").description("添加 husky 配置").action(actionWithBackup(addHusky, getCommitMessage("
|
|
6384
|
-
program.command("vite").description("初始化 vite 配置").action(actionWithBackup(vite, getCommitMessage("
|
|
6385
|
-
program.command("rsbuild").description("初始化 rsbuild 配置").action(actionWithBackup(rsbuild, getCommitMessage("
|
|
6386
|
-
program.command("next").description("初始化 next 配置").action(actionWithBackup(next_next, getCommitMessage("
|
|
6387
|
-
program.command("tailwind").description("添加 tailwind 配置").action(actionWithBackup(addTailwind, getCommitMessage("
|
|
6388
|
-
program.command("remove-comment").description("删除文件注释").argument("path", "文件路径").action(actionWithBackup(removeComment, getCommitMessage("
|
|
6389
|
-
program.command("father").alias("fs").description("初始化 father 项目配置").action(actionWithBackup(setFatherConfig, getCommitMessage("
|
|
6367
|
+
program.command("eslint").description("添加 ESLint 相关配置").action(actionWithBackup(addEslint, getCommitMessage("feat", "添加 ESLint 相关配置")));
|
|
6368
|
+
program.command("prettier").description("添加 prettier 配置").action(actionWithBackup(addPrettier, getCommitMessage("feat", "添加 prettier 配置文件")));
|
|
6369
|
+
program.command("husky").description("添加 husky 配置").action(actionWithBackup(addHusky, getCommitMessage("feat", "添加 husky 配置")));
|
|
6370
|
+
program.command("vite").description("初始化 vite 配置").action(actionWithBackup(vite, getCommitMessage("feat", "初始化 vite 配置")));
|
|
6371
|
+
program.command("rsbuild").description("初始化 rsbuild 配置").action(actionWithBackup(rsbuild, getCommitMessage("feat", "初始化 rsbuild 配置")));
|
|
6372
|
+
program.command("next").description("初始化 next 配置").action(actionWithBackup(next_next, getCommitMessage("feat", "初始化 next 配置")));
|
|
6373
|
+
program.command("tailwind").description("添加 tailwind 配置").action(actionWithBackup(addTailwind, getCommitMessage("feat", "添加 tailwind 配置")));
|
|
6374
|
+
program.command("remove-comment").description("删除文件注释").argument("path", "文件路径").action(actionWithBackup(removeComment, getCommitMessage("feat", "删除文件注释")));
|
|
6375
|
+
program.command("father").alias("fs").description("初始化 father 项目配置").action(actionWithBackup(setFatherConfig, getCommitMessage("feat", "初始化 father 项目配置")));
|
|
6390
6376
|
program.command("upgrade-dependency").alias("ud").description("升级项目依赖").option("-r, --registry <registry>", "npm 源地址,可以是 npm、taobao、tencent 或者自定义地址").option("-p, --proxy", "是否使用代理").action(async (optios)=>{
|
|
6391
6377
|
setGlobalConfig(optios);
|
|
6392
6378
|
await actionWithBackup(()=>upgradeDependency())();
|
|
@@ -6396,9 +6382,9 @@ program.command("upgrade-workspace-dependency").alias("uwd").description("升级
|
|
|
6396
6382
|
await upgradeWorkspaceDependceny();
|
|
6397
6383
|
});
|
|
6398
6384
|
program.command("registry").description("设置 npm registry").action(setRegistry);
|
|
6399
|
-
program.command("sort-package-json").alias("spj").description("对 package.json 中的依赖进行排序").action(actionWithBackup(sortPackageJson, getCommitMessage("
|
|
6400
|
-
program.command("arrow-to-function").alias("a2f").description("将箭头函数组件转换为函数组件").action(actionWithBackup(arrowToFunction, getCommitMessage("
|
|
6401
|
-
program.command("interface-to-type").alias("i2t").description("将 interface 转换为 type").action(actionWithBackup(interfaceToType, getCommitMessage("
|
|
6385
|
+
program.command("sort-package-json").alias("spj").description("对 package.json 中的依赖进行排序").action(actionWithBackup(sortPackageJson, getCommitMessage("feat", "对 package.json 中的依赖进行排序")));
|
|
6386
|
+
program.command("arrow-to-function").alias("a2f").description("将箭头函数组件转换为函数组件").action(actionWithBackup(arrowToFunction, getCommitMessage("feat", "将箭头函数组件转换为函数组件")));
|
|
6387
|
+
program.command("interface-to-type").alias("i2t").description("将 interface 转换为 type").action(actionWithBackup(interfaceToType, getCommitMessage("feat", "将 interface 转换为 type")));
|
|
6402
6388
|
program.command("gitignore").description("添加 .gitignore 配置").action(actionWithBackup(addGitignore));
|
|
6403
6389
|
program.command("git-proxy").alias("gp").description("设置 git 代理").action(setGitProxy);
|
|
6404
6390
|
program.command("shell-proxy").alias("sp").description("设置 Shell 代理").action(setShellProxy);
|
|
@@ -6407,10 +6393,10 @@ program.command("vscode").alias("vsc").description("同步 VS Code 配置").acti
|
|
|
6407
6393
|
program.command("kill-port").description("根据端口号杀死进程").argument("port", "端口号").action(killProcessByPort);
|
|
6408
6394
|
program.command("rm-git").argument("path", "要移除的文件或文件夹").action(removeFileOrFolderFromGit);
|
|
6409
6395
|
program.command("npm-download").alias("nd").description("下载 npm 包").argument("name", "包名").action(downloadNpm);
|
|
6410
|
-
program.command("prisma").description("添加 prisma 配置").action(actionWithBackup(()=>addPrisma(), getCommitMessage("
|
|
6396
|
+
program.command("prisma").description("添加 prisma 配置").action(actionWithBackup(()=>addPrisma(), getCommitMessage("feat", "添加 prisma 配置")));
|
|
6411
6397
|
program.command("prisma-generate").alias("pg").description("生成 prisma client").action(generatePrisma);
|
|
6412
|
-
program.command("antd").description("添加 antd 配置").action(actionWithBackup(addAntd, getCommitMessage("
|
|
6413
|
-
program.command("init").description("初始化项目").action(actionWithBackup(initProject, getCommitMessage("
|
|
6398
|
+
program.command("antd").description("添加 antd 配置").action(actionWithBackup(addAntd, getCommitMessage("feat", "添加 antd 配置")));
|
|
6399
|
+
program.command("init").description("初始化项目").action(actionWithBackup(initProject, getCommitMessage("feat", "初始化项目")));
|
|
6414
6400
|
program.command("tsc").description("类型检查").action(checkType);
|
|
6415
6401
|
program.command("beta-version").alias("bv").description("设置版本号").action(betaVersion);
|
|
6416
6402
|
program.command("reinstall").alias("ri").description("重新安装依赖").option("-r, --registry <registry>", "npm 源地址,可以是 npm、taobao、tencent 或者自定义地址").action(async (options)=>{
|