Files
explorer-monorepo/frontend/scripts/start-standalone.mjs
defiQUG bdae5a9f6e feat: explorer API, wallet, CCIP scripts, and config refresh
- Backend REST/gateway/track routes, analytics, Blockscout proxy paths.
- Frontend wallet and liquidity surfaces; MetaMask token list alignment.
- Deployment docs, verification scripts, address inventory updates.

Check: go build ./... under backend/ (pass).
Made-with: Cursor
2026-04-07 23:22:12 -07:00

48 lines
1.3 KiB
JavaScript

import { spawn } from 'node:child_process'
import { cp, mkdir } from 'node:fs/promises'
import { existsSync } from 'node:fs'
import path from 'node:path'
import process from 'node:process'
const projectRoot = process.cwd()
const standaloneRoot = path.join(projectRoot, '.next', 'standalone')
const standaloneNextRoot = path.join(standaloneRoot, '.next')
const standaloneServer = path.join(standaloneRoot, 'server.js')
async function copyIfPresent(sourcePath, destinationPath) {
if (!existsSync(sourcePath)) {
return
}
await mkdir(path.dirname(destinationPath), { recursive: true })
await cp(sourcePath, destinationPath, { recursive: true, force: true })
}
async function main() {
if (!existsSync(standaloneServer)) {
console.error('Standalone server build is missing. Run `npm run build` first.')
process.exit(1)
}
await copyIfPresent(path.join(projectRoot, '.next', 'static'), path.join(standaloneNextRoot, 'static'))
await copyIfPresent(path.join(projectRoot, 'public'), path.join(standaloneRoot, 'public'))
const child = spawn(process.execPath, [standaloneServer], {
stdio: 'inherit',
env: process.env,
})
child.on('exit', (code, signal) => {
if (signal) {
process.kill(process.pid, signal)
return
}
process.exit(code ?? 0)
})
}
main().catch((error) => {
console.error(error)
process.exit(1)
})