Repository navigation
[autoconfig] Use Vite+ commands for Vite+ projects #16588
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bfe5330
feat(create-cloudflare): adopt Vite+ in bundled Worker starters
irvinebroque 604fd24
Declare the Vite+ core explicitly in bundled starters
irvinebroque fe44840
Exclude dependencies and generated output from starter checks
irvinebroque 4461fa2
Use Vite Plus Node support range for Wrangler starters
irvinebroque a004a29
Isolate generated project package settings in Wrangler C3 integration…
irvinebroque e35c2c2
[autoconfig] Limit Vite+ support to project command detection
irvinebroque eeb6c0a
fix(autoconfig): normalize framework overrides for Vite+
irvinebroque faa0e96
fix(autoconfig): preserve shell build commands during Vite+ normaliza…
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 @@ | ||
| --- | ||
| "@cloudflare/autoconfig": patch | ||
| --- | ||
|
|
||
| Run the project-local Vite+ executable for Vite+ projects | ||
|
|
||
| Use `vp dev` and `vp build` when Vite+ is declared. Its Vite alias does not expose a `vite` executable, so invoking `vite` can fail with pnpm or cause npm to fetch a separate Vite. Preserve framework-owned commands and custom scripts. |
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
35 changes: 35 additions & 0 deletions
35
packages/autoconfig/tests/details/vite-plus-commands.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,35 @@ | ||
| import { NpmPackageManager } from "@cloudflare/workers-utils"; | ||
| import { describe, test } from "vitest"; | ||
| import { getProjectCommand } from "../../src/details"; | ||
|
|
||
| describe("Vite+ commands", () => { | ||
| test.for(["npx", "pnpm", "yarn", "bunx"])( | ||
| "uses the local toolchain through %s", | ||
| (npx, { expect }) => { | ||
| const manager = { ...NpmPackageManager, npx }; | ||
| const pkg = { devDependencies: { "vite-plus": "1.4.0" } }; | ||
| expect(getProjectCommand("vite", manager, pkg)).toBe(`${npx} vp dev`); | ||
| expect(getProjectCommand("vite dev", manager, pkg)).toBe(`${npx} vp dev`); | ||
| expect(getProjectCommand("vite build", manager, pkg)).toBe( | ||
| `${npx} vp build` | ||
| ); | ||
| expect(getProjectCommand(`${npx} vite build`, manager, pkg)).toBe( | ||
| `${npx} vp build` | ||
| ); | ||
| } | ||
| ); | ||
| test("preserves framework scripts and projects without Vite+", ({ | ||
| expect, | ||
| }) => { | ||
| const pkg = { dependencies: { "vite-plus": "1.4.0" } }; | ||
| expect(getProjectCommand("astro build", NpmPackageManager, pkg)).toBe( | ||
| "npx astro build" | ||
| ); | ||
| expect(getProjectCommand("npm run build", NpmPackageManager, pkg)).toBe( | ||
| "npm run build" | ||
| ); | ||
| expect(getProjectCommand("vite build", NpmPackageManager, {})).toBe( | ||
| "npx vite 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
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.