Skip to content

Conversation

@adriandlam
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Oct 29, 2025

⚠️ No Changeset found

Latest commit: 2004e40

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Oct 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview Comment Oct 30, 2025 9:46pm
example-nextjs-workflow-webpack Ready Ready Preview Comment Oct 30, 2025 9:46pm
example-workflow Ready Ready Preview Comment Oct 30, 2025 9:46pm
workbench-express-workflow Error Error Oct 30, 2025 9:46pm
workbench-nitro-workflow Ready Ready Preview Comment Oct 30, 2025 9:46pm
workbench-sveltekit-workflow Ready Ready Preview Comment Oct 30, 2025 9:46pm
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
workflow-docs Skipped Skipped Oct 30, 2025 9:46pm

@socket-security
Copy link

socket-security bot commented Oct 29, 2025

@vercel vercel bot temporarily deployed to Preview – workflow-docs October 29, 2025 00:45 Inactive
@vercel vercel bot temporarily deployed to Preview – workflow-docs October 29, 2025 05:57 Inactive
@vercel vercel bot temporarily deployed to Preview – workflow-docs October 30, 2025 02:12 Inactive
Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments:

packages/cli/src/lib/config/types.ts (lines 42-46):
The isValidBuildTarget function doesn't include the new 'sveltekit' build target in its validation logic, so users trying to build with --target sveltekit will have their target silently changed to 'standalone'.

View Details
📝 Patch Details
diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts
index c9ddaf5..bb23067 100644
--- a/packages/cli/src/commands/build.ts
+++ b/packages/cli/src/commands/build.ts
@@ -1,8 +1,9 @@
 import { Args, Flags } from '@oclif/core';
 import { BaseCommand } from '../base.js';
+import { NextBuilder } from '../lib/builders/next-build.js';
 import { VercelBuildOutputAPIBuilder } from '../lib/builders/vercel-build-output-api.js';
 import { StandaloneBuilder } from '../lib/builders/standalone.js';
-import { type BuildTarget, isValidBuildTarget } from '../lib/config/types.js';
+import { type BuildTarget, isValidBuildTarget, validBuildTargets } from '../lib/config/types.js';
 import { getWorkflowConfig } from '../lib/config/workflow-config.js';
 
 export default class Build extends BaseCommand {
@@ -18,7 +19,7 @@ export default class Build extends BaseCommand {
     target: Flags.string({
       char: 't',
       description: 'build target',
-      options: ['standalone', 'vercel-build-output-api'],
+      options: validBuildTargets,
       default: 'standalone',
     }),
     'workflow-manifest': Flags.string({
@@ -61,7 +62,7 @@ export default class Build extends BaseCommand {
       this.logWarn(
         `Invalid target "${buildTarget}". Using default "standalone".`
       );
-      this.logWarn('Valid targets: standalone, vercel-build-output-api');
+      this.logWarn(`Valid targets: ${validBuildTargets.join(', ')}`);
       buildTarget = 'standalone';
     }
 
@@ -82,6 +83,14 @@ export default class Build extends BaseCommand {
         this.logInfo('Building with VercelBuildOutputAPIBuilder');
         const builder = new VercelBuildOutputAPIBuilder(config);
         await builder.build();
+      } else if (config.buildTarget === 'next') {
+        this.logInfo('Building with NextBuilder');
+        const builder = new NextBuilder(config);
+        await builder.build();
+      } else if (config.buildTarget === 'sveltekit') {
+        this.logInfo('Building with StandaloneBuilder (SvelteKit support)');
+        const builder = new StandaloneBuilder(config);
+        await builder.build();
       } else {
         this.error(`Unknown build target: ${config.buildTarget}`);
       }
diff --git a/packages/cli/src/lib/config/types.ts b/packages/cli/src/lib/config/types.ts
index b4d729c..a278673 100644
--- a/packages/cli/src/lib/config/types.ts
+++ b/packages/cli/src/lib/config/types.ts
@@ -42,5 +42,5 @@ export interface WorkflowConfig {
 export function isValidBuildTarget(
   target: string | undefined
 ): target is BuildTarget {
-  return target === 'standalone' || target === 'vercel-build-output-api';
+  return validBuildTargets.includes(target as any);
 }

Analysis

isValidBuildTarget doesn't validate 'next' and 'sveltekit' targets

What fails: The isValidBuildTarget() function in packages/cli/src/lib/config/types.ts only validates 'standalone' and 'vercel-build-output-api', missing the 'next' and 'sveltekit' targets that are defined in the validBuildTargets array.

How to reproduce:

cd packages/cli
npm run build -- --target next

Result: Returns validation error "Invalid target 'next'. Using default 'standalone'." and silently falls back to building standalone instead of next.

Expected: The validation should pass since 'next' is a valid target in the validBuildTargets array, and the build should proceed with the NextBuilder.

Root causes:

  1. isValidBuildTarget() used hardcoded string checks instead of checking against validBuildTargets array
  2. build.ts CLI flags options array was not updated to include 'next' and 'sveltekit'
  3. build.ts lacked handler branches for 'next' and 'sveltekit' build targets
  4. NextBuilder was not imported despite being needed for the 'next' target

Fixes applied:

  • Updated isValidBuildTarget() to check: return validBuildTargets.includes(target as any);
  • Updated build.ts to import validBuildTargets and NextBuilder
  • Updated CLI flags options to use validBuildTargets array dynamically
  • Updated validation error message to dynamically list all valid targets
  • Added handler branches for 'next' target (uses NextBuilder) and 'sveltekit' target (uses StandaloneBuilder which has built-in SvelteKit support via BaseBuilder)

@adriandlam adriandlam force-pushed the feat/add-sveltekit-support branch from 904afa6 to c4ec230 Compare October 30, 2025 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants