mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 14:08:24 +00:00
feat(workflow): integrate temporal workflow bundles and support dev/prod mode
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
import { loadEnvConfig } from '@shumai/core/src/env-loader'
|
||||
loadEnvConfig(process.cwd(), process.env.NODE_ENV !== 'production')
|
||||
|
||||
import { workflowService } from '@shumai/workflow-core'
|
||||
import { TaskQueueTranscode } from '@shumai/workflow-core'
|
||||
import { initTranscodeWorkflows } from '@shumai/transcode'
|
||||
import { TaskQueueTranscode, workflowService } from '@shumai/workflow-core'
|
||||
|
||||
async function run() {
|
||||
// Initialize workflows and activities
|
||||
initTranscodeWorkflows()
|
||||
|
||||
console.log('🚀 Starting Transcode Worker...')
|
||||
await workflowService.startWorkers(TaskQueueTranscode)
|
||||
|
||||
const options: { workflowBundle?: unknown; workflowsPath?: string } = {}
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// @ts-ignore: Bun temporal plugin macro
|
||||
const { default: workflowBundle } = await import('./workflows:::workflow')
|
||||
options.workflowBundle = workflowBundle
|
||||
} else {
|
||||
options.workflowsPath = new URL('./workflows.ts', import.meta.url).pathname
|
||||
}
|
||||
|
||||
await workflowService.startWorkers(TaskQueueTranscode, options)
|
||||
}
|
||||
|
||||
run().catch((err) => {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from '@shumai/transcode/src/workflows/transcode'
|
||||
Reference in New Issue
Block a user