import { resolve, dirname } from 'node:path'; import { fileURLToPath } from 'node:url'; import { packageTarget } from './package-target.mjs'; import { stageRuntime } from './stage-runtime.mjs'; const project = resolve(dirname(fileURLToPath(import.meta.url)), '..'); const host = resolve(process.env.RUNESTONE_ROOT || resolve(project, '..')); const target = packageTarget(process.argv.slice(2)); if (target.platform !== process.platform || target.arch !== process.arch) { throw new Error('Stage the Browser runtime on the same platform and architecture as the native host build.'); } const { destination, backup } = await stageRuntime({ project, host, ...target }); console.log(`Browser runtime staged in ${destination}`); if (backup) console.log(`Previous runtime retained in ${backup}`);