Migrated from Parcel to Vite
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<script type="module" src="index.js"></script>
|
<script type="module" src="./index.tsx"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -19,7 +19,7 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
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 { LanguageUnion, setCliArgs, setFormatSelection, setLanguage, setServerAddr, setTheme, ThemeUnion } from "./features/settings/settingsSlice";
|
||||||
import { alreadyUpdated, updated } from "./features/status/statusSlice";
|
import { alreadyUpdated, updated } from "./features/status/statusSlice";
|
||||||
import { RootState } from "./stores/store";
|
import { RootState } from "./stores/store";
|
||||||
@@ -94,16 +94,31 @@ export default function Settings({ socket }: Props) {
|
|||||||
{settings.i18n.t('settingsAnchor')}
|
{settings.i18n.t('settingsAnchor')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<FormGroup>
|
<FormGroup>
|
||||||
<TextField
|
<Grid container spacing={2}>
|
||||||
label={settings.i18n.t('serverAddressTitle')}
|
<Grid item xs={12} md={10}>
|
||||||
defaultValue={settings.serverAddr}
|
<TextField
|
||||||
onChange={handleAddrChange}
|
fullWidth
|
||||||
error={invalidIP}
|
label={settings.i18n.t('serverAddressTitle')}
|
||||||
InputProps={{
|
defaultValue={settings.serverAddr}
|
||||||
startAdornment: <InputAdornment position="start">ws://</InputAdornment>,
|
onChange={handleAddrChange}
|
||||||
}}
|
error={invalidIP}
|
||||||
sx={{ mb: 2 }}
|
InputProps={{
|
||||||
/>
|
startAdornment: <InputAdornment position="start">ws://</InputAdornment>,
|
||||||
|
}}
|
||||||
|
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 container spacing={2}>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={6}>
|
||||||
<FormControl fullWidth>
|
<FormControl fullWidth>
|
||||||
|
|||||||
23
package.json
23
package.json
@@ -6,12 +6,12 @@
|
|||||||
"dev": "nodemon dist/main.js",
|
"dev": "nodemon dist/main.js",
|
||||||
"start": "node dist/main.js",
|
"start": "node dist/main.js",
|
||||||
"watch": "tsc --build -w",
|
"watch": "tsc --build -w",
|
||||||
"build": "parcel build ./frontend/index.html --dist-dir ./dist/frontend",
|
"build": "vite build",
|
||||||
"build-server": "tsc --build",
|
"build-server": "tsc --build",
|
||||||
"build-all": "tsc --build && npm run build && npm run fetch",
|
"build-all": "tsc --build && npm run build && npm run fetch",
|
||||||
"clean": "tsc --build --clean",
|
"clean": "tsc --build --clean",
|
||||||
"clean-all": "rm -r dist",
|
"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-dev": "./fetch-yt-dlp.sh && mv yt-dlp ./server/core",
|
||||||
"fetch": "./fetch-yt-dlp.sh && mv yt-dlp ./dist/core"
|
"fetch": "./fetch-yt-dlp.sh && mv yt-dlp ./dist/core"
|
||||||
},
|
},
|
||||||
@@ -38,29 +38,18 @@
|
|||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@parcel/transformer-yaml": "^2.5.0",
|
"@modyfi/vite-plugin-yaml": "^1.0.2",
|
||||||
"@types/koa": "^2.13.4",
|
"@types/koa": "^2.13.4",
|
||||||
"@types/koa-router": "^7.4.4",
|
"@types/koa-router": "^7.4.4",
|
||||||
"@types/mime-types": "^2.1.1",
|
"@types/mime-types": "^2.1.1",
|
||||||
"@types/node": "^17.0.31",
|
"@types/node": "^17.0.31",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
"@types/uuid": "^8.3.4",
|
"@types/uuid": "^8.3.4",
|
||||||
|
"@vitejs/plugin-react": "^1.3.2",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"parcel": "^2.5.0",
|
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"process": "^0.11.10",
|
"process": "^0.11.10",
|
||||||
"typescript": "^4.6.4"
|
"typescript": "^4.6.4",
|
||||||
},
|
"vite": "^2.9.10"
|
||||||
"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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
2340
pnpm-lock.yaml
generated
2340
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
17
vite.config.ts
Normal file
17
vite.config.ts
Normal 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
|
||||||
Reference in New Issue
Block a user