Migrate to Vite (#441)
This commit is contained in:
parent
58b5f187f7
commit
2d036f1277
22
.env
22
.env
|
@ -1,12 +1,12 @@
|
|||
NPM_GITHUB_TOKEN=
|
||||
REACT_APP_WEB_URL=http://localhost:3000
|
||||
REACT_APP_SENTRY_DSN=
|
||||
REACT_APP_FIREBASE_APP_SENTRY_DSN=
|
||||
REACT_APP_FIREBASE_API_KEY=
|
||||
REACT_APP_FIREBASE_AUTH_DOMAIN=
|
||||
REACT_APP_FIREBASE_PROJECT_ID=
|
||||
REACT_APP_FIREBASE_STORAGE_BUCKET=
|
||||
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=
|
||||
REACT_APP_FIREBASE_APP_ID=
|
||||
REACT_APP_FIREBASE_MEASUREMENT_ID=
|
||||
REACT_APP_CDN_URL=
|
||||
VITE_WEB_URL=http://localhost:3000
|
||||
VITE_SENTRY_DSN=
|
||||
VITE_FIREBASE_APP_SENTRY_DSN=
|
||||
VITE_FIREBASE_API_KEY=
|
||||
VITE_FIREBASE_AUTH_DOMAIN=
|
||||
VITE_FIREBASE_PROJECT_ID=
|
||||
VITE_FIREBASE_STORAGE_BUCKET=
|
||||
VITE_FIREBASE_MESSAGING_SENDER_ID=
|
||||
VITE_FIREBASE_APP_ID=
|
||||
VITE_FIREBASE_MEASUREMENT_ID=
|
||||
VITE_CDN_URL=
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
{
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"cSpell.words": [
|
||||
"vite",
|
||||
"vitejs"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="%PUBLIC_URL%/icons/icon.ico" />
|
||||
<link rel="icon" href="/icons/icon.ico" />
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1" />
|
||||
<meta name="theme-color" content="#222629" />
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/icons/icon.png" />
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<link rel="apple-touch-icon" href="/icons/icon.png" />
|
||||
<link rel="manifest" href="/manifest.json" />
|
||||
<link rel="preconnect" href="https://apis.google.com" crossorigin>
|
||||
<meta property="og:title" content="SpeedyTuner Cloud">
|
||||
<meta name="twitter:image:alt" content="SpeedyTuner Cloud">
|
||||
|
@ -22,5 +22,7 @@
|
|||
<body style="background-color: #222629;">
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!-- Vite entrypoint -->
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
|
@ -11,25 +11,11 @@
|
|||
"url": "https://github.com/speedy-tuner/speedy-tuner-cloud"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "craco start",
|
||||
"build": "craco build",
|
||||
"build:stats": "craco build --stats",
|
||||
"test": "craco test",
|
||||
"start": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"serve": "vite preview",
|
||||
"lint": "tsc && eslint --max-warnings=0 src",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"analyze": "source-map-explorer 'build/static/js/*.js'"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
"lint:fix": "eslint --fix src"
|
||||
},
|
||||
"dependencies": {
|
||||
"@reduxjs/toolkit": "^1.7.2",
|
||||
|
@ -38,9 +24,8 @@
|
|||
"@speedy-tuner/ini": "^0.3.0",
|
||||
"@speedy-tuner/types": "^0.3.0",
|
||||
"antd": "^4.18.8",
|
||||
"craco-less": "^2.0.0",
|
||||
"firebase": "^9.6.7",
|
||||
"kbar": "^0.1.0-beta.27",
|
||||
"kbar": "^0.1.0-beta.28",
|
||||
"mlg-converter": "^0.5.1",
|
||||
"nanoid": "^3.3.1",
|
||||
"pako": "^2.0.4",
|
||||
|
@ -50,9 +35,9 @@
|
|||
"react-perfect-scrollbar": "^1.5.8",
|
||||
"react-redux": "^7.2.6",
|
||||
"react-router-dom": "^6.2.1",
|
||||
"react-scripts": "^5.0.0",
|
||||
"uplot": "^1.6.19",
|
||||
"uplot-react": "^1.1.1"
|
||||
"uplot-react": "^1.1.1",
|
||||
"vite": "^2.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@craco/craco": "^7.0.0-7.0.0-alpha.2.0",
|
||||
|
@ -63,12 +48,11 @@
|
|||
"@types/react-dom": "^17.0.11",
|
||||
"@types/react-redux": "^7.1.22",
|
||||
"@types/react-router-dom": "^5.3.3",
|
||||
"@vitejs/plugin-react": "^1.2.0",
|
||||
"eslint-plugin-modules-newline": "^0.0.6",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"less-loader": "^6.1.0",
|
||||
"less": "^4.1.2",
|
||||
"prettier": "^2.5.1",
|
||||
"source-map-explorer": "^2.5.2",
|
||||
"typescript": "^4.5.5",
|
||||
"worker-loader": "^3.0.8"
|
||||
"typescript": "^4.5.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
declare module 'worker-loader!*' {
|
||||
// You need to change `Worker`, if you specified a different value for the `workerType` option
|
||||
class WebpackWorker extends Worker {
|
||||
constructor();
|
||||
}
|
||||
|
||||
// Uncomment this if you set the `esModule` option to `false`
|
||||
// export = WebpackWorker;
|
||||
export default WebpackWorker;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
@import '~antd/dist/antd.less';
|
||||
// @import '~antd/dist/antd.compact.less';
|
||||
@import 'antd/dist/antd.less';
|
||||
// @import 'antd/dist/antd.compact.less';
|
||||
// @import './themes/light.less';
|
||||
@import './themes/dark.less';
|
||||
@import './themes/common.less';
|
||||
|
|
|
@ -4,13 +4,13 @@ import { getAuth } from 'firebase/auth';
|
|||
import { getAnalytics } from 'firebase/analytics';
|
||||
|
||||
const firebaseConfig = {
|
||||
apiKey: process.env.REACT_APP_FIREBASE_API_KEY,
|
||||
authDomain: process.env.REACT_APP_FIREBASE_AUTH_DOMAIN,
|
||||
projectId: process.env.REACT_APP_FIREBASE_PROJECT_ID,
|
||||
storageBucket: process.env.REACT_APP_FIREBASE_STORAGE_BUCKET,
|
||||
messagingSenderId: process.env.REACT_APP_FIREBASE_MESSAGING_SENDER_ID,
|
||||
appId: process.env.REACT_APP_FIREBASE_APP_ID,
|
||||
measurementId: process.env.REACT_APP_FIREBASE_MEASUREMENT_ID,
|
||||
apiKey: import.meta.env.VITE_FIREBASE_API_KEY as string,
|
||||
authDomain: import.meta.env.VITE_FIREBASE_AUTH_DOMAIN as string,
|
||||
projectId: import.meta.env.VITE_FIREBASE_PROJECT_ID as string,
|
||||
storageBucket: import.meta.env.VITE_FIREBASE_STORAGE_BUCKET as string,
|
||||
messagingSenderId: import.meta.env.VITE_FIREBASE_MESSAGING_SENDER_ID as string,
|
||||
appId: import.meta.env.VITE_FIREBASE_APP_ID as string,
|
||||
measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID as string,
|
||||
};
|
||||
|
||||
const app = initializeApp(firebaseConfig);
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
const PUBLIC_PATH = 'public';
|
||||
const USERS_PATH = `${PUBLIC_PATH}/users`;
|
||||
const INI_PATH = `${PUBLIC_PATH}/ini`;
|
||||
export const CDN_URL = process.env.REACT_APP_CDN_URL;
|
||||
export const CDN_URL = import.meta.env.VITE_CDN_URL;
|
||||
|
||||
const storage = getStorage();
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ import CommandPalette from './components/CommandPalette';
|
|||
|
||||
if (isProduction) {
|
||||
Sentry.init({
|
||||
dsn: sentryDsn,
|
||||
dsn: sentryDsn as string,
|
||||
integrations: [new Integrations.BrowserTracing()],
|
||||
tracesSampleRate: 0.2,
|
||||
environment,
|
||||
environment: environment as string,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable import/no-webpack-loader-syntax */
|
||||
import {
|
||||
useCallback,
|
||||
useEffect,
|
||||
|
@ -26,8 +25,6 @@ import useBreakpoint from 'antd/lib/grid/hooks/useBreakpoint';
|
|||
import { connect } from 'react-redux';
|
||||
import { Result as ParserResult } from 'mlg-converter/dist/types';
|
||||
import PerfectScrollbar from 'react-perfect-scrollbar';
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import MlgParserWorker from 'worker-loader!../workers/mlgParser.worker';
|
||||
import {
|
||||
Config,
|
||||
OutputChannel,
|
||||
|
@ -35,6 +32,8 @@ import {
|
|||
DatalogEntry,
|
||||
Tune as TuneType,
|
||||
} from '@speedy-tuner/types';
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import MlgParserWorker from '../workers/mlgParser?worker';
|
||||
import { loadLogs } from '../utils/api';
|
||||
import LogCanvas from '../components/Logs/LogCanvas';
|
||||
import store from '../store';
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
/// <reference types="react-scripts" />
|
|
@ -1,8 +1,6 @@
|
|||
export const isWeb = process.env.APP_PLATFORM === 'web';
|
||||
export const isDesktop = process.env.APP_PLATFORM === 'desktop';
|
||||
export const isMac = `${window.navigator.platform}`.includes('Mac');
|
||||
export const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
||||
export const environment = process.env.NODE_ENV || 'development';
|
||||
export const environment = import.meta.env.NODE_ENV || 'development';
|
||||
export const isProduction = environment === 'production';
|
||||
export const sentryDsn = process.env.REACT_APP_SENTRY_DSN;
|
||||
export const sentryDsn = import.meta.env.VITE_SENTRY_DSN;
|
||||
export const platform = `${window.navigator.platform}`;
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const generateShareUrl = (tuneId: string) => `${process.env.REACT_APP_WEB_URL}/#/t/${tuneId}`;
|
||||
export const generateShareUrl = (tuneId: string) => `${import.meta.env.VITE_WEB_URL}/#/t/${tuneId}`;
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/// <reference types="vite/client" />
|
|
@ -1,27 +1,30 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES6",
|
||||
"target": "ESNext",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
"DOM",
|
||||
"DOM.Iterable",
|
||||
"ESNext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"esModuleInterop": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"removeComments": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"github": {
|
||||
"silent": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
// This changes the out put dir from dist to build
|
||||
build: { outDir: 'build' },
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
less: { javascriptEnabled: true },
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
],
|
||||
});
|
Loading…
Reference in New Issue