42 lines
1.6 KiB
YAML
42 lines
1.6 KiB
YAML
|
name: Setup Vite React TS Project
|
||
|
|
||
|
on:
|
||
|
push:
|
||
|
branches:
|
||
|
- main
|
||
|
|
||
|
jobs:
|
||
|
build:
|
||
|
runs-on: ubuntu-latest
|
||
|
|
||
|
steps:
|
||
|
- name: Checkout repository
|
||
|
uses: actions/checkout@v2
|
||
|
|
||
|
- name: Setup Node.js
|
||
|
uses: actions/setup-node@v2
|
||
|
with:
|
||
|
node-version: 'lts/*'
|
||
|
|
||
|
- name: Install Yarn
|
||
|
run: npm install -g yarn
|
||
|
|
||
|
- name: Create Vite Project
|
||
|
run: npx create-vite . --template react-ts
|
||
|
|
||
|
- name: Install ESlint and Prettier
|
||
|
run: |
|
||
|
yarn add --dev eslint prettier eslint-config-prettier eslint-plugin-prettier eslint-plugin-react @typescript-eslint/eslint-plugin @typescript-eslint/parser husky lint-staged
|
||
|
|
||
|
- name: Update package.json scripts
|
||
|
run: |
|
||
|
npx json -I -f package.json -e 'this.scripts.prettier="prettier \\"src/**/*.{js,jsx,ts,tsx,css,scss,md}\\" --write"; this.scripts["format:check"]="yarn prettier -- --check"; this.scripts["format:write"]="yarn prettier -- --write"; this.scripts["types:check"]="tsc --noEmit --pretty"; this.scripts.lint="eslint --ext .js,.jsx,.ts,.tsx src --no-error-on-unmatched-pattern"; this.scripts["lint:fix"]="eslint --ext .js,.jsx,.ts,.tsx src --fix --no-error-on-unmatched-pattern"; this.scripts.fix="yarn format:write && yarn lint:fix";'
|
||
|
|
||
|
- name: Commit and Push
|
||
|
run: |
|
||
|
git config --global user.name "JKlancer"
|
||
|
git config --global user.email "jasonzhuyq@outlook.com"
|
||
|
git add .
|
||
|
git commit -m "Setup project with Vite, React-TS, ESLint, and Prettier"
|
||
|
git push
|