Click the Use this template
button above the file list, then use the Owner drop-down menu, and select the account you want to own the repository. Creating a repository from a template has the following advantages:
A repository created from a template starts with a single commit. Commits to a repository created from a template do appear in your contribution graph. Creating a repository from a template starts a new project quickly.
To get a local copy, clone it using:
git clone https://github.com/castromaciel/template-vite-react-ts.git
Or get it downloading
rm -rf .git && git init
git add .
git commit -m "Initial commit"
To install dependencies use one of the following commands:
npm install
yarn install
pnpm install
In this project, you can run the following scripts:
Script | Description |
---|---|
npm run build | Builds the app for production to the dist folder. |
npm run coverage | Runs tests with code coverage |
npm run dev | Runs the app in the development mode. |
npm run preview | Start a local web server that serves the built solution from ./dist for previewing |
npm run prepare | Install husky githooks |
npm run test | Runs tests with vitest. |
template-vite-react-ts
βββ .github
βββ workflows
βββ .husky
βββ pre-commit
βββ pre-push
βββ node_modules
βββ public
β βββ vite.svg
βββ src
βββ __tests__
βββ App.test.tsx
βββ assets
βββ react.svg
βββ components
βββ constants
βββ index.ts
βββ App.scss
βββ App.tsx
βββ index.scss
βββ main.tsx
βββ vite-env.d.ts
βββ .env.development
βββ .eslintignore
βββ .eslintrc.json
βββ .gitattributes
βββ .gitignore
βββ .lintstagedrc
βββ .npmrc
βββ index.html
βββ LICENSE
βββ package.json
βββ pnpm-lock.yaml
βββ README.md
βββ tsconfig.json
βββ tsconfig.node.json
βββ vite.config.js
βββ vitest.config.js
To create husky githooks, you need to run npm prepare
or pnpm prepare
, and then configure your githooks with
npx husky add .husky/<pre-hookname> "command you want to configure"
For example, the initial config has been created with:
npx husky add .husky/pre-commit "npx lint-staged"
npx husky add .husky/pre-push "pnpm test"
You are free to modify the configuration.
For coding styling, I decided to use eslint and the eslint-airbnb configuration, with some personal modifications.
Vite Template React with TypeScript is built and maintained by Castro Maciel
This project is licensed under the terms of the MIT license.