Skip to content

Commit c31c0c7

Browse files
authored
Merge pull request #2 from dashed/claude/migrate-cra-to-vite-018i6YD6sfD84LTPGVMG7SYW
Migrate from Create React App to Vite
2 parents 657db2b + 23183ca commit c31c0c7

17 files changed

+3799
-9564
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,22 @@ jobs:
1313

1414
strategy:
1515
matrix:
16-
node-version: [18.x, 20.x]
16+
node-version: [20.x, 22.x]
1717

1818
steps:
1919
- name: Checkout code
2020
uses: actions/checkout@v4
2121

22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v4
24+
with:
25+
version: 9
26+
2227
- name: Setup Node.js ${{ matrix.node-version }}
2328
uses: actions/setup-node@v4
2429
with:
2530
node-version: ${{ matrix.node-version }}
26-
cache: 'yarn'
31+
cache: 'pnpm'
2732

2833
- name: Install dependencies
2934
run: make install
@@ -50,11 +55,16 @@ jobs:
5055
- name: Checkout code
5156
uses: actions/checkout@v4
5257

58+
- name: Install pnpm
59+
uses: pnpm/action-setup@v4
60+
with:
61+
version: 9
62+
5363
- name: Setup Node.js
5464
uses: actions/setup-node@v4
5565
with:
5666
node-version: 20.x
57-
cache: 'yarn'
67+
cache: 'pnpm'
5868

5969
- name: Install dependencies
6070
run: make install

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,10 @@
2121
npm-debug.log*
2222
yarn-debug.log*
2323
yarn-error.log*
24+
pnpm-debug.log*
25+
26+
# TypeScript
27+
*.tsbuildinfo
28+
29+
# pnpm
30+
.pnpm-store

Makefile

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,66 @@
1-
.PHONY: help install test test-coverage build lint lint-fix clean ci start
1+
.PHONY: help install dev start test test-ui test-coverage build preview lint lint-fix clean ci
22

33
# Default target
44
help:
55
@echo "Available targets:"
66
@echo " make install - Install dependencies"
7-
@echo " make test - Run tests"
7+
@echo " make dev - Start Vite development server"
8+
@echo " make start - Start Vite development server (alias for dev)"
9+
@echo " make test - Run tests with Vitest"
10+
@echo " make test-ui - Run tests with Vitest UI"
811
@echo " make test-coverage - Run tests with coverage"
912
@echo " make build - Build production bundle"
13+
@echo " make preview - Preview production build locally"
1014
@echo " make lint - Check code formatting"
1115
@echo " make lint-fix - Fix code formatting"
1216
@echo " make clean - Clean build artifacts"
1317
@echo " make ci - Run all CI checks (test + build + lint)"
14-
@echo " make start - Start development server"
1518

1619
# Install dependencies
1720
install:
18-
yarn install --frozen-lockfile
21+
pnpm install --frozen-lockfile
1922

20-
# Run tests without coverage
23+
# Start Vite development server
24+
dev:
25+
pnpm dev
26+
27+
# Alias for dev
28+
start: dev
29+
30+
# Run tests with Vitest
2131
test:
22-
yarn test --watchAll=false
32+
pnpm test --run
33+
34+
# Run tests with Vitest UI
35+
test-ui:
36+
pnpm test:ui
2337

2438
# Run tests with coverage
2539
test-coverage:
26-
yarn test --watchAll=false --coverage
40+
pnpm test:coverage --run
2741

2842
# Build production bundle
2943
build:
30-
yarn build
44+
pnpm build
45+
46+
# Preview production build
47+
preview:
48+
pnpm preview
3149

3250
# Check code formatting with Prettier
3351
lint:
34-
yarn prettier --check "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
52+
pnpm prettier --check "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
3553

3654
# Fix code formatting with Prettier
3755
lint-fix:
38-
yarn prettier --write "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
56+
pnpm prettier --write "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}"
3957

4058
# Clean build artifacts
4159
clean:
4260
rm -rf build
4361
rm -rf coverage
4462
rm -rf node_modules
63+
rm -f pnpm-lock.yaml
4564

4665
# Run all CI checks
4766
ci: test-coverage build lint
48-
49-
# Start development server
50-
start:
51-
yarn start

package.json

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,26 @@
22
"name": "mathjojo",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
56
"dependencies": {
6-
"@testing-library/jest-dom": "^5.14.1",
7-
"@testing-library/react": "^13.0.0",
8-
"@testing-library/user-event": "^13.2.1",
9-
"@types/jest": "^27.0.1",
10-
"@types/katex": "^0.14.0",
11-
"@types/lz-string": "^1.3.34",
12-
"@types/node": "^16.7.13",
13-
"@types/react": "^18.0.0",
14-
"@types/react-dom": "^18.0.0",
15-
"@types/shallowequal": "^1.1.1",
16-
"@types/styled-components": "^5.1.26",
17-
"husky": "^8.0.1",
187
"katex": "^0.16.2",
198
"latex.css": "^1.8.0",
20-
"lint-staged": "^13.0.3",
219
"lz-string": "^1.4.4",
22-
"prettier": "^2.7.1",
2310
"react": "^18.2.0",
2411
"react-dom": "^18.2.0",
25-
"react-scripts": "5.0.1",
12+
"react-is": "^19.2.0",
2613
"shallowequal": "^1.1.0",
27-
"styled-components": "^5.3.6",
28-
"typescript": "^4.4.2",
14+
"styled-components": "^6",
2915
"web-vitals": "^2.1.0"
3016
},
3117
"scripts": {
32-
"start": "react-scripts start",
33-
"build": "react-scripts build",
34-
"test": "react-scripts test",
35-
"eject": "react-scripts eject"
36-
},
37-
"eslintConfig": {
38-
"extends": [
39-
"react-app",
40-
"react-app/jest"
41-
]
18+
"dev": "vite",
19+
"start": "vite",
20+
"build": "tsc -b && vite build",
21+
"preview": "vite preview",
22+
"test": "vitest",
23+
"test:ui": "vitest --ui",
24+
"test:coverage": "vitest --coverage"
4225
},
4326
"browserslist": {
4427
"production": [
@@ -61,5 +44,29 @@
6144
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
6245
"prettier --write"
6346
]
47+
},
48+
"devDependencies": {
49+
"@testing-library/dom": "^10.4.1",
50+
"@testing-library/jest-dom": "^6",
51+
"@testing-library/react": "^14",
52+
"@testing-library/user-event": "^14",
53+
"@types/jest": "^30.0.0",
54+
"@types/katex": "^0.16.7",
55+
"@types/node": "^24.10.1",
56+
"@types/react": "^18",
57+
"@types/react-dom": "^18",
58+
"@types/shallowequal": "^1.1.5",
59+
"@types/styled-components": "^5.1.36",
60+
"@vitejs/plugin-react": "^5.1.1",
61+
"@vitest/coverage-v8": "^4.0.13",
62+
"@vitest/ui": "^4.0.13",
63+
"husky": "^8.0.1",
64+
"jsdom": "^27.2.0",
65+
"lint-staged": "^13.0.3",
66+
"prettier": "^2.7.1",
67+
"typescript": "^5.9.3",
68+
"vite": "^7.2.4",
69+
"vite-tsconfig-paths": "^5.1.4",
70+
"vitest": "^4.0.13"
6471
}
6572
}

0 commit comments

Comments
 (0)