Skip to content

docs: add vite command builder for easier vite project scaffolding #20453

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

Closed
wants to merge 1 commit into from

Conversation

monarchwadia
Copy link

@monarchwadia monarchwadia commented Jul 22, 2025

Description

Fixes #20452

468926364-3f269f9e-b560-4e1f-8216-f4525c0d6862

Comment on lines 13 to 15
Vite (French word for "quickfunction buildField(label, input) {
return '<label style="display:block;margin-bottom:8px;">' + label + ' ' + input + '</label>';
}pronounced `/vit/`<button style="border:none;padding:3px;border-radius:4px;vertical-align:bottom" id="play-vite-audio" onclick="document.getElementById('vite-audio').play();"><svg style="height:2em;width:2em"><use href="/voice.svg?no-inline#voice" /></svg></button>, like "veet") is a build tool that aims to provide a faster and leaner development experience for modern web projects. It consists of two major parts:
Copy link
Contributor

Choose a reason for hiding this comment

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

There appears to be a JavaScript function accidentally inserted into the middle of the text description. The paragraph should read:

Vite (French word for "quick", pronounced `/vit/`<button style="border:none;padding:3px;border-radius:4px;vertical-align:bottom" id="play-vite-audio" onclick="document.getElementById('vite-audio').play();"><svg style="height:2em;width:2em"><use href="/voice.svg?no-inline#voice" /></svg></button>, like "veet") is a build tool...

Instead of having the buildField function definition breaking the sentence. This syntax error would cause rendering issues in the documentation.

Suggested change
Vite (French word for "quickfunction buildField(label, input) {
return '<label style="display:block;margin-bottom:8px;">' + label + ' ' + input + '</label>';
}pronounced `/vit/`<button style="border:none;padding:3px;border-radius:4px;vertical-align:bottom" id="play-vite-audio" onclick="document.getElementById('vite-audio').play();"><svg style="height:2em;width:2em"><use href="/voice.svg?no-inline#voice" /></svg></button>, like "veet") is a build tool that aims to provide a faster and leaner development experience for modern web projects. It consists of two major parts:
Vite (French word for "quick", pronounced `/vit/`<button style="border:none;padding:3px;border-radius:4px;vertical-align:bottom" id="play-vite-audio" onclick="document.getElementById('vite-audio').play();"><svg style="height:2em;width:2em"><use href="/voice.svg?no-inline#voice" /></svg></button>, like "veet") is a build tool that aims to provide a faster and leaner development experience for modern web projects. It consists of two major parts:

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

buildCommand: (projectName, template, useCurrentFolder) => {
const target = useCurrentFolder ? '.' : projectName || ''
const templateFlag = template ? ` --template ${template}` : ''
return `deno init --npm vite${target ? ` ${target}` : ''}${templateFlag}`
Copy link
Contributor

Choose a reason for hiding this comment

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

The Deno command implementation is incorrect. Deno doesn't support the init --npm vite syntax shown here.

For Deno to work with npm packages like create-vite, the correct syntax would be:

return `deno run --allow-read --allow-write --allow-env --allow-net --allow-run npm:create-vite${target ? ` ${target}` : ''}${templateFlag}`

This uses Deno's ability to run npm packages directly with the appropriate permissions.

Suggested change
return `deno init --npm vite${target ? ` ${target}` : ''}${templateFlag}`
return `deno run --allow-read --allow-write --allow-env --allow-net --allow-run npm:create-vite${target ? ` ${target}` : ''}${templateFlag}`

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Author

Choose a reason for hiding this comment

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

I'm just following the template that's already present in the docs.

image

@monarchwadia monarchwadia force-pushed the vite-command-builder branch from 0f175a2 to d27081b Compare July 22, 2025 03:02
Comment on lines +94 to +100
function getCommand() {
const toolObj = viteBuilderData.tools.find((x) => x.id === tool.value)
if (!toolObj) return ''
return toolObj.command
.replace('{name}', name.value || 'my-app')
.replace('{template}', getTemplate())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The getCommand function always includes the template parameter in the generated command, regardless of whether a template is selected. This differs from the Vue component implementation which conditionally adds the template flag only when a template is selected. Consider modifying this function to conditionally include the template parameter, similar to how it's handled in the Vue component:

function getCommand() {
  const toolObj = viteBuilderData.tools.find((x) => x.id === tool.value)
  if (!toolObj) return ''
  const templateStr = getTemplate() ? ` --template ${getTemplate()}` : ''
  return toolObj.command
    .replace('{name}', name.value || 'my-app')
    .replace(' --template {template}', templateStr)
}

This would ensure the command is correctly generated in all scenarios.

Suggested change
function getCommand() {
const toolObj = viteBuilderData.tools.find((x) => x.id === tool.value)
if (!toolObj) return ''
return toolObj.command
.replace('{name}', name.value || 'my-app')
.replace('{template}', getTemplate())
}
function getCommand() {
const toolObj = viteBuilderData.tools.find((x) => x.id === tool.value)
if (!toolObj) return ''
const templateStr = getTemplate() ? ` --template ${getTemplate()}` : ''
return toolObj.command
.replace('{name}', name.value || 'my-app')
.replace(' --template {template}', templateStr)
}

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

@monarchwadia monarchwadia changed the title Added vite command builder docs: Added vite command builder Jul 22, 2025
@monarchwadia monarchwadia changed the title docs: Added vite command builder docs: add vite command builder for easier vite project scaffolding Jul 22, 2025
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.

Vite command builder
1 participant