zixulu 1.80.0 → 1.80.1

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 (40) hide show
  1. package/dist/index.js +36 -8
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/utils/getEditorExtensions.d.ts +15 -6
  4. package/package.json +1 -1
  5. package/src/utils/addTailwind.ts +21 -21
  6. package/src/utils/checkTailwind.ts +9 -9
  7. package/src/utils/checkType.ts +9 -9
  8. package/src/utils/clearDockerLog.ts +8 -8
  9. package/src/utils/download7Zip.ts +14 -14
  10. package/src/utils/downloadAnydesk.ts +14 -14
  11. package/src/utils/downloadChrome.ts +14 -14
  12. package/src/utils/downloadFirefox.ts +14 -14
  13. package/src/utils/downloadGit.ts +14 -14
  14. package/src/utils/downloadHoneyview.ts +9 -9
  15. package/src/utils/downloadNodeJS.ts +14 -14
  16. package/src/utils/downloadPeazip.ts +14 -14
  17. package/src/utils/downloadPotPlayer.ts +14 -14
  18. package/src/utils/downloadPowerToys.ts +14 -14
  19. package/src/utils/downloadVscode.ts +14 -14
  20. package/src/utils/downloadVscodeExts.ts +5 -2
  21. package/src/utils/getDependcy.ts +16 -16
  22. package/src/utils/getEditorExtensions.ts +45 -6
  23. package/src/utils/getPackageUpgradeVersion.ts +43 -43
  24. package/src/utils/getPackageVersionFromRange.ts +8 -8
  25. package/src/utils/getRelativePath.ts +11 -11
  26. package/src/utils/hasChangeNoCommit.ts +6 -6
  27. package/src/utils/isAsset.ts +26 -26
  28. package/src/utils/isShellProxy.ts +12 -12
  29. package/src/utils/isStableVersion.ts +3 -3
  30. package/src/utils/isUrl.ts +5 -5
  31. package/src/utils/next.ts +12 -12
  32. package/src/utils/replaceCommitAuthor.ts +57 -57
  33. package/src/utils/setBun.ts +10 -10
  34. package/src/utils/setEnv.ts +24 -24
  35. package/src/utils/sleep.ts +3 -3
  36. package/src/utils/sortPackageJson.ts +16 -16
  37. package/src/utils/sudoCommand.ts +17 -17
  38. package/src/utils/syncVscode.ts +5 -1
  39. package/src/utils/unique.ts +3 -3
  40. package/src/utils/vite.ts +15 -15
package/dist/index.js CHANGED
@@ -4865,10 +4865,23 @@ description:
4865
4865
  throw error;
4866
4866
  }
4867
4867
  }
