-
Notifications
You must be signed in to change notification settings - Fork 141
feat: add nestjs support #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
adriandlam
wants to merge
35
commits into
main
Choose a base branch
from
feat/nestjs-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
ef3dba6
chore: init nestjs project
adriandlam 3d13545
chore: cleanup nestjs app
adriandlam 1ba56e4
feat: setup nestjs routes and workflows symlink
adriandlam 0a914a9
feat: add @workflow/nestjs package
adriandlam 737497e
fix: add .gitignore to workflow bundles
adriandlam 500a548
cleanup
adriandlam 2165e0e
clenaup
adriandlam 3cd4684
rename
adriandlam a860ae2
remove symlink temp
adriandlam d3f59a1
lockfile
adriandlam 0e09106
license
adriandlam c9302e1
test: add nestjs
adriandlam 6b0e9cc
lockfile
adriandlam 3e9bdf1
fix: express hook api
adriandlam 7b3eb4c
add pg init for ci test
adriandlam 3ca646b
fix: use @swc/core catalog
adriandlam fc19447
fix: pg init
adriandlam bb0826f
fix: nest http exception
adriandlam 2bc19d6
test
adriandlam 5cc5d88
Remove dist from tracking
adriandlam a570ffe
update
adriandlam aad7e7c
.
adriandlam 82dd4ff
fix: nest pg init
adriandlam 14f115e
test: add nest to lcoal build test
adriandlam ccc516a
chore: add nest app to changeset ignore
adriandlam bc5e07f
test
adriandlam aa2e021
Update packages/nest/package.json
adriandlam e19bf2b
changeset
adriandlam bf77a71
feat: add nest vercel builder
adriandlam 030c5dd
test
adriandlam 9da61ba
test
adriandlam 2125e69
updage
adriandlam 8aa65e2
feat: add nest cli builder
adriandlam c10f185
update
adriandlam a5cb073
lockfile
adriandlam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "@workflow/builders": patch | ||
| "workflow": patch | ||
| "@workflow/core": patch | ||
| "@workflow/nest": patch | ||
| --- | ||
|
|
||
| Add @workflow/nest package for NestJS integration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../../LICENSE.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "name": "@workflow/nest", | ||
| "version": "4.0.0-beta.1", | ||
| "description": "NestJS integration for Workflow DevKit", | ||
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "license": "Apache-2.0", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "https://github.com/vercel/workflow.git", | ||
| "directory": "packages/nest" | ||
| }, | ||
| "exports": { | ||
| ".": "./dist/index.js" | ||
| }, | ||
| "bin": { | ||
| "workflow-nest-build": "./dist/bin/build.js" | ||
| }, | ||
| "scripts": { | ||
| "build": "tsc", | ||
| "dev": "tsc --watch", | ||
| "clean": "tsc --build --clean && rm -rf dist" | ||
| }, | ||
| "dependencies": { | ||
| "@nestjs/common": "^11.1.9", | ||
| "@nestjs/core": "^11.1.9", | ||
| "@nestjs/schematics": "^11.0.9", | ||
| "@swc/core": "catalog:", | ||
| "@workflow/builders": "workspace:*", | ||
| "@workflow/core": "workspace:*", | ||
| "@workflow/swc-plugin": "workspace:*", | ||
| "exsolve": "1.0.7", | ||
| "pathe": "2.0.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "catalog:", | ||
| "@workflow/tsconfig": "workspace:*" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| import { | ||
| BaseBuilder, | ||
| createBaseBuilderConfig, | ||
| VercelBuildOutputAPIBuilder, | ||
| } from '@workflow/builders'; | ||
| import { join } from 'pathe'; | ||
| import { mkdir, writeFile } from 'node:fs/promises'; | ||
|
|
||
| export class LocalBuilder extends BaseBuilder { | ||
| #outDir: string; | ||
|
|
||
| constructor() { | ||
| const workingDir = process.cwd(); | ||
| const outDir = join(workingDir, '.nestjs/workflow'); | ||
| super({ | ||
| ...createBaseBuilderConfig({ | ||
| workingDir: workingDir, | ||
| dirs: ['src'], | ||
| }), | ||
| buildTarget: 'nest', | ||
| }); | ||
| this.#outDir = outDir; | ||
| } | ||
|
|
||
| async build() { | ||
| const inputFiles = await this.getInputFiles(); | ||
| await mkdir(this.#outDir, { recursive: true }); | ||
|
|
||
| await this.createWorkflowsBundle({ | ||
| outfile: join(this.#outDir, 'workflows.mjs'), | ||
| bundleFinalOutput: false, | ||
| format: 'esm', | ||
| inputFiles, | ||
| }); | ||
|
|
||
| await this.createStepsBundle({ | ||
| outfile: join(this.#outDir, 'steps.mjs'), | ||
| externalizeNonSteps: true, | ||
| format: 'esm', | ||
| inputFiles, | ||
| }); | ||
|
|
||
| await this.createWebhookBundle({ | ||
| outfile: join(this.#outDir, 'webhook.mjs'), | ||
| bundle: false, | ||
| }); | ||
|
|
||
| if (process.env.VERCEL_DEPLOYMENT_ID === undefined) { | ||
| await writeFile(join(this.#outDir, '.gitignore'), '*'); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export class VercelBuilder extends VercelBuildOutputAPIBuilder { | ||
| constructor() { | ||
| super({ | ||
| ...createBaseBuilderConfig({ | ||
| workingDir: process.cwd(), | ||
| dirs: ['src'], | ||
| }), | ||
| buildTarget: 'vercel-build-output-api', | ||
| }); | ||
| } | ||
| override async build(): Promise<void> { | ||
| // const configPath = join( | ||
| // this.config.workingDir, | ||
| // ".vercel/output/config.json", | ||
| // ); | ||
| // const originalConfig = JSON.parse(await readFile(configPath, "utf-8")); | ||
| await super.build(); | ||
| // const newConfig = JSON.parse(await readFile(configPath, "utf-8")); | ||
| // originalConfig.routes.unshift(...newConfig.routes); | ||
| // await writeFile(configPath, JSON.stringify(originalConfig, null, 2)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { WorkflowModule } from './workflow.module.js'; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package.json declares a bin command
workflow-nest-buildpointing to./dist/bin/build.js, but there is no correspondingsrc/bin/build.tssource file in the package, so this file won't be created during the build process.View Details
📝 Patch Details
Analysis
Missing src/bin/build.ts causes package bin entry to fail
What fails: The
@workflow/nestpackage declares a bin entryworkflow-nest-buildpointing to./dist/bin/build.jsin package.json (line 22-24), but the corresponding source filesrc/bin/build.tswas deleted in commit 0c4bd03 without updating the package.json manifest.How to reproduce:
Result: The file
packages/nest/src/bin/build.tsdoes not exist, so:dist/bin/build.jsduring the build processworkflow-nest-buildcommand will fail with "command not found"Expected: The bin entry in package.json should either:
src/bin/build.tsfile (which was created in commit 5f1d55b but accidentally deleted in 0c4bd03), orFix: Restored the deleted
src/bin/build.tsfile with the implementation that provides theworkflow-nest-buildCLI command for building workflows locally or for Vercel deployment.