Skip to content

Commit 64d7493

Browse files
committed
Migrate to Vite (pronounced VEET), refactoring and improved accessibility
1 parent d906b8e commit 64d7493

12 files changed

+3232
-11844
lines changed

.eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
src/reportWebVitals.js
21
src/setupTests.js
32
src-tauri/
43
src-tauri/*
54
.github/*
65
.yarn/*
76
node_modules/*
87
build/*
8+
dist/*
9+
vite.config.js

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# production
1212
/build
13+
/dist
1314

1415
# misc
1516
.DS_Store

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Advanced PassGen uses tauri to build the desktop application. You can find more
1818

1919
### Web
2020

21-
You can build a web version of Advanced PassGen by running the following command:
21+
You can build a web version of Advanced PassGen using `Vite` by running the following command:
2222

2323
```shell
2424
yarn build
2525
```
2626

27-
For more information about building the web version, please read the `creact-react-app` documentation [here](https://create-react-app.dev/docs/production-build).
27+
For more information about building the web version, please read the `Vite` documentation [here](https://vitejs.dev/guide/build.html).
2828

2929
### Windows
3030

index.html

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<link rel="icon" href="/favicon.ico"/>
6+
<meta name="viewport" content="width=device-width, initial-scale=1"/>
7+
<meta name="theme-color" content="#000000"/>
8+
<meta
9+
name="description"
10+
content="Advanced PassGen is a password generator can be used to quickly generate thousands of passwords"
11+
/>
12+
<link rel="apple-touch-icon" href="/logo192.png"/>
13+
<link rel="manifest" href="/manifest.json"/>
14+
<title>Advanced PassGen</title>
15+
</head>
16+
<body>
17+
<noscript>You need to enable JavaScript to run this app.</noscript>
18+
<div id="root"></div>
19+
<script type="module" src="/src/index.jsx"></script>
20+
</body>
21+
</html>

package.json

+10-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@fontsource/roboto": "^4.5.8",
99
"@mui/icons-material": "^5.11.11",
1010
"@mui/material": "^5.11.11",
11-
"@mui/x-data-grid": "^5.17.25",
11+
"@mui/x-data-grid": "^5.17.26",
1212
"@shopify/react-web-worker": "^5.0.8",
1313
"@tauri-apps/api": "^1.2.0",
1414
"@testing-library/jest-dom": "^5.16.5",
@@ -18,15 +18,14 @@
1818
"react": "^18.2.0",
1919
"react-dom": "^18.2.0",
2020
"react-router-dom": "^6.8.2",
21-
"react-scripts": "^5.0.1",
2221
"web-vitals": "^3.1.1"
2322
},
2423
"scripts": {
25-
"start": "react-scripts start",
24+
"start": "vite",
25+
"build": "vite build",
26+
"preview": "vite build && vite preview",
2627
"dev": "tauri dev",
27-
"build": "react-scripts build",
28-
"test": "react-scripts test",
29-
"eject": "react-scripts eject"
28+
"lint": "eslint . --ext .ts,.tsx,.js,.jsx"
3029
},
3130
"eslintConfig": {
3231
"extends": [
@@ -49,12 +48,16 @@
4948
"packageManager": "[email protected]",
5049
"devDependencies": {
5150
"@tauri-apps/cli": "^1.2.3",
51+
"@vitejs/plugin-react": "^3.1.0",
5252
"cross-env": "^7.0.3",
5353
"eslint": "^8.35.0",
5454
"eslint-config-airbnb": "^19.0.4",
5555
"eslint-plugin-import": "^2.27.5",
5656
"eslint-plugin-jsx-a11y": "^6.7.1",
5757
"eslint-plugin-react": "^7.32.2",
58-
"eslint-plugin-react-hooks": "^4.6.0"
58+
"eslint-plugin-react-hooks": "^4.6.0",
59+
"vite": "^4.1.4",
60+
"vite-plugin-eslint": "^1.8.1",
61+
"vite-plugin-svgr": "^2.4.0"
5962
}
6063
}

public/index.html

-43
This file was deleted.

src-tauri/tauri.conf.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"build": {
44
"beforeBuildCommand": "yarn build",
55
"beforeDevCommand": "yarn cross-env BROWSER=none yarn start",
6-
"devPath": "http://localhost:3000",
7-
"distDir": "../build"
6+
"devPath": "http://localhost:5173",
7+
"distDir": "../dist"
88
},
99
"package": {
1010
"productName": "advanced-passgen",

src/components/TopBar/index.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ const TopBar = ({ onOpenDrawer, onTitleClick }) => {
175175
</Menu>
176176
</div>
177177
) : null}
178-
<IconButton color="inherit" onClick={changeThemeStyle}>
178+
<IconButton
179+
aria-label={language.theme}
180+
color="inherit"
181+
onClick={changeThemeStyle}
182+
>
179183
{themeType === 'dark' ? <Brightness5Icon /> : <Brightness7Icon />}
180184
</IconButton>
181185
</Toolbar>

src/index.jsx

-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from 'react';
22
import ReactDOM from 'react-dom/client';
33
import './index.css';
44
import App from './components/App';
5-
import reportWebVitals from './reportWebVitals';
65
import '@fontsource/roboto/300.css';
76
import '@fontsource/roboto/400.css';
87
import '@fontsource/roboto/500.css';
@@ -23,8 +22,3 @@ root.render(
2322
</MainContextProvider>
2423
</React.StrictMode>,
2524
);
26-
27-
// If you want to start measuring performance in your app, pass a function
28-
// to log results (for example: reportWebVitals(console.log))
29-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
30-
reportWebVitals();

src/reportWebVitals.js

-13
This file was deleted.

vite.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { defineConfig } from 'vite';
2+
import react from '@vitejs/plugin-react';
3+
import svgrPlugin from 'vite-plugin-svgr';
4+
import eslint from 'vite-plugin-eslint'
5+
6+
// https://vitejs.dev/config/
7+
export default defineConfig({
8+
plugins: [react(), svgrPlugin(), eslint()],
9+
});

0 commit comments

Comments
 (0)