mirror of
https://github.com/stablyai/orca.git
synced 2026-09-27 16:02:35 +00:00
* ci: scope orcad smoke and parallelize Linux package formats * ci: validate packaging when its copy dependency changes --------- Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
import { build } from 'esbuild'
|
|
import { mkdtempSync, rmSync } from 'node:fs'
|
|
import { tmpdir } from 'node:os'
|
|
import { join, resolve } from 'node:path'
|
|
import { pathToFileURL } from 'node:url'
|
|
|
|
const root = resolve(import.meta.dirname, '../..')
|
|
const temporary = mkdtempSync(join(tmpdir(), 'orca-script-child-process-'))
|
|
const output = join(temporary, 'child-process.mjs')
|
|
let implementation
|
|
|
|
try {
|
|
await build({
|
|
stdin: {
|
|
contents: [
|
|
`export { runProcessSync, spawnProcess } from ${JSON.stringify(join(root, 'src/shared/child-process/run-process.ts'))}`
|
|
].join('\n'),
|
|
resolveDir: root,
|
|
sourcefile: 'script-child-process-entry.ts'
|
|
},
|
|
bundle: true,
|
|
platform: 'node',
|
|
target: 'node20',
|
|
format: 'esm',
|
|
outfile: output,
|
|
logLevel: 'silent'
|
|
})
|
|
implementation = await import(pathToFileURL(output).href)
|
|
} finally {
|
|
rmSync(temporary, { recursive: true, force: true })
|
|
}
|
|
|
|
export const runProcessSync = implementation.runProcessSync
|
|
|
|
export const spawnProcess = implementation.spawnProcess
|