Files
wehub-resource-sync cb15c5e0d8
CI / Rust (windows-latest - x86_64-pc-windows-msvc) (push) Waiting to run
CI / Native E2E Tests (push) Blocked by required conditions
CI / Windows Integration Test (push) Blocked by required conditions
CI / Version Sync Check (push) Waiting to run
CI / Rust (push) Waiting to run
CI / Dashboard (push) Waiting to run
CI / Sandbox Package (push) Waiting to run
CI / Rust (macos-latest - aarch64-apple-darwin) (push) Waiting to run
CI / Rust (macos-latest - x86_64-apple-darwin) (push) Waiting to run
CI / Global Install (macos-latest) (push) Blocked by required conditions
CI / Global Install (ubuntu-latest) (push) Blocked by required conditions
CI / Global Install (windows-latest) (push) Blocked by required conditions
Release / Check for new version (push) Has been cancelled
Release / Build macOS ARM64 (push) Has been cancelled
Release / Build macOS x64 (push) Has been cancelled
Release / Build Linux ARM64 (push) Has been cancelled
Release / Build Linux musl ARM64 (push) Has been cancelled
Release / Build Linux musl x64 (push) Has been cancelled
Release / Build Linux x64 (push) Has been cancelled
Release / Build Windows x64 (push) Has been cancelled
Release / Publish to npm (push) Has been cancelled
Release / Publish sandbox package to npm (push) Has been cancelled
Release / Create GitHub Release (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:58 +08:00

37 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
/**
* Copies the compiled Rust binary to bin/ with platform-specific naming
*/
import { copyFileSync, existsSync, mkdirSync } from 'fs';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { platform, arch } from 'os';
const __dirname = dirname(fileURLToPath(import.meta.url));
const projectRoot = join(__dirname, '..');
const sourceExt = platform() === 'win32' ? '.exe' : '';
const sourcePath = join(projectRoot, `cli/target/release/agent-browser${sourceExt}`);
const binDir = join(projectRoot, 'bin');
// Determine platform suffix
const platformKey = `${platform()}-${arch()}`;
const ext = platform() === 'win32' ? '.exe' : '';
const targetName = `agent-browser-${platformKey}${ext}`;
const targetPath = join(binDir, targetName);
if (!existsSync(sourcePath)) {
console.error(`Error: Native binary not found at ${sourcePath}`);
console.error('Run "cargo build --release --manifest-path cli/Cargo.toml" first');
process.exit(1);
}
if (!existsSync(binDir)) {
mkdirSync(binDir, { recursive: true });
}
copyFileSync(sourcePath, targetPath);
console.log(`✓ Copied native binary to ${targetPath}`);