|
|
@@ -1,11 +1,18 @@
|
|
|
import { build } from 'vite'
|
|
|
-console.log(process.argv)
|
|
|
+import { fileURLToPath } from 'url'
|
|
|
+import fs from 'fs'
|
|
|
+
|
|
|
let mode = 'production'
|
|
|
-if (process.argv[2] === 'dev') {
|
|
|
- mode = 'development'
|
|
|
-}
|
|
|
-if (process.argv[2] === 'test') {
|
|
|
- mode = 'test'
|
|
|
+const modeFile = fileURLToPath(new URL('../.mode', import.meta.url))
|
|
|
+if (fs.existsSync(modeFile)) {
|
|
|
+ switch (fs.readFileSync(modeFile).toString()) {
|
|
|
+ case 'development':
|
|
|
+ mode = 'development'
|
|
|
+ break
|
|
|
+ case 'test':
|
|
|
+ mode = 'test'
|
|
|
+ break
|
|
|
+ }
|
|
|
}
|
|
|
await build({ configFile: 'packages/main/vite.config.js' })
|
|
|
await build({ configFile: 'packages/preload/vite.config.js' })
|