Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "vercel/workflow" }
],
"changelog": ["@changesets/changelog-github", { "repo": "vercel/workflow" }],
"commit": false,
"fixed": [],
"linked": [],
Expand All @@ -22,6 +19,7 @@
"@workflow/example-nuxt",
"@workflow/example-vite",
"@workflow/example-sveltekit",
"@workflow/example-astro"
"@workflow/example-astro",
"@workflow/example-elysiajs-node"
]
}
3 changes: 2 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"@workflow/rollup": "4.0.0-beta.1",
"@workflow/astro": "4.0.0-beta.1",
"@workflow/example-fastify": "0.0.0",
"@workflow/vite": "4.0.0-beta.1"
"@workflow/vite": "4.0.0-beta.1",
"@workflow/example-elysiajs-node": "0.0.0"
},
"changesets": [
"add-documentation",
Expand Down
1 change: 1 addition & 0 deletions packages/core/e2e/local-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe.each([
'express',
'fastify',
'astro',
'elysiajs-node',
])('e2e', (project) => {
test('builds without errors', { timeout: 180_000 }, async () => {
// skip if we're targeting specific app to test
Expand Down
818 changes: 673 additions & 145 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions scripts/create-test-matrix.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ const DEV_TEST_CONFIGS = {
apiFileImportPath: '../..',
workflowsDir: 'src/workflows',
},
'elysiajs-node': {
generatedStepPath: 'node_modules/.nitro/workflow/steps.mjs',
generatedWorkflowPath: 'node_modules/.nitro/workflow/workflows.mjs',
apiFilePath: './src/index.ts',
apiFileImportPath: '..',
},
};

const matrix = {
Expand Down Expand Up @@ -137,4 +143,10 @@ matrix.app.push({
...DEV_TEST_CONFIGS.astro,
});

matrix.app.push({
name: 'elysiajs-node',
project: 'workbench-elysia-workflow',
...DEV_TEST_CONFIGS.elysiajs,
});

console.log(JSON.stringify(matrix));
49 changes: 49 additions & 0 deletions workbench/elysiajs-node/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel

**/*.trace
**/*.zip
**/*.tar.gz
**/*.tgz
**/*.log
package-lock.json
**/*.bun

# workflow
.workflow-data
_workflow.ts

# nitro
.output
30 changes: 30 additions & 0 deletions workbench/elysiajs-node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Workflows with ElysiaJS Node (Nitro v3)

- Learn more about ElysiaJS: https://elysiajs.com/
- Learn more about Nitro: https://v3.nitro.build/

## Commands

**Local development:**

```sh
npm run dev
```

**Production build (Vercel):**

```sh
NITRO_PRESET=vercel npm run build
npx vercel --prebuilt
```

**Production build (Bun):**

```sh
npm run build
bun run .output/server/index.mjs
```

## Limitations

Currently, Nitro does not support passing `idleTimeout` to the underlying Bun server that ElysiaJS uses. By default, Bun sets `idleTimeout = 10` seconds, which means workflow suspensions over 10 seconds will fail.
28 changes: 28 additions & 0 deletions workbench/elysiajs-node/_workflows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Auto-generated by workbench/scripts/generate-workflows-registry.js
// Do not edit this file manually - it will be regenerated on build

import * as workflow_0_demo from './workflows/0_demo';
import * as workflow_1_simple from './workflows/1_simple';
import * as workflow_2_control_flow from './workflows/2_control_flow';
import * as workflow_3_streams from './workflows/3_streams';
import * as workflow_4_ai from './workflows/4_ai';
import * as workflow_5_hooks from './workflows/5_hooks';
import * as workflow_6_batching from './workflows/6_batching';
import * as workflow_7_full from './workflows/7_full';
import * as workflow_97_bench from './workflows/97_bench';
import * as workflow_98_duplicate_case from './workflows/98_duplicate_case';
import * as workflow_99_e2e from './workflows/99_e2e';

export const allWorkflows = {
'workflows/0_demo.ts': workflow_0_demo,
'workflows/1_simple.ts': workflow_1_simple,
'workflows/2_control_flow.ts': workflow_2_control_flow,
'workflows/3_streams.ts': workflow_3_streams,
'workflows/4_ai.ts': workflow_4_ai,
'workflows/5_hooks.ts': workflow_5_hooks,
'workflows/6_batching.ts': workflow_6_batching,
'workflows/7_full.ts': workflow_7_full,
'workflows/97_bench.ts': workflow_97_bench,
'workflows/98_duplicate_case.ts': workflow_98_duplicate_case,
'workflows/99_e2e.ts': workflow_99_e2e,
} as const;
14 changes: 14 additions & 0 deletions workbench/elysiajs-node/nitro.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineNitroConfig } from 'nitro/config';

export default defineNitroConfig({
modules: ['workflow/nitro'],
vercel: { entryFormat: 'node' },
routes: {
'/**': './src/index.ts',
},
// NOTE: `bun` preset doesn't work as expected since Nitro does not pass
// the `idleTimeout` option through Elysia, causing workflow suspensions > 10s
// to fail
// preset: "bun"
plugins: ['plugins/start-pg-world.ts'],
});
32 changes: 32 additions & 0 deletions workbench/elysiajs-node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@workflow/example-elysiajs-node",
"version": "0.0.0",
"private": true,
"description": "",
"type": "module",
"main": "index.js",
"scripts": {
"generate:workflows": "node ../scripts/generate-workflows-registry.js",
"predev": "pnpm generate:workflows",
"prebuild": "pnpm generate:workflows",
"build": "nitro build",
"dev": "nitro dev",
"start": "node .output/server/index.mjs"
},
"dependencies": {
"@workflow/world-postgres": "workspace:*",
"elysia": "latest",
"nitro": "catalog:",
"workflow": "workspace:*"
},
"devDependencies": {
"bun": "latest",
"bun-types": "latest",
"rollup": "^4.53.3",
"ai": "catalog:",
"lodash.chunk": "^4.2.0",
"openai": "^6.1.0",
"workflow": "workspace:*",
"zod": "catalog:"
}
}
1 change: 1 addition & 0 deletions workbench/elysiajs-node/plugins
Loading
Loading