build the sqlite plugin before run dev/build

This commit is contained in:
geekgeekrun
2024-03-31 19:45:14 +08:00
parent 7a52846128
commit 8c89fdc0d6
2 changed files with 33 additions and 7 deletions

View File

@@ -7,13 +7,13 @@
"productName": "GeekGeekRun",
"homepage": "https://github.com/geekgeekrun",
"scripts": {
"start": "electron-vite preview",
"dev": "electron-vite dev",
"dev:geek-auto-start-chat-with-boss-main-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=geekAutoStartWithBossMain electron-vite dev",
"dev:geek-auto-start-chat-with-boss-daemon-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=geekAutoStartWithBossDaemon electron-vite dev",
"dev:check-and-download-dependencies-for-init-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=checkAndDownloadDependenciesForInit electron-vite dev",
"dev:launch-bosszhipin-login-page-with-preload-extension-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=launchBossZhipinLoginPageWithPreloadExtension electron-vite dev",
"build": "electron-vite build",
"start": "node scripts/build.mjs && electron-vite preview",
"dev": "node scripts/build.mjs && electron-vite dev",
"dev:geek-auto-start-chat-with-boss-main-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=geekAutoStartWithBossMain pnpm run dev",
"dev:geek-auto-start-chat-with-boss-daemon-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=geekAutoStartWithBossDaemon pnpm run dev",
"dev:check-and-download-dependencies-for-init-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=checkAndDownloadDependenciesForInit pnpm run dev",
"dev:launch-bosszhipin-login-page-with-preload-extension-only": "cross-env MAIN_BOSSGEEKGO_UI_RUN_MODE=launchBossZhipinLoginPageWithPreloadExtension pnpm run dev",
"build": "node scripts/build.mjs && electron-vite build",
"format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix",
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",

View File

@@ -0,0 +1,26 @@
import childProcess from "node:child_process"
import fs from "node:fs"
import path from "node:path"
import os from "node:os"
import url from 'node:url'
const rawCwd = process.cwd()
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const sqlitePluginDirPath = path.join(__dirname, '../../sqlite-plugin')
process.chdir(sqlitePluginDirPath)
try {
const sqlitePluginBuildProcess = childProcess.spawnSync('pnpm run build', {
stdio: ['inherit', 'inherit', 'inherit'],
shell: true
})
process.chdir(rawCwd)
if (sqlitePluginBuildProcess.error) {
throw sqlitePluginBuildProcess.error
}
} catch(error) {
process.chdir(rawCwd)
console.error('error encouter when build sqlite plugin:')
console.error(error)
process.exit(1)
}