Migrated from Parcel to Vite

This commit is contained in:
2022-06-08 11:36:03 +02:00
parent 37d7551cd9
commit aa95cd7abc
6 changed files with 999 additions and 1422 deletions

View File

@@ -10,7 +10,7 @@
<body>
<div id="root"></div>
<script type="module" src="index.js"></script>
<script type="module" src="./index.tsx"></script>
</body>
</html>

View File

@@ -19,7 +19,7 @@ import {
} from "@mui/material";
import React, { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { io, Socket } from "socket.io-client";
import { Socket } from "socket.io-client";
import { LanguageUnion, setCliArgs, setFormatSelection, setLanguage, setServerAddr, setTheme, ThemeUnion } from "./features/settings/settingsSlice";
import { alreadyUpdated, updated } from "./features/status/statusSlice";
import { RootState } from "./stores/store";
@@ -94,7 +94,10 @@ export default function Settings({ socket }: Props) {
{settings.i18n.t('settingsAnchor')}
</Typography>
<FormGroup>
<Grid container spacing={2}>
<Grid item xs={12} md={10}>
<TextField
fullWidth
label={settings.i18n.t('serverAddressTitle')}
defaultValue={settings.serverAddr}
onChange={handleAddrChange}
@@ -104,6 +107,18 @@ export default function Settings({ socket }: Props) {
}}
sx={{ mb: 2 }}
/>
</Grid>
<Grid item xs={12} md={2}>
<TextField
fullWidth
label={settings.i18n.t('serverAddressTitle')}
defaultValue={settings.serverAddr}
onChange={handleAddrChange}
error={invalidIP}
sx={{ mb: 2 }}
/>
</Grid>
</Grid>
<Grid container spacing={2}>
<Grid item xs={12} md={6}>
<FormControl fullWidth>

View File

@@ -6,12 +6,12 @@
"dev": "nodemon dist/main.js",
"start": "node dist/main.js",
"watch": "tsc --build -w",
"build": "parcel build ./frontend/index.html --dist-dir ./dist/frontend",
"build": "vite build",
"build-server": "tsc --build",
"build-all": "tsc --build && npm run build && npm run fetch",
"clean": "tsc --build --clean",
"clean-all": "rm -r dist",
"fe": "parcel ./frontend/index.html --open",
"fe": "vite",
"fetch-dev": "./fetch-yt-dlp.sh && mv yt-dlp ./server/core",
"fetch": "./fetch-yt-dlp.sh && mv yt-dlp ./dist/core"
},
@@ -38,29 +38,18 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"@parcel/transformer-yaml": "^2.5.0",
"@modyfi/vite-plugin-yaml": "^1.0.2",
"@types/koa": "^2.13.4",
"@types/koa-router": "^7.4.4",
"@types/mime-types": "^2.1.1",
"@types/node": "^17.0.31",
"@types/react-router-dom": "^5.3.3",
"@types/uuid": "^8.3.4",
"@vitejs/plugin-react": "^1.3.2",
"buffer": "^6.0.3",
"parcel": "^2.5.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10",
"typescript": "^4.6.4"
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"@babel/core",
"@parcel/core",
"@parcel/core@^2.5.0",
"@babel/core@^7.0.0-0",
"@babel/core@^7.0.0",
"@babel/plugin-syntax-jsx"
]
}
"typescript": "^4.6.4",
"vite": "^2.9.10"
}
}

2340
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

17
vite.config.ts Normal file
View File

@@ -0,0 +1,17 @@
import ViteYaml from '@modyfi/vite-plugin-yaml';
import react from "@vitejs/plugin-react";
import { resolve } from 'path';
const config = {
plugins: [
ViteYaml(),
react(),
],
root: './frontend',
build: {
emptyOutDir: true,
outDir: resolve(__dirname, 'dist', 'frontend'),
}
}
export default config