Merge remote-tracking branch 'origin/master'

This commit is contained in:
kunfei
2023-05-16 14:27:15 +08:00
5 changed files with 38 additions and 12 deletions

View File

@@ -2,13 +2,14 @@
"name": "legado-web",
"version": "1.0.0",
"private": true,
"type": "module",
"engines": {
"node": ">=16",
"pnpm": ">=8"
},
"scripts": {
"dev": "vite",
"build": "vite build",
"build": "vite build && node scripts/sync.js",
"preview": "vite preview",
"lint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore"
},

View File

@@ -0,0 +1,28 @@
import { URL } from "node:url";
import fs from "node:fs";
const LEGADO_ASSETS_WEB_VUE_DIR = new URL("../../../app/src/main/assets/web/vue", import.meta.url)
const VUE_DIST_DIR = new URL("../dist", import.meta.url)
console.log("> delete", LEGADO_ASSETS_WEB_VUE_DIR.pathname)
// 删除
fs.rm(LEGADO_ASSETS_WEB_VUE_DIR, {
force: true,
recursive: true
}, (error) => {
if (error) console.log(error);
console.log("> mkdir", LEGADO_ASSETS_WEB_VUE_DIR.pathname);
fs.mkdir(LEGADO_ASSETS_WEB_VUE_DIR, error => {
if (error) return console.error(error)
console.log("> cp dist files")
fs.cp(VUE_DIST_DIR, LEGADO_ASSETS_WEB_VUE_DIR, {
recursive: true
}, (error) => {
if (error) {
console.warn("> cp error, you may copy files yourshelf");
throw error;
}
console.log("> cp success")
})
})
});

View File

@@ -1,4 +1,4 @@
import { resolve } from "path";
import { fileURLToPath, URL } from "node:url";
import { defineConfig, splitVendorChunkPlugin } from "vite";
import vue from "@vitejs/plugin-vue";
import Icons from "unplugin-icons/vite";
@@ -47,9 +47,9 @@ export default ({ mode }) =>
},
resolve: {
alias: {
"@": resolve(__dirname, "./src"),
"@api": resolve(__dirname, "./src/api"),
"@utils": resolve(__dirname, "./src/utils/"),
"@": fileURLToPath(new URL("./src", import.meta.url)),
"@api": fileURLToPath(new URL("./src/api", import.meta.url)),
"@utils": fileURLToPath(new URL("./src/utils/", import.meta.url)),
},
},
});