2026-05-02 23:33:38 +00:00
|
|
|
import { InstanceRuntime } from "../project/instance-runtime"
|
2026-05-15 11:00:54 +00:00
|
|
|
import { context } from "../project/instance-context"
|
2025-06-27 15:29:20 +00:00
|
|
|
|
2025-09-01 21:15:49 +00:00
|
|
|
export async function bootstrap<T>(directory: string, cb: () => Promise<T>) {
|
2026-05-15 11:00:54 +00:00
|
|
|
const ctx = await InstanceRuntime.load({ directory })
|
|
|
|
|
try {
|
|
|
|
|
return await context.provide(ctx, cb)
|
|
|
|
|
} finally {
|
|
|
|
|
await InstanceRuntime.disposeInstance(ctx)
|
|
|
|
|
}
|
2025-06-27 15:29:20 +00:00
|
|
|
}
|