-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
feat(create-vite): scaffold with rolldown-vite #20739
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
Changes from all commits
729d2c5
d73ae8e
f18874d
f63009c
4ba97e0
92ffd42
48f605d
9883245
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -23,10 +23,11 @@ const argv = mri<{ | |||||
| template?: string | ||||||
| help?: boolean | ||||||
| overwrite?: boolean | ||||||
| rolldown?: boolean | ||||||
| interactive?: boolean | ||||||
| }>(process.argv.slice(2), { | ||||||
| alias: { h: 'help', t: 'template' }, | ||||||
| boolean: ['help', 'overwrite', 'interactive'], | ||||||
| boolean: ['help', 'overwrite', 'rolldown', 'interactive'], | ||||||
| string: ['template'], | ||||||
| }) | ||||||
| const cwd = process.cwd() | ||||||
|
|
@@ -40,6 +41,7 @@ When running in TTY, the CLI will start in interactive mode. | |||||
|
|
||||||
| Options: | ||||||
| -t, --template NAME use a specific template | ||||||
| --rolldown / --no-rolldown use / do not use rolldown-vite (Experimental) | ||||||
| --interactive / --no-interactive force interactive / non-interactive mode | ||||||
|
|
||||||
| Available templates: | ||||||
|
|
@@ -348,6 +350,7 @@ async function init() { | |||||
| : undefined | ||||||
| const argTemplate = argv.template | ||||||
| const argOverwrite = argv.overwrite | ||||||
| const argRolldown = argv.rolldown | ||||||
| const argInteractive = argv.interactive | ||||||
|
|
||||||
| const help = argv.help | ||||||
|
|
@@ -525,6 +528,28 @@ async function init() { | |||||
| process.exit(status ?? 0) | ||||||
| } | ||||||
|
|
||||||
| let useRolldownVite = argRolldown | ||||||
| if (useRolldownVite === undefined) { | ||||||
| if (interactive) { | ||||||
| const rolldownViteValue = await prompts.select({ | ||||||
| message: 'Use rolldown-vite (Experimental)?:', | ||||||
| options: [ | ||||||
| { | ||||||
| label: 'Yes', | ||||||
| value: true, | ||||||
| hint: 'The future default Vite, which is powered by Rolldown', | ||||||
| }, | ||||||
| { label: 'No', value: false }, | ||||||
| ], | ||||||
| initialValue: false, | ||||||
| }) | ||||||
| if (prompts.isCancel(rolldownViteValue)) return cancel() | ||||||
| useRolldownVite = rolldownViteValue | ||||||
| } else { | ||||||
| useRolldownVite = false | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| prompts.log.step(`Scaffolding project in ${root}...`) | ||||||
|
|
||||||
| const templateDir = path.resolve( | ||||||
|
|
@@ -553,6 +578,27 @@ async function init() { | |||||
|
|
||||||
| pkg.name = packageName | ||||||
|
|
||||||
| if (useRolldownVite) { | ||||||
| // renovate: datasource=npm depName=rolldown-vite | ||||||
| const rolldownViteVersion = '7.1.12' | ||||||
| const pkgVersion = `npm:rolldown-vite@${rolldownViteVersion}` | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Should we use a caret here so it's not pinned? (I think it works but haven't tested)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll prefer to keep without it as rolldown-vite doesn't necessarily follow semver.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright. In that case, maybe the docs should also mention pinning to a version, but I'm happy to handle that separately.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Like this section?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or do you mean updating the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I mean the docs mentioning |
||||||
| pkg.devDependencies.vite = pkgVersion | ||||||
| switch (pkgManager) { | ||||||
| case 'pnpm': | ||||||
| pkg.pnpm ??= {} | ||||||
| pkg.pnpm.overrides ??= {} | ||||||
| pkg.pnpm.overrides.vite = pkgVersion | ||||||
| break | ||||||
| case 'yarn': | ||||||
| pkg.resolutions ??= {} | ||||||
| pkg.resolutions.vite = pkgVersion | ||||||
| break | ||||||
| default: | ||||||
| pkg.overrides ??= {} | ||||||
|
sapphi-red marked this conversation as resolved.
|
||||||
| pkg.overrides.vite = pkgVersion | ||||||
| } | ||||||
|
sapphi-red marked this conversation as resolved.
|
||||||
| } | ||||||
|
|
||||||
| write('package.json', JSON.stringify(pkg, null, 2) + '\n') | ||||||
|
|
||||||
| if (isReactSwc) { | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.