-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.mjs
executable file
·26 lines (21 loc) · 981 Bytes
/
build.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env node
import { spawn } from 'child_process'
import { styleText } from 'util';
import './api/node_modules/dotenv/config.js'
let runCmd = (commandString) => new Promise((resolve, reject) => {
let cmd = spawn(commandString, { shell: true, env: process.env })
cmd.stdout.on('data', (data) => process.stdout.write(data))
cmd.stderr.on('data', (data) => process.stderr.write(data))
cmd.on('error', (e) => reject(e))
cmd.on('close', (e) => e == 0 ? resolve() : reject(`Return code: ${e}`))
})
let platform = process.platform.replace(/32$/, '').replace('darwin', 'mac')
console.log(styleText(['magenta', 'bold'], 'Building UI'))
process.chdir('ui')
await runCmd('npm run build')
console.log(styleText(['magenta', 'bold'], 'Building API'))
process.chdir('../api')
await runCmd('npm run build')
console.log(styleText(['magenta', 'bold'], 'Building Electron'))
process.chdir('../electron')
await runCmd(`npm run build:${platform} --c.extraMetadata.version=2.0.0`)