claude-code-router: 1.0.73 -> 2.0.0 (#479577)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
{
|
||||
buildNpmPackage,
|
||||
esbuild,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
makeBinaryWrapper,
|
||||
@@ -17,17 +16,17 @@ let
|
||||
in
|
||||
buildNpmPackage' (finalAttrs: {
|
||||
pname = "claude-code-router";
|
||||
version = "1.0.73";
|
||||
version = "2.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "musistudio";
|
||||
repo = "claude-code-router";
|
||||
rev = "a7e20325dbb2a8827db0c9ee12924bdecfa19fd9";
|
||||
hash = "sha256-E5m5DiuCaZy8ac4bejpnyooaJ+YKc0ZqMIOhI2aOclk=";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-Pw+MkOr/yN3Oq88YtpHqYHNQx3AZD/UcJZ1xdcX3DZ8=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/cli.ts \
|
||||
substituteInPlace packages/cli/src/{cli.ts,utils/index.ts} \
|
||||
--replace-fail '"node"' '"${lib.getExe nodejs}"'
|
||||
'';
|
||||
|
||||
@@ -35,33 +34,22 @@ buildNpmPackage' (finalAttrs: {
|
||||
pnpmDeps = fetchPnpmDeps {
|
||||
inherit (finalAttrs) pname src;
|
||||
pnpm = pnpm';
|
||||
fetcherVersion = 2;
|
||||
hash = "sha256-xvbw0+w6LxiQj2CpF+diVTsoKrxT8HXub1ASrGrlXR4=";
|
||||
fetcherVersion = 3;
|
||||
hash = "sha256-8184F3ShoC6j7nov35CSZWz2dzPFQC7Bty1iTNs1qzc=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
esbuild
|
||||
makeBinaryWrapper
|
||||
pnpm'
|
||||
];
|
||||
|
||||
npmConfigHook = pnpmConfigHook;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
esbuild src/cli.ts --bundle --platform=node --outfile=dist/cli.js
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/lib/claude-code-router/dist
|
||||
cp dist/cli.js $out/lib/claude-code-router/dist/
|
||||
cp node_modules/tiktoken/tiktoken_bg.wasm $out/lib/claude-code-router/dist/
|
||||
cp ${finalAttrs.passthru.ui}/index.html $out/lib/claude-code-router/dist/
|
||||
mkdir -p $out/lib/claude-code-router
|
||||
cp -r dist $out/lib/claude-code-router
|
||||
|
||||
mkdir -p $out/bin
|
||||
makeBinaryWrapper ${lib.getExe nodejs} $out/bin/ccr \
|
||||
@@ -74,36 +62,6 @@ buildNpmPackage' (finalAttrs: {
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgramArg = "-v";
|
||||
|
||||
passthru.ui = buildNpmPackage' (finalAttrs': {
|
||||
pname = finalAttrs.pname + "-ui";
|
||||
inherit (finalAttrs) version src;
|
||||
|
||||
sourceRoot = "${finalAttrs'.src.name}/ui";
|
||||
|
||||
npmDeps = null;
|
||||
pnpmDeps = fetchPnpmDeps {
|
||||
inherit (finalAttrs') pname src sourceRoot;
|
||||
pnpm = pnpm';
|
||||
fetcherVersion = 2;
|
||||
hash = "sha256-YtOcuqhJLJYg0C8J0/THA7UfKMVHE8oN5BcJQ2zSpWQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
pnpm'
|
||||
];
|
||||
|
||||
npmConfigHook = pnpmConfigHook;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
cp dist/index.html $out/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
});
|
||||
|
||||
meta = {
|
||||
description = "Tool to route Claude Code requests to different models and customize any request";
|
||||
homepage = "https://github.com/musistudio/claude-code-router";
|
||||
|
||||
Reference in New Issue
Block a user