源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
This commit is contained in:
commit
2ed3415fb7
8018 files changed
+1936476
No files matched your search
@@ -0,0 +1,72 @@
|
||||
import {
|
||||
cpSync,
|
||||
existsSync,
|
||||
lstatSync,
|
||||
mkdirSync,
|
||||
readdirSync,
|
||||
rmSync
|
||||
} from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { smokeClaudeSDKSidecar } from "./smoke-claude-sdk-sidecar.mjs";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const desktopDir = join(__dirname, "..");
|
||||
|
||||
function log(message) {
|
||||
process.stderr.write(`[copy-vendored-node-resources] ${message}\n`);
|
||||
}
|
||||
|
||||
function resourcesDirForContext(context) {
|
||||
if (context.electronPlatformName === "darwin") {
|
||||
const appDir = readdirSync(context.appOutDir).find((entry) =>
|
||||
entry.endsWith(".app")
|
||||
);
|
||||
if (!appDir) {
|
||||
throw new Error(`macOS app bundle not found in ${context.appOutDir}`);
|
||||
}
|
||||
return join(context.appOutDir, appDir, "Contents", "Resources");
|
||||
}
|
||||
return join(context.appOutDir, "resources");
|
||||
}
|
||||
|
||||
function copyNodeModules(resourcesDir, bundleName) {
|
||||
const source = join(desktopDir, "build", bundleName, "node_modules");
|
||||
if (!existsSync(source)) {
|
||||
throw new Error(`vendored node_modules missing: ${source}`);
|
||||
}
|
||||
const destination = join(resourcesDir, "bin", bundleName, "node_modules");
|
||||
rmSync(destination, { recursive: true, force: true });
|
||||
mkdirSync(dirname(destination), { recursive: true });
|
||||
cpSync(source, destination, { recursive: true, dereference: true });
|
||||
rmSync(join(destination, ".bin"), { recursive: true, force: true });
|
||||
removeSymlinks(destination);
|
||||
log(`copied ${bundleName} node_modules to ${destination}`);
|
||||
return destination;
|
||||
}
|
||||
|
||||
function removeSymlinks(root) {
|
||||
for (const entry of readdirSync(root)) {
|
||||
const path = join(root, entry);
|
||||
const stat = lstatSync(path);
|
||||
if (stat.isSymbolicLink()) {
|
||||
rmSync(path, { force: true });
|
||||
continue;
|
||||
}
|
||||
if (stat.isDirectory()) {
|
||||
removeSymlinks(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default async function copyVendoredNodeResourcesAfterPack(context) {
|
||||
const resourcesDir = resourcesDirForContext(context);
|
||||
copyNodeModules(resourcesDir, "browser-mcp");
|
||||
// The claude-sdk-sidecar bundle carries JS only; the native claude binary is
|
||||
// provisioned at runtime by tuttid (claude_binary.go), so there is no
|
||||
// per-architecture pruning to do here anymore.
|
||||
copyNodeModules(resourcesDir, "claude-sdk-sidecar");
|
||||
const packagedSidecarDir = join(resourcesDir, "bin", "claude-sdk-sidecar");
|
||||
await smokeClaudeSDKSidecar({ bundleDir: packagedSidecarDir });
|
||||
log(`smoke-tested claude-sdk-sidecar at ${packagedSidecarDir}`);
|
||||
}
|
||||
Reference in new issue
Block a user