Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating from CRA to Vite #86

Merged
merged 13 commits into from
Oct 4, 2023
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ This app is created by the volunteers of [Public Knowledge Workshop](https://www
- `yarn install`
- `yarn start`


### useful resources:
* [the design file](https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?type=design&node-id=0-1&mode=design&t=Dh8lI3EJ37unxvoe-0)https://www.figma.com/file/Plw8Uuu6U96CcX5tJyRMoW/Public-Transportation-visual-informaiton?type=design&node-id=0-1&mode=design&t=Dh8lI3EJ37unxvoe-0
* [data model schema](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md)
Expand Down
7 changes: 4 additions & 3 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
<html lang="he" dir="rtl">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="Open-Bus"
content="Open Bus web app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="apple-touch-icon" href="logo192.png" />
<link rel="manifest" href="manifest.json" />
<title>Open Bus</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@mui/material": "^5.14.7",
"@mui/x-date-pickers": "^6.12.1",
"@types/leaflet.markercluster": "^1.5.2",
"@vitejs/plugin-react-swc": "^3.4.0",
"antd": "^4.22.5",
"axios": "^0.27.2",
"classnames": "^2.3.2",
Expand All @@ -25,25 +26,27 @@
"react-leaflet": "^4.0.1",
"react-leaflet-cluster": "^2.1.0",
"react-router-dom": "^6.6.1",
"react-scripts": "5.0.1",
"recharts": "^2.4.3",
"sass": "^1.58.3",
"styled-components": "^5.3.5",
"stylis-plugin-rtl": "^2.1.1",
"typescript": "^4.7.4",
"underscore.string": "^3.3.6",
"usehooks-ts": "^2.9.1",
"vite": "^4.4.9",
"vite-plugin-svgr": "^4.1.0",
"vite-tsconfig-paths": "^4.2.1",
"web-vitals": "^2.1.4"
},
"resolutions": {
"autoprefixer": "10.4.5"
},
"scripts": {
"start": "react-scripts start",
"build": "CI=false react-scripts build",
"test": "react-scripts test",
"start": "vite",
"build": "tsc && vite build",
"serve": "vite preview",
"test": "echo \"no default test defined. to run playwright test, use `npm run test:playwright`\"",
"test:playwright": "playwright test",
"eject": "react-scripts eject",
"lint": "eslint . --max-warnings 0",
"lint:fix": "eslint . --fix",
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
Expand All @@ -65,7 +68,7 @@
"@types/geolib": "^2.0.23",
"@types/leaflet": "^1.7.11",
"@types/lodash.debounce": "^4.0.7",
"@types/node": "^16.11.48",
"@types/node": "^20.8.0",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.6",
"@types/styled-components": "^5.1.26",
Expand Down
2 changes: 1 addition & 1 deletion tests/dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test } from '@playwright/test'

test('dashboard is on homepage', async ({ page }) => {
await page.goto('http://localhost:3000/')
await page.goto('/')
await page.getByText('קיבוץ לפי שעה').click()
})
12 changes: 8 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "ES6",
"baseUrl": ".",
"paths":{
"src/*": ["./src/*"],
},
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
Expand All @@ -15,7 +18,8 @@
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
"jsx": "react-jsx",
"types": ["vite/client", "vite-plugin-svgr/client","node"]
},
"include": ["src"]
}
1 change: 1 addition & 0 deletions vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
12 changes: 12 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
src: '/src',
},
},
NoamGaash marked this conversation as resolved.
Show resolved Hide resolved
})
Loading