Skip to content

Commit

Permalink
build: migrate CRA to Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
HRemonen committed Jul 18, 2024
1 parent ad5a36d commit 005d814
Show file tree
Hide file tree
Showing 7 changed files with 10,052 additions and 20,729 deletions.
20 changes: 20 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/hy_favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#fff" />
<meta
name="description"
content="Digipedakuraattori"
/>

<link rel="manifest" href="/manifest.json" />
<title>Curre</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/client/index.tsx"></script>
</body>
</html>
30,676 changes: 9,995 additions & 20,681 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"react-i18next": "^14.0.0",
"react-markdown": "^9.0.0",
"react-router-dom": "^6.8.1",
"react-scripts": "5.0.1",
"remark-breaks": "^4.0.0",
"sequelize": "^6.28.0",
"umzug": "^3.2.1",
Expand All @@ -54,16 +53,15 @@
"start:prod": "NODE_ENV=production node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm src/server/index.ts",
"start:test": "NODE_ENV=test node --experimental-specifier-resolution=node --loader ts-node/esm src/server/index.ts",
"start:dev": "NODE_ENV=development concurrently \"npm run start:dev:server\" \"npm run start:dev:front\"",
"start:dev:front": "react-scripts start",
"start:dev:front": "vite",
"start:dev:server": "nodemon --exec node --no-warnings --experimental-specifier-resolution=node --loader ts-node/esm src/server/index.ts",
"test": "npm run test:setup && npm run test:e2e",
"test:setup": "docker-compose down && docker-compose -f docker-compose.ci.yml rm -vf && docker-compose -f docker-compose.ci.yml up -d --build",
"test:e2e": "cypress run",
"test:cypress": "cypress open",
"lint": "eslint 'src/**/*.{ts,tsx}'",
"format": "prettier --write '**/*.{ts,tsx,json,css,md}'",
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
"eject": "react-scripts eject",
"build": "DISABLE_ESLINT_PLUGIN=true vite build",
"prepare": "husky"
},
"babel": {
Expand Down Expand Up @@ -162,6 +160,7 @@
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2",
"@vitejs/plugin-react": "^4.3.1",
"concurrently": "^8.0.0",
"cypress": "^13.0.0",
"eslint": "^8.32.0",
Expand All @@ -175,7 +174,8 @@
"nodemon": "^3.1.0",
"prettier": "^3.0.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
"typescript": "^4.9.4",
"vite": "^5.3.4"
},
"proxy": "http://localhost:8000"
}
42 changes: 0 additions & 42 deletions public/index.html

This file was deleted.

4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
"src/**/*",
"types/@unfuck-utf8-headers-middleware.d..ts",
"cypress.config.js",
"cypress/**/*"
"cypress/**/*",
"vite.config.ts",
"vite-env.d.ts"
],
"ts-node": {
"esm": true,
Expand Down
2 changes: 2 additions & 0 deletions vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// vite-env.d.ts
/// <reference types="vite/client" />
27 changes: 27 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { inStaging } from './src/config'

// https://vitejs.dev/config/
export default defineConfig({
base: inStaging ? '/kliksutin' : '/',
plugins: [react()],
server: {
proxy: {
'/api/': {
target: 'http://localhost:8000',
changeOrigin: true,
secure: false,
},
},
watch: {
usePolling: true,
},
host: true,
strictPort: true,
port: 3000,
},
define: {
'process.env': process.env,
},
})

0 comments on commit 005d814

Please sign in to comment.