Open IrwinJames-FS opened 13 hours ago
Below, you’ll find specific commands for each package manager, along with templates tailored for different JavaScript frameworks. Feel free to edit or add comments on each command example to clarify or refine for your needs.
Plan: Close this issue out with final cmd decided
Pros: Automating Vite project setup saves time and boosts efficiency, especially in scripting and CI/CD workflows. Using non-interactive commands ensures consistency and eliminates manual input errors.
Cons: Limited customization during setup might require additional configuration steps later, especially for projects needing tailored setups.
To create a new Vite project using npm without any interactive prompts:
npm create vite@latest my-project -- --template react
Explanation:
create vite@latest
initializes the latest version of Vitemy-project
sets the name for the new project-- --template react
specifies the React templateSource: Vite Official Guide - npm Command
If you prefer using yarn:
yarn create vite my-project --template react
Explanation:
create vite
is used with yarn to initialize the Vite setupmy-project
names the project folder--template react
specifies the React templateSource: Yarn Guide - Vite Template Usage
For pnpm users:
pnpm create vite my-project -- --template react
Explanation:
create vite
starts the Vite CLImy-project
is the project name-- --template react
defines React as the project templateSource: PNPM Documentation - Template Setup
To create a Vite project with a Vue template using npm:
npm create vite@latest my-vue-app -- --template vue
Explanation:
my-vue-app
is the specified project name-- --template vue
sets Vue as the project templateSource: Vue CLI - Vite Integration
Vite supports a range of templates. Here are some additional commands for different frameworks:
Vanilla JavaScript Template:
npm create vite@latest my-vanilla-app -- --template vanilla
TypeScript with React:
npm create vite@latest my-react-ts-app -- --template react-ts
Svelte Template:
npm create vite@latest my-svelte-app -- --template svelte
Explanation: Each command follows the same structure with my-app-name as the project name and the appropriate --template option for the desired framework.
Vite Official Guide - npm Command
Provides an overview and usage instructions for creating a Vite project using npm commands.
Yarn Guide - Vite Template Usage
Outlines how to use Yarn for initializing projects, including setting up a Vite project with templates.
PNPM Documentation - Template Setup
Describes how to use pnpm to create projects, with specific instructions for creating a Vite project.
Vue CLI - Vite Integration
Details integrating Vue with Vite and using Vite's CLI for non-interactive project setups.
Vite Template Documentation
Explains Vite's supported templates and their setup, offering examples across various frameworks.
Framework | Command |
---|---|
React (npm) | npm create vite@latest my-project -- --template react |
React (yarn) | yarn create vite my-project --template react |
React (pnpm) | pnpm create vite my-project -- --template react |
Vue | npm create vite@latest my-vue-app -- --template vue |
Vanilla JS | npm create vite@latest my-vanilla-app -- --template vanilla |
React TS | npm create vite@latest my-react-ts-app -- --template react-ts |
Svelte | npm create vite@latest my-svelte-app -- --template svelte |
For more details, refer to the Vite Documentation.
This non-interactive setup is efficient and adaptable to various workflows, allowing automated project creation without manual intervention.
Find a cli command option that will create a vite project without needing to interact with vite cli interface.