-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
47 lines (36 loc) · 1 KB
/
build.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
g_front_end = 'frontend/'
g_back_end = 'backend/'
# 打包single-file-cli:
# 1. 使用pkg
# pkg -t node14-win-amd64 -c package.json -o single-file --out-path=bin --no-bytecode --public-packages "*" --public --compress=GZip
# 不能交叉编译,可禁用 bytecode 解决
# package.json添加以下字段:
# "pkg": {
# "scripts": [ "./back-ends/**/*.js", "./lib/**/*.js" ],
# "assets": ""
# }
# 2. 直接将 node.exe 和源代码一起打包, 体积大,文件多
def run_cmd(wd,cmd):
subprocess.check_call(['sh','-c',cmd],cwd=wd)
pass
def build_front_end():
global g_front_end
pass
def build_back_end():
global g_back_end
pass
def build_server():
global g_back_end
global g_front_end
run_cmd(g_front_end, 'ng build')
run_cmd(g_back_end, 'go build')
if __name__ == '__main__':
# build_back_end()
# build_front_end()
build_server()
print('build success')