Repository navigation
feat(init): use Vite+ for new Worker projects #446
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
Open
irvinebroque
wants to merge
10
commits into
main
Choose a base branch
from
codex/viteplus-project-defaults
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.
+247
−38
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f6480de
feat(init): use Vite+ for new Worker projects
irvinebroque 682c46d
Support pnpm 10 when creating standalone Workers
irvinebroque 7730488
Keep CLI shebang line endings portable when packing on Windows
irvinebroque e1fe90f
ci: remove standalone init integration matrix
irvinebroque f259856
refactor: rely on upstream Vite+ command detection
irvinebroque 7c287ac
chore: remove unrelated line ending change
irvinebroque f2a7307
chore: keep autoconfig release prerequisite in PR description
irvinebroque 8a0556e
fix(init): support Yarn node_modules and document Vite+ scaffolds
irvinebroque 504f5b7
fix(init): consume Vite+ autoconfig preview and preserve vinext commands
irvinebroque 8e801ab
fix(init): pin autoconfig preview that preserves custom builds
irvinebroque 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| "cf": minor | ||
| --- | ||
|
|
||
| Initialize Workers with Vite+ checks, formatting, and Workers-runtime tests. Align Vite and Vitest across supported package managers while keeping cf responsible for development, builds, and deployment. | ||
|
|
||
| Use the project-local `vp` executable for Vite+ development and builds. This avoids downloading a separate Vite with npm or failing to find a `vite` executable with pnpm. |
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
52 changes: 52 additions & 0 deletions
52
packages/cli/src/__tests__/lib/autoconfig-vite-plus.test.ts
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,52 @@ | ||
| import { runInTempDir, seed } from "@cloudflare/workers-utils/test-helpers"; | ||
| import { expect, it } from "vite-plus/test"; | ||
| import { renderWorkerTemplate } from "../../commands/init/template.js"; | ||
| import { analyzeProject } from "../../lib/autoconfig.js"; | ||
|
|
||
| runInTempDir(); | ||
|
|
||
| it("detects Vite+ commands using the installed autoconfig dependency", async () => { | ||
| await seed({ | ||
| ...renderWorkerTemplate({ | ||
| name: "my-worker", | ||
| compatibilityDate: "2026-10-29", | ||
| cfVersion: "0.1.0", | ||
| packageManager: "npm", | ||
| }), | ||
| "package-lock.json": "{}", | ||
| }); | ||
| const details = await analyzeProject(process.cwd(), { output: "silent" }); | ||
| expect(details).toMatchObject({ | ||
| configured: true, | ||
| devCommand: "npx vp dev", | ||
| buildCommand: "npx vp build", | ||
| }); | ||
| }); | ||
|
|
||
| it.each([false, true])( | ||
| "detects vinext commands with Vite+ enabled: %s", | ||
| async (vitePlus) => { | ||
| await seed({ | ||
| "package.json": JSON.stringify({ | ||
| dependencies: { next: "^16.0.0", vinext: "^0.0.1" }, | ||
| ...(vitePlus && { devDependencies: { "vite-plus": "1.4.0" } }), | ||
| }), | ||
| "package-lock.json": "{}", | ||
| "node_modules/next/package.json": JSON.stringify({ | ||
| name: "next", | ||
| version: "16.0.0", | ||
| }), | ||
| "node_modules/vinext/package.json": JSON.stringify({ | ||
| name: "vinext", | ||
| version: "0.0.1", | ||
| }), | ||
| }); | ||
| const details = await analyzeProject(process.cwd(), { output: "silent" }); | ||
| const command = vitePlus ? "vp" : "vite"; | ||
| expect(details).toMatchObject({ | ||
| configured: true, | ||
| devCommand: `npx ${command} dev`, | ||
| buildCommand: `npx ${command} build`, | ||
| }); | ||
| } | ||
| ); |
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
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.
Uh oh!
There was an error while loading. Please reload this page.