Files
Ncurator/scripts/postinstall.mjs
T
hy b8c6de42b7 Refactor terminal command handling and enhance test coverage
- Updated TerminalRunCommandResult type to use 'output' instead of 'stdout' and 'stderr'.
- Modified terminal tests to accommodate the new output structure.
- Introduced TerminalSessionManager for better session management in terminal commands.
- Enhanced e2e tests for terminal background service flow and browser interactions.
- Improved workspace setup functions to support IPC binding mode.
- Added new unit tests for workbench process copy and terminal session management.
- Ensured all tool specs provide schema-valid examples and improved prompt contracts.
2026-07-16 10:18:43 +08:00

32 lines
882 B
JavaScript

import { existsSync } from 'node:fs'
import path from 'node:path'
import { spawnSync } from 'node:child_process'
const root = process.cwd()
const electronInstall = path.join(root, 'node_modules', 'electron', 'install.js')
const run = (command, args) => {
const result = spawnSync(command, args, {
cwd: root,
stdio: 'inherit',
env: process.env
})
if (result.status !== 0) {
process.exit(result.status || 1)
}
}
if (existsSync(electronInstall)) {
run(process.execPath, [electronInstall])
}
if (process.env.NCURATOR_REBUILD_NATIVE === '1') {
run(process.execPath, [
path.join(root, 'scripts', 'prepare-better-sqlite3-native.mjs'),
'prepare'
])
run(process.execPath, [path.join(root, 'scripts', 'prepare-node-pty-native.mjs'), 'prepare'])
} else {
console.log('[postinstall] skip native prepare; set NCURATOR_REBUILD_NATIVE=1 to run it')
}