Switch to vite

This commit is contained in:
Matthias 2021-05-24 15:25:48 +02:00
parent 4702a0d057
commit 58d42839c8
13 changed files with 2012 additions and 7563 deletions

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
presets: ['@vue/cli-plugin-babel/preset'], presets: ['@babel/preset-env'],
}; };

18
index.html Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<title>FreqUI</title>
</head>
<body>
<noscript>
<strong>We're sorry but FreqUI doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@ -3,12 +3,13 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vite",
"build": "vue-cli-service build", "dev": "vite",
"test:unit": "vue-cli-service test:unit", "build": "vite build --mode prod",
"lint": "vue-cli-service lint", "test:unit": "jest",
"check-types": "tsc --noemit", "check-types": "tsc --noemit",
"lint-ci": "vue-cli-service lint --no-fix", "lint": "eslint",
"lint-ci": "eslint --no-fix",
"cy:open": "cypress open", "cy:open": "cypress open",
"cy:run": "cypress run", "cy:run": "cypress run",
"cy:open-ct": "cypress open-ct", "cy:open-ct": "cypress open-ct",
@ -37,7 +38,6 @@
"vue-router": "^3.5.3", "vue-router": "^3.5.3",
"vue-select": "^3.16.0", "vue-select": "^3.16.0",
"vuex": "^3.6.2", "vuex": "^3.6.2",
"vuex-class": "^0.3.2",
"vuex-composition-helpers": "^1.1.0" "vuex-composition-helpers": "^1.1.0"
}, },
"devDependencies": { "devDependencies": {
@ -46,13 +46,6 @@
"@types/jest": "^27.4.0", "@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^2.33.0", "@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^5.10.2", "@typescript-eslint/parser": "^5.10.2",
"@vue/cli-plugin-babel": "~4.5.15",
"@vue/cli-plugin-eslint": "~4.5.15",
"@vue/cli-plugin-router": "^4.5.15",
"@vue/cli-plugin-typescript": "~4.5.15",
"@vue/cli-plugin-unit-jest": "~4.5.15",
"@vue/cli-plugin-vuex": "~4.5.15",
"@vue/cli-service": "~4.5.15",
"@vue/eslint-config-airbnb": "^5.1.0", "@vue/eslint-config-airbnb": "^5.1.0",
"@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^5.1.0", "@vue/eslint-config-typescript": "^5.1.0",
@ -62,7 +55,7 @@
"eslint-config-airbnb": "^18.2.1", "eslint-config-airbnb": "^18.2.1",
"eslint-plugin-prettier": "^3.4.1", "eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^7.20.0", "eslint-plugin-vue": "^7.20.0",
"html-webpack-plugin": "4", "jest": "~26.6.3",
"mutationobserver-shim": "^0.3.7", "mutationobserver-shim": "^0.3.7",
"popper.js": "^1.16.1", "popper.js": "^1.16.1",
"portal-vue": "^2.1.7", "portal-vue": "^2.1.7",
@ -70,6 +63,8 @@
"sass": "^1.49.7", "sass": "^1.49.7",
"sass-loader": "^10.1.1", "sass-loader": "^10.1.1",
"typescript": "~4.5.5", "typescript": "~4.5.5",
"vite": "^2.3.3",
"vite-plugin-vue2": "^1.5.1",
"vue-template-compiler": "^2.6.14", "vue-template-compiler": "^2.6.14",
"vuex-class": "^0.3.2" "vuex-class": "^0.3.2"
} }

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

9
src/env.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
/* Provide Type for Vite's import.meta.env structure */
interface ImportMeta {
env: {
BASE_URL: string;
MODE: string;
PROD: boolean;
DEV: boolean;
};
}

View File

