mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-28 11:40:25 +00:00
Some checks are pending
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
CodeQL Advanced / Analyze (python) (push) Waiting to run
Pre-commit / pre-commit (push) Waiting to run
Test / Run Python Tests (push) Waiting to run
Co-authored-by: Wendong-Fan <133094783+Wendong-Fan@users.noreply.github.com> Co-authored-by: Wendong-Fan <w3ndong.fan@gmail.com>
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
// ========= Copyright 2025-2026 @ Eigent.ai All Rights Reserved. =========
|
|
// Directly use venv's python.exe (not uv run) to avoid Windows .exe launcher
|
|
// placeholder issues - same reason we use direct python for backend/uvicorn.
|
|
/* global process, console */
|
|
|
|
import { execSync } from 'child_process';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
const projectRoot = path.resolve(__dirname, '..');
|
|
const backendDir = path.join(projectRoot, 'backend');
|
|
const prebuiltVenvDir = path.join(projectRoot, 'resources', 'prebuilt', 'venv');
|
|
const isWindows = process.platform === 'win32';
|
|
|
|
// Prebuild uses resources/prebuilt/venv; dev may use backend/.venv
|
|
const devVenvDir = path.join(backendDir, '.venv');
|
|
let venvDir;
|
|
if (fs.existsSync(prebuiltVenvDir)) {
|
|
venvDir = prebuiltVenvDir;
|
|
} else if (fs.existsSync(devVenvDir)) {
|
|
venvDir = devVenvDir;
|
|
} else {
|
|
console.error(
|
|
'No Python venv found. Please run "uv sync" in the backend directory first.'
|
|
);
|
|
console.error(` Looked for: ${prebuiltVenvDir}`);
|
|
console.error(` And: ${devVenvDir}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const pythonPath = isWindows
|
|
? path.join(venvDir, 'Scripts', 'python.exe')
|
|
: path.join(venvDir, 'bin', 'python');
|
|
|
|
if (!fs.existsSync(pythonPath)) {
|
|
console.error(`Python executable not found at: ${pythonPath}`);
|
|
console.error(' The venv may be corrupted. Please recreate it.');
|
|
process.exit(1);
|
|
}
|
|
|
|
execSync(`"${pythonPath}" -m babel.messages.frontend compile -d lang`, {
|
|
cwd: backendDir,
|
|
stdio: 'inherit',
|
|
});
|