4868
- const EditorExtensionCommandMap = {
4869
- Code: "code",
4870
- Cursor: "cursor",
4871
- Antigravity: "antigravity"
4868
+ const getEditorExtensions_userDir = homedir();
4869
+ const editorExtensionCommandMap = {
4870
+ Code: {
4871
+ command: "code",
4872
+ win32Command: "code.cmd",
4873
+ win32Path: join(getEditorExtensions_userDir, "AppData/Local/Programs/Microsoft VS Code/bin/code.cmd")
4874
+ },
4875
+ Cursor: {
4876
+ command: "cursor",
4877
+ win32Command: "cursor.cmd",
4878
+ win32Path: join(getEditorExtensions_userDir, "AppData/Local/Programs/cursor/resources/app/bin/cursor.cmd")
4879
+ },
4880
+ Antigravity: {
4881
+ command: "antigravity",
4882
+ win32Command: "antigravity.cmd",
4883
+ win32Path: join(getEditorExtensions_userDir, "AppData/Local/Programs/Antigravity/bin/antigravity.cmd")
4884
+ }
4872
4885
  };
4873
4886
  async function canGetEditorExtensions({ editor }) {
4874
4887
  const command = getEditorExtensionCommand({
@@ -4882,7 +4895,11 @@ async function canGetEditorExtensions({ editor }) {
4882
4895
  }
4883
4896
  }
4884
4897
  function getEditorExtensionCommand({ editor }) {
4885
- return EditorExtensionCommandMap[editor];
4898
+ const item = editorExtensionCommandMap[editor];
4899
+ if ("win32" !== process.platform) return item.command;
4900
+ if (item.win32Path && existsSync(item.win32Path)) return `"${item.win32Path}"`;
4901
+ if (item.win32Command) return item.win32Command;
4902
+ return item.command;
4886
4903
  }
4887
4904
  async function getEditorExtensions({ source }) {
4888
4905
  let data = [];
@@ -5241,10 +5258,13 @@ async function getVscodeExtInfo(ext) {
5241
5258
  const reg = /^(.+?)\.(.+?)$/;
5242
5259
  const [, author, name] = ext.match(reg);
5243
5260
  let version;
5261
+ const codeCommand = getEditorExtensionCommand({
5262
+ editor: "Code"
5263
+ });
5244
5264
  if ("ms-ceintl.vscode-language-pack-zh-hans" === ext) {
5245
5265
  const reg2 = /"Versions":(\[\{".+?\])/;
5246
5266
  const versions = JSON.parse(html.match(reg2)[1]);
5247
- const output = await execAsync("code --version");
5267
+ const output = await execAsync(`${codeCommand} --version`);
5248
5268
  const codeVersions = output.split("\n")[0].split(".").map(Number);
5249
5269
  const item = versions.find(({ version })=>version.split(".").map(Number).every((item, index)=>index >= 2 || item <= codeVersions[index])) ?? versions[0];
5250
5270
  version = item.version;
@@ -5267,7 +5287,10 @@ async function downloadVscodeExts(dir) {
5267
5287
  recursive: true
5268
5288
  });
5269
5289
  consola.start("正在获取 VS Code 扩展列表");
5270
- const extList = await execAsync("code --list-extensions");
5290
+ const codeCommand = getEditorExtensionCommand({
5291
+ editor: "Code"
5292
+ });
5293
+ const extList = await execAsync(`${codeCommand} --list-extensions`);
5271
5294
  const exts = await Promise.all(extList.split(/[\n\r]/).filter(Boolean).filter((item)=>!item.startsWith("anysphere.")).map((ext)=>getVscodeExtInfo(ext)));
5272
5295
  const setting = await readZixuluSetting();
5273
5296
  const vscodeDownloadHistory = setting?.vscodeDownloadHistory;
@@ -5293,6 +5316,9 @@ var syncVscode_VscodeSyncOption = /*#__PURE__*/ function(VscodeSyncOption) {
5293
5316
  return VscodeSyncOption;
5294
5317
  }({});
5295
5318
  async function syncVscode() {
5319
+ const codeCommand = getEditorExtensionCommand({
5320
+ editor: "Code"
5321
+ });
5296
5322
  const options = (await inquirer_0.prompt({
5297
5323
  type: "checkbox",
5298
5324
  name: "options",
@@ -5335,6 +5361,8 @@ import { readdir, copyFile, rm } from "node:fs/promises"
5335
5361
  import { homedir } from "node:os"
5336
5362
  import { join } from "node:path"
5337
5363
 
5364
+ const codeCommand = ${JSON.stringify(codeCommand)}
5365
+
5338
5366
  /**
5339
5367
  * @param {string} command
5340
5368
  */
@@ -5351,7 +5379,7 @@ function spawnAsync(command) {
5351
5379
  async function main() {
5352
5380
  ${options.includes("EXTENSION") ? ` const dir = await readdir("./extensions")
5353
5381
  for (const ext of dir) {
5354
- await spawnAsync(\`code --install-extension "./extensions/\${ext}"\`)
5382
+ await spawnAsync(\`\${codeCommand} --install-extension "./extensions/\${ext}"\`)
5355
5383
  }
5356
5384
  ` : ""}${options.includes("SETTING") ? ` const userDir = homedir()
5357
5385
  const setting = join(userDir, "AppData/Roaming/Code/User/settings.json")