icebear0828 Claude Opus 4.6 commited on
Commit
d3a5a81
·
1 Parent(s): 4974242

feat: add pnpm/bun package manager support for local development

Browse files

Replace hardcoded npm calls in scripts with npx to be PM-agnostic,
update error messages to mention all three package managers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

README.md CHANGED
@@ -41,7 +41,7 @@
41
  git clone https://github.com/icebear0828/codex-proxy.git
42
  cd codex-proxy
43
 
44
- # 2. 安装依赖
45
  npm install
46
 
47
  # 3. 启动代理(开发模式,支持热重载)
@@ -225,7 +225,7 @@ docker compose up -d
225
  ```bash
226
  git clone https://github.com/icebear0828/codex-proxy.git
227
  cd codex-proxy
228
- npm install && npm run build && npm start
229
  # 打开 http://localhost:8080 登录
230
  ```
231
 
 
41
  git clone https://github.com/icebear0828/codex-proxy.git
42
  cd codex-proxy
43
 
44
+ # 2. 安装依赖(也支持 pnpm install 或 bun install)
45
  npm install
46
 
47
  # 3. 启动代理(开发模式,支持热重载)
 
225
  ```bash
226
  git clone https://github.com/icebear0828/codex-proxy.git
227
  cd codex-proxy
228
+ npm install && npm run build && npm start # 也支持 pnpm / bun
229
  # 打开 http://localhost:8080 登录
230
  ```
231
 
package.json CHANGED
@@ -5,9 +5,9 @@
5
  "type": "module",
6
  "scripts": {
7
  "dev": "tsx watch src/index.ts",
8
- "dev:web": "cd web && npm run dev",
9
- "build:web": "cd web && npm install && npm run build",
10
- "build": "npm run build:web && tsc",
11
  "start": "node dist/index.js",
12
  "check-update": "tsx scripts/check-update.ts",
13
  "check-update:watch": "tsx scripts/check-update.ts --watch",
 
5
  "type": "module",
6
  "scripts": {
7
  "dev": "tsx watch src/index.ts",
8
+ "dev:web": "cd web && npx vite",
9
+ "build:web": "cd web && npx vite build",
10
+ "build": "npx vite build --root web && tsc",
11
  "start": "node dist/index.js",
12
  "check-update": "tsx scripts/check-update.ts",
13
  "check-update:watch": "tsx scripts/check-update.ts --watch",
src/routes/web.ts CHANGED
@@ -21,7 +21,7 @@ export function createWebRoutes(accountPool: AccountPool): Hono {
21
  } catch (err) {
22
  const msg = err instanceof Error ? err.message : String(err);
23
  console.error(`[Web] Failed to read HTML file: ${msg}`);
24
- return c.html("<h1>Codex Proxy</h1><p>UI files not found. Run 'npm run build:web' first. The API is still available at /v1/chat/completions</p>");
25
  }
26
  });
27
 
 
21
  } catch (err) {
22
  const msg = err instanceof Error ? err.message : String(err);
23
  console.error(`[Web] Failed to read HTML file: ${msg}`);
24
+ return c.html("<h1>Codex Proxy</h1><p>UI files not found. Run 'npm/pnpm/bun run build:web' first. The API is still available at /v1/chat/completions</p>");
25
  }
26
  });
27
 
src/tls/curl-binary.ts CHANGED
@@ -100,7 +100,7 @@ export function resolveCurlBinary(): string {
100
  _isImpersonate = false;
101
  console.warn(
102
  `[TLS] curl-impersonate not found at ${binPath}. ` +
103
- `Falling back to system curl. Run "npm run setup" to install curl-impersonate.`,
104
  );
105
  return _resolved;
106
  }
 
100
  _isImpersonate = false;
101
  console.warn(
102
  `[TLS] curl-impersonate not found at ${binPath}. ` +
103
+ `Falling back to system curl. Run "npm/pnpm/bun run setup" to install curl-impersonate.`,
104
  );
105
  return _resolved;
106
  }
src/tls/libcurl-ffi-transport.ts CHANGED
@@ -116,13 +116,13 @@ async function initBindings(): Promise<CurlBindings> {
116
  const mod = await import("koffi");
117
  koffi = mod.default ?? mod;
118
  } catch {
119
- throw new Error("koffi package not installed. Run: npm install koffi");
120
  }
121
 
122
  const dllPath = resolveLibPath();
123
  if (!dllPath) {
124
  throw new Error(
125
- "libcurl-impersonate shared library not found. Run: npm run setup",
126
  );
127
  }
128
 
 
116
  const mod = await import("koffi");
117
  koffi = mod.default ?? mod;
118
  } catch {
119
+ throw new Error("koffi package not installed. Run: npm/pnpm/bun install koffi");
120
  }
121
 
122
  const dllPath = resolveLibPath();
123
  if (!dllPath) {
124
  throw new Error(
125
+ "libcurl-impersonate shared library not found. Run: npm/pnpm/bun run setup",
126
  );
127
  }
128