Merge pull request #156 from LinHayaii/fix/windows-support
adapt path and commands for Windows environment
This commit is contained in:
1584
package-lock.json
generated
1584
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
"ccr": "./dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.js && cp node_modules/tiktoken/tiktoken_bg.wasm dist/tiktoken_bg.wasm"
|
||||
"build": "esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.js && shx cp node_modules/tiktoken/tiktoken_bg.wasm dist/tiktoken_bg.wasm"
|
||||
},
|
||||
"keywords": [
|
||||
"claude",
|
||||
@@ -25,6 +25,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.25.1",
|
||||
"shx": "^0.4.0",
|
||||
"typescript": "^5.8.2"
|
||||
},
|
||||
"publishConfig": {
|
||||
|
||||
@@ -7,6 +7,7 @@ import { version } from "../package.json";
|
||||
import { spawn } from "child_process";
|
||||
import { PID_FILE, REFERENCE_COUNT_FILE } from "./constants";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
import {join} from "path";
|
||||
|
||||
const command = process.argv[2];
|
||||
|
||||
@@ -78,7 +79,8 @@ async function main() {
|
||||
case "code":
|
||||
if (!isServiceRunning()) {
|
||||
console.log("Service not running, starting service...");
|
||||
const startProcess = spawn("ccr", ["start"], {
|
||||
const cliPath = join(__dirname, "cli.js");
|
||||
const startProcess = spawn("node", [cliPath, "start"], {
|
||||
detached: true,
|
||||
stdio: "ignore",
|
||||
});
|
||||
|
||||
@@ -3,13 +3,13 @@ import os from "node:os";
|
||||
|
||||
export const HOME_DIR = path.join(os.homedir(), ".claude-code-router");
|
||||
|
||||
export const CONFIG_FILE = `${HOME_DIR}/config.json`;
|
||||
export const CONFIG_FILE = path.join(HOME_DIR, "config.json");
|
||||
|
||||
export const PLUGINS_DIR = `${HOME_DIR}/plugins`;
|
||||
export const PLUGINS_DIR = path.join(HOME_DIR, "plugins");
|
||||
|
||||
export const PID_FILE = path.join(HOME_DIR, '.claude-code-router.pid');
|
||||
|
||||
export const REFERENCE_COUNT_FILE = '/tmp/claude-code-reference-count.txt';
|
||||
export const REFERENCE_COUNT_FILE = path.join(os.tmpdir(), "claude-code-reference-count.txt");
|
||||
|
||||
|
||||
export const DEFAULT_CONFIG = {
|
||||
|
||||
@@ -13,8 +13,8 @@ import {
|
||||
import { CONFIG_FILE } from "./constants";
|
||||
|
||||
async function initializeClaudeConfig() {
|
||||
const homeDir = process.env.HOME;
|
||||
const configPath = `${homeDir}/.claude.json`;
|
||||
const homeDir = homedir();
|
||||
const configPath = join(homeDir, ".claude.json");
|
||||
if (!existsSync(configPath)) {
|
||||
const userID = Array.from(
|
||||
{ length: 64 },
|
||||
|
||||
Reference in New Issue
Block a user