@ -20,27 +20,27 @@ const routes: Array<RouteConfig> = [
{ {
path: '/trade', path: '/trade',
name: 'Freqtrade Trading', name: 'Freqtrade Trading',
component: () => import(/* webpackChunkName: "trade" */ '@/views/Trading.vue'), component: () => import('@/views/Trading.vue'),
}, },
{ {
path: '/graph', path: '/graph',
name: 'Freqtrade Graph', name: 'Freqtrade Graph',
component: () => import(/* webpackChunkName: "graph" */ '@/views/Graphs.vue'), component: () => import('@/views/Graphs.vue'),
}, },
{ {
path: '/logs', path: '/logs',
name: 'Freqtrade Logs', name: 'Freqtrade Logs',
component: () => import(/* webpackChunkName: "graph" */ '@/views/LogView.vue'), component: () => import('@/views/LogView.vue'),
}, },
{ {
path: '/backtest', path: '/backtest',
name: 'Freqtrade Backtest', name: 'Freqtrade Backtest',
component: () => import(/* webpackChunkName: "backtest" */ '@/views/Backtesting.vue'), component: () => import( '@/views/Backtesting.vue'),
}, },
{ {
path: '/dashboard', path: '/dashboard',
name: 'Freqtrade Dashboard', name: 'Freqtrade Dashboard',
component: () => import(/* webpackChunkName: "dashboard" */ '@/views/Dashboard.vue'), component: () => import('@/views/Dashboard.vue'),
}, },
{ {
path: '/balance', path: '/balance',
@ -65,12 +65,12 @@ const routes: Array<RouteConfig> = [
{ {
path: '/settings', path: '/settings',
name: 'Freqtrade Settings', name: 'Freqtrade Settings',
component: () => import(/* webpackChunkName: "dashboard" */ '@/views/Settings.vue'), component: () => import( '@/views/Settings.vue'),
}, },
{ {
path: '/login', path: '/login',
name: 'Login', name: 'Login',
component: () => import(/* webpackChunkName: "login" */ '@/views/LoginView.vue'), component: () => import('@/views/LoginView.vue'),
meta: { meta: {
allowAnonymous: true, allowAnonymous: true,
}, },
@ -84,7 +84,7 @@ const routes: Array<RouteConfig> = [
const router = new VueRouter({ const router = new VueRouter({
mode: 'history', mode: 'history',
base: process.env.BASE_URL, base: import.meta.env.BASE_URL,
routes, routes,
}); });

View File

@ -60,7 +60,7 @@ const store = new Vuex.Store({
commit('setLoggedIn', loggedin); commit('setLoggedIn', loggedin);
}, },
async loadUIVersion({ commit }) { async loadUIVersion({ commit }) {
if (process.env.NODE_ENV !== 'development') { if (import.meta.env.PROD) {
try { try {
const result = await axios.get<UiVersion>('/ui_version'); const result = await axios.get<UiVersion>('/ui_version');
const { version } = result.data; const { version } = result.data;

View File

@ -1,8 +1,8 @@
@import 'bootstrap_variables_ovw'; @import 'bootstrap_variables_ovw';
@import '~bootstrap/scss/bootstrap'; @import 'bootstrap/scss/bootstrap';
@import '~bootstrap-vue/src/index'; @import 'bootstrap-vue/src/index';
@import "vue-select/src/scss/vue-select.scss"; @import "vue-select/src/scss/vue-select.scss";
@import 'variables'; @import 'variables';

View File

@ -2,7 +2,8 @@
<div> <div>
<h1 class="mb-5">404 Error.</h1> <h1 class="mb-5">404 Error.</h1>
<p class="h4">Ahhhhhhhh! The page you are looking for does not exist.</p> <p class="h4">Ahhhhhhhh! The page you are looking for does not exist.</p>
<p>Don't worry, you can head back to <router-link to="/">the main page</router-link>.</p> <p>Don't worry, you can head back to <router-link to="/">
<span>the main page</span></router-link>.</p>
</div> </div>
</template> </template>

View File

@ -31,12 +31,13 @@ import BotList from '@/components/BotList.vue';
export default class Home extends Vue {} export default class Home extends Vue {}
</script> </script>
<style scoped> <style lang="scss" scoped>
.home { .home {
margin-top: 1.5em; margin-top: 1.5em;
} }
.logo-svg { .logo-svg {
-webkit-mask: url(../assets/freqtrade-logo-mask.png) no-repeat center; -webkit-mask: url(../assets/freqtrade-logo-mask.png) no-repeat center;
-webkit-mask-size: 240px 240px;
mask: url(../assets/freqtrade-logo-mask.png) no-repeat center; mask: url(../assets/freqtrade-logo-mask.png) no-repeat center;
mask-size: contain; mask-size: contain;
width: 250px; width: 250px;

View File

@ -14,7 +14,9 @@
"allowJs": true, "allowJs": true,
"baseUrl": "src", "baseUrl": "src",
"types": [ "types": [
"webpack-env" // "webpack-env",
// "jest",
"cypress"
], ],
"paths": { "paths": {
"@/*": [ "@/*": [

31
vite.config.js Normal file
View File

@ -0,0 +1,31 @@
import { defineConfig } from 'vite';
import { createVuePlugin } from 'vite-plugin-vue2';
import path from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [createVuePlugin()],
server: {
host: 'localhost',
port: 8080,
},
resolve: {
alias: [
{
find: '@',
replacement: path.resolve(__dirname, 'src'),
// replacement: './src/*',
},
],
},
build: {
chunkSizeWarningLimit: 700, // Default is 500
},
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "@/styles/_variables.scss";',
},
},
}
});

9442
yarn.lock

File diff suppressed because it is too large Load Diff