This repository includes a Bash script designed to automate the setup of a new React project using Vite with SWC and a suite of tools for efficient development and testing.
- Sets up a new React project using Vite with a TypeScript template.
- Creates necessary directories and navigates into the project.
- Adds the
@vitejs/plugin-react-swc
plugin for fast refresh using SWC. - Installs ESLint with TypeScript support and relevant plugins for code linting.
- Installs Vitest and Testing Library for robust unit and integration testing.
- Sets up Prettier for consistent code formatting.
- Configures convenient package scripts for development and testing.
- Generates configuration files for Vite, ESLint, Prettier, and Vitest with sensible defaults.
Before you begin, ensure you have the following installed on your system:
- Node.js (v20.9.0 or later)
- pnpm
- jq for processing JSON
- A Unix-like environment if you're on Windows (e.g., WSL, Git Bash)
To use the script, follow these steps:
-
Clone the repository or download the script to your local machine.
-
Make the script executable by running the following command:
chmod +x setup_project.sh
-
Run the bash file:
./setup_project.sh
-
Choose the poject folder:
Project path: /path/to/folder
-
Type a project name
Project name: Project name
The script will execute all steps and provide output on the terminal as it progresses.