Skip to content

Commit

Permalink
feat: 新版挂件-兼容Windows构建
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Jul 25, 2023
1 parent 277afc8 commit b485845
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"serve": "bash scripts/serve.sh",
"dev": "BUILD_TYPE=siyuan vite build --watch",
"devWin":"cmd /C \"set BUILD_TYPE=siyuan && vite build --watch\"",
"build": "BUILD_TYPE=siyuan vite build",
"staticBuild": "BUILD_TYPE=static vite build",
"vercelBuild": "BUILD_TYPE=vercel vite build",
Expand Down
10 changes: 8 additions & 2 deletions vite.config.ts
Expand Up @@ -9,6 +9,7 @@ import AutoImport from "unplugin-auto-import/vite"
import Components from "unplugin-vue-components/vite"
import { ElementPlusResolver } from "unplugin-vue-components/resolvers"
import { nodePolyfills } from "vite-plugin-node-polyfills"
import os from "os"

const getAppBase = (isSiyuanBuild: boolean, isStaticBuild: boolean): string => {
if (isSiyuanBuild) {
Expand Down Expand Up @@ -54,8 +55,13 @@ const args = minimist(process.argv.slice(2))
const debugMode = true
const isWatch = args.watch || args.w || false
const isDev = isWatch || debugMode
// const devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/public/data/widgets/sy-post-publisher"
const devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/test/data/widgets/sy-post-publisher"
let devDistDir
if (os.platform() === "win32") {
devDistDir = path.join(os.homedir(), "Documents", "SiYuan", "data", "widgets", "sy-post-publisher")
} else {
devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/public/data/widgets/sy-post-publisher"
// devDistDir = "/Users/terwer/Documents/mydocs/SiYuanWorkspace/test/data/widgets/sy-post-publisher"
}
const distDir = isWatch ? devDistDir : "./dist"
const isSiyuanBuild = process.env.BUILD_TYPE === "siyuan"
const isStaticBuild = process.env.BUILD_TYPE === "static"
Expand Down

0 comments on commit b485845

Please sign in to comment.