-
Notifications
You must be signed in to change notification settings - Fork 56
feat: create @workflow/builders package with shared builder infrastructure #73
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: a4adba7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| import { mkdir, writeFile } from 'node:fs/promises'; | ||
| import { join, resolve } from 'node:path'; | ||
| import { BaseBuilder } from './base-builder.js'; | ||
| import { BaseBuilder } from '@workflow/builders'; |
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.
will be moving these builders over in future PRs
| @@ -1,6 +1,6 @@ | |||
| import { mkdir } from 'node:fs/promises'; | |||
| import { dirname, resolve } from 'node:path'; | |||
| import { BaseBuilder } from './base-builder.js'; | |||
| import { BaseBuilder } from '@workflow/builders'; | |||
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.
will be moving these builders over in future PRs
5dc881f to
ef1417a
Compare
f348c63 to
736b61a
Compare
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.
🔧 Build Fix:
The index.ts file was importing constants from a non-existent constants.js file, causing TypeScript compilation to fail.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..32a74a6 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,3 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
Analysis
Missing constants.js file causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts at line 11 due to missing constants.js file
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.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.
🔧 Build Fix:
The constants.ts file was missing but required by index.ts for exporting STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER constants.
View Details
📝 Patch Details
diff --git a/packages/builders/src/constants.ts b/packages/builders/src/constants.ts
new file mode 100644
index 0000000..97e01ae
--- /dev/null
+++ b/packages/builders/src/constants.ts
@@ -0,0 +1,2 @@
+export const STEP_QUEUE_TRIGGER = 'step' as const;
+export const WORKFLOW_QUEUE_TRIGGER = 'workflow' as const;
\ No newline at end of file
Analysis
Missing constants file causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to missing constants module
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.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.
🔧 Build Fix:
The file imports constants from a non-existent ./constants.js module, causing TypeScript compilation to fail.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+
Analysis
Missing constants.js module causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts due to missing import of non-existent ./constants.js file
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.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.
🔧 Build Fix:
The file tried to import constants from a non-existent ./constants.js module, causing TypeScript compilation to fail. The unused export statement was removed since the constants weren't referenced anywhere in the codebase.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+
Analysis
Missing constants file causes TypeScript compilation failure
What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to import from non-existent ./constants.js module
How to reproduce:
cd packages/builders && npx tscResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.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.
🔧 Build Fix:
The TypeScript compiler failed because line 11 attempts to import STEP_QUEUE_TRIGGER and WORKFLOW_QUEUE_TRIGGER from a non-existent constants.js file. This import was added during the builders package creation but the constants file was never created.
View Details
📝 Patch Details
diff --git a/packages/builders/src/index.ts b/packages/builders/src/index.ts
index a305ca5..396d2cd 100644
--- a/packages/builders/src/index.ts
+++ b/packages/builders/src/index.ts
@@ -8,4 +8,4 @@ export { applySwcTransform } from './apply-swc-transform.js';
export { createDiscoverEntriesPlugin } from './discover-entries-esbuild-plugin.js';
export { createNodeModuleErrorPlugin } from './node-module-esbuild-plugin.js';
export { createSwcPlugin } from './swc-esbuild-plugin.js';
-export { STEP_QUEUE_TRIGGER, WORKFLOW_QUEUE_TRIGGER } from './constants.js';
+
Analysis
TypeScript compilation failure due to missing constants file
What fails: TypeScript compiler fails on packages/builders/src/index.ts line 11 due to import from non-existent './constants.js' file
How to reproduce:
cd packages/builders && pnpm run buildResult:
src/index.ts(11,60): error TS2307: Cannot find module './constants.js' or its corresponding type declarations.736b61a to
738a512
Compare
| export function isValidBuildTarget( | ||
| target: string | undefined | ||
| ): target is BuildTarget { | ||
| return target === 'standalone' || target === 'vercel-build-output-api'; |
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.
| return target === 'standalone' || target === 'vercel-build-output-api'; | |
| return ( | |
| target === 'standalone' || | |
| target === 'vercel-build-output-api' || | |
| target === 'next' | |
| ); |
The isValidBuildTarget function doesn't validate the 'next' build target even though it's included in the validBuildTargets array and is a valid BuildTarget type.
View Details
Analysis
isValidBuildTarget() function doesn't validate the 'next' build target
What fails: The isValidBuildTarget() type guard function in packages/builders/src/types.ts only validates 'standalone' and 'vercel-build-output-api', but the BuildTarget type includes 'next' from the validBuildTargets array. This breaks the type safety contract of the function.
How to reproduce:
const validBuildTargets = ['standalone', 'vercel-build-output-api', 'next'] as const;
type BuildTarget = (typeof validBuildTargets)[number];
function isValidBuildTarget(target: string | undefined): target is BuildTarget {
return target === 'standalone' || target === 'vercel-build-output-api';
}
// In packages/next/src/index.ts line 92, 'next' is used:
const config = { buildTarget: 'next' as BuildTarget }; // Valid type
isValidBuildTarget(config.buildTarget); // Returns false - inconsistency!Result: isValidBuildTarget('next') returns false even though 'next' is:
- Present in the
validBuildTargetsarray (line 4) - A valid
BuildTargettype value (line 6) - Used in real code (packages/next/src/index.ts:92, packages/cli/src/lib/builders/webhook-route.test.ts:26,71,104, packages/nitro/src/builders.ts:8)
Expected: The type guard should validate all values in the validBuildTargets array to maintain consistency with the BuildTarget type definition in strict TypeScript mode.
Fix verified: Updated the type guard to include 'next':
return (
target === 'standalone' ||
target === 'vercel-build-output-api' ||
target === 'next'
);All tests pass, including webhook-route.test.ts tests that use buildTarget: 'next'.
…cture This commit extracts builder infrastructure from @workflow/cli into a new shared @workflow/builders package. This improves code organization by: - Creating a dedicated package for builder functionality - Allowing @workflow/next and @workflow/nitro to depend on builders directly - Reducing coupling between framework integrations and the CLI - Preparing for moving NextBuilder to @workflow/next in the next PR Changes: - Created new @workflow/builders package - Moved BaseBuilder, BasicBuilder, and VercelBuildOutputAPIBuilder - Moved esbuild plugins (swc, discover-entries, node-module) - Moved WorkflowConfig and BuildTarget types - Updated @workflow/cli to import from @workflow/builders - Updated @workflow/nitro to import from @workflow/builders - Re-exported types from CLI for backwards compatibility 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
738a512 to
a4adba7
Compare

This commit extracts builder infrastructure from @workflow/cli into a new
shared @workflow/builders package. This improves code organization by:
Changes:
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com