2026-06-01 23:35:00 +08:00
|
|
|
import { loadEnvConfig } from '@shumai/core/src/env-loader'
|
2026-05-19 16:05:09 +08:00
|
|
|
loadEnvConfig(process.cwd(), process.env.NODE_ENV !== 'production')
|
|
|
|
|
|
|
|
|
|
const command = process.argv[2]
|
|
|
|
|
|
|
|
|
|
if (command === 'worker') {
|
2026-06-01 23:35:00 +08:00
|
|
|
const { run } = await import('./worker')
|
2026-05-19 16:05:09 +08:00
|
|
|
run().catch((err) => {
|
|
|
|
|
console.error(err)
|
|
|
|
|
process.exit(1)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// Default or 'serve' command
|
2026-06-01 23:35:00 +08:00
|
|
|
const { run } = await import('./serve')
|
2026-05-19 16:05:09 +08:00
|
|
|
run().catch((err) => {
|
|
|
|
|
console.error(err)
|
|
|
|
|
process.exit(1)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Re-export AppType for frontend client.ts usage (type-only)
|
2026-06-01 23:35:00 +08:00
|
|
|
export type { AppType } from './serve'
|