@andyqiu/codeforge 0.8.17 → 0.8.18

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 (2) hide show
  1. package/dist/index.js +48 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32757,7 +32757,7 @@ import * as https from "node:https";
32757
32757
  // lib/version-injected.ts
32758
32758
  function getInjectedVersion() {
32759
32759
  try {
32760
- const v = "0.8.17";
32760
+ const v = "0.8.18";
32761
32761
  if (typeof v === "string" && /^\d+\.\d+\.\d+/.test(v)) {
32762
32762
  return v;
32763
32763
  }
@@ -32882,7 +32882,7 @@ function defaultHttpFetcher(url3, timeoutMs) {
32882
32882
 
32883
32883
  // plugins/update-checker.ts
32884
32884
  var PLUGIN_NAME19 = "update-checker";
32885
- var PLUGIN_VERSION = "3.0.0";
32885
+ var PLUGIN_VERSION = "4.0.0";
32886
32886
  var _updateCheckStarted = false;
32887
32887
  function getCacheFile() {
32888
32888
  return join27(process.env["CODEFORGE_CACHE_DIR"] ?? join27(homedir9(), ".cache", "codeforge"), "update-check.json");
@@ -32970,12 +32970,32 @@ function spawnAsync(cmd, args, opts = {}) {
32970
32970
  }
32971
32971
  async function resolveNodeBin() {
32972
32972
  const w = process.platform === "win32";
32973
+ if (w) {
32974
+ try {
32975
+ const r = await spawnAsync("where", ["node.exe"], { timeout: 3000, shell: true });
32976
+ if (r.status === 0 && r.stdout.trim())
32977
+ return r.stdout.trim().split(/\r?\n/)[0].trim();
32978
+ } catch {}
32979
+ try {
32980
+ const r = await spawnAsync("where", ["node"], { timeout: 3000, shell: true });
32981
+ if (r.status === 0 && r.stdout.trim())
32982
+ return r.stdout.trim().split(/\r?\n/)[0].trim();
32983
+ } catch {}
32984
+ for (const c of ["C:\\Program Files\\nodejs\\node.exe", "C:\\Program Files (x86)\\nodejs\\node.exe"]) {
32985
+ try {
32986
+ const r = await spawnAsync(c, ["--version"], { timeout: 2000, shell: false });
32987
+ if (r.status === 0)
32988
+ return c;
32989
+ } catch {}
32990
+ }
32991
+ return process.execPath;
32992
+ }
32973
32993
  try {
32974
- const r = await spawnAsync(w ? "where" : "which", ["node"], { timeout: 3000 });
32994
+ const r = await spawnAsync("which", ["node"], { timeout: 3000 });
32975
32995
  if (r.status === 0 && r.stdout.trim())
32976
32996
  return r.stdout.trim().split(/\r?\n/)[0].trim();
32977
32997
  } catch {}
32978
- for (const c of w ? ["C:\\Program Files\\nodejs\\node.exe"] : ["/usr/local/bin/node", "/usr/bin/node", "/opt/homebrew/bin/node", "/opt/homebrew/opt/node/bin/node"]) {
32998
+ for (const c of ["/usr/local/bin/node", "/usr/bin/node", "/opt/homebrew/bin/node", "/opt/homebrew/opt/node/bin/node"]) {
32979
32999
  try {
32980
33000
  const r = await spawnAsync(c, ["--version"], { timeout: 2000 });
32981
33001
  if (r.status === 0)
@@ -32986,12 +33006,34 @@ async function resolveNodeBin() {
32986
33006
  }
32987
33007
  async function resolveNpmBin() {
32988
33008
  const w = process.platform === "win32";
33009
+ if (w) {
33010
+ try {
33011
+ const r = await spawnAsync("where", ["npm.cmd"], { timeout: 3000, shell: true });
33012
+ if (r.status === 0 && r.stdout.trim())
33013
+ return r.stdout.trim().split(/\r?\n/)[0].trim();
33014
+ } catch {}
33015
+ try {
33016
+ const r = await spawnAsync("where", ["npm"], { timeout: 3000, shell: true });
33017
+ if (r.status === 0 && r.stdout.trim()) {
33018
+ const p = r.stdout.trim().split(/\r?\n/)[0].trim();
33019
+ return p.replace(/\.cmd$/i, "") + ".cmd";
33020
+ }
33021
+ } catch {}
33022
+ for (const c of ["C:\\Program Files\\nodejs\\npm.cmd", "C:\\Program Files (x86)\\nodejs\\npm.cmd"]) {
33023
+ try {
33024
+ const r = await spawnAsync(c, ["--version"], { timeout: 2000, shell: true });
33025
+ if (r.status === 0)
33026
+ return c;
33027
+ } catch {}
33028
+ }
33029
+ return "npm.cmd";
33030
+ }
32989
33031
  try {
32990
- const r = await spawnAsync(w ? "where" : "which", ["npm"], { timeout: 3000 });
33032
+ const r = await spawnAsync("which", ["npm"], { timeout: 3000 });
32991
33033
  if (r.status === 0 && r.stdout.trim())
32992
33034
  return r.stdout.trim().split(/\r?\n/)[0].trim();
32993
33035
  } catch {}
32994
- for (const c of w ? ["C:\\Program Files\\nodejs\\npm.cmd"] : ["/usr/local/bin/npm", "/usr/bin/npm", "/opt/homebrew/bin/npm"]) {
33036
+ for (const c of ["/usr/local/bin/npm", "/usr/bin/npm", "/opt/homebrew/bin/npm"]) {
32995
33037
  try {
32996
33038
  const r = await spawnAsync(c, ["--version"], { timeout: 2000 });
32997
33039
  if (r.status === 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andyqiu/codeforge",
3
- "version": "0.8.17",
3
+ "version": "0.8.18",
4
4
  "description": "CodeForge — opencode 的零侵入扩展包",
5
5
  "type": "module",
6
6
  "private": false,