Files
vercel__workflow/workbench/astro/scripts/start-with-pg.mjs
JJ Kasper 0f557d5ae4 Statically inject workflow world target (#2752)
* Statically inject workflow world target

* Fix static world injection in host bundles

* Fix static world injection gaps

* Fix Vite Nitro server startup

* Fix Nitro pg-native aliasing

* Fix static world target CI gaps

* Fix static world dev rebuild gaps

* Avoid broad runtime alias in Nitro

* Refresh Next dev route for step HMR

* Externalize Nest target world

* Use canary HMR rediscovery timeout

* Bundle local world in Nest builds

* Dedupe world target helpers and fix SvelteKit chunk patch guard
2026-07-06 14:19:45 -07:00

28 lines
818 B
JavaScript

#!/usr/bin/env node
// Start the Postgres World before starting the Astro server
// Needed since we test this in CI
// Astro doesn't have a hook for starting the Postgres World in production
import { createWorld as createPostgresWorld } from '@workflow/world-postgres';
import { setWorld } from 'workflow/runtime';
async function main() {
if (process.env.WORKFLOW_TARGET_WORLD === '@workflow/world-postgres') {
console.log('Starting Postgres World...');
const world = await createPostgresWorld();
setWorld(world);
if (world.start) {
console.log('Starting World workers...');
await world.start();
}
}
// Now start the Astro server
await import('../dist/server/entry.mjs');
}
main().catch((error) => {
console.error('Failed to start server:', error);
process.exit(1);
});