@winner-fed/winner-deploy 4.3.5 → 4.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +7 -7
- package/package.json +1 -2
- package/templates/see/bash/scripts/afterInstall.sh +42 -0
- package/templates/see/bash/scripts/js/confuse.js +43 -0
- package/templates/see/bash/scripts/js/obfuscator.js +2 -0
- package/templates/see/bash/scripts/js/readme.md +16 -0
- package/templates/see/python/deploy.xml +1 -1
- package/templates/see/python/scripts/afterInstall.py +21 -3
- package/templates/see/python/scripts/beforeInstall.sh +85 -0
- package/templates/see/python/scripts/install.py +43 -33
- package/templates/see/python/scripts/js/confuse.js +43 -0
- package/templates/see/python/scripts/js/obfuscator.js +2 -0
- package/templates/see/python/scripts/js/readme.md +16 -0
- package/templates/see/python/scripts/utils.py +33 -35
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
1. scripts/js/confuse.js
|
|
2
|
+
用 path.join(pkgRoot, webAppName, configBase + '.js') 定位配置文件,不再写死 frame-layout/sysconfig.js。
|
|
3
|
+
参数约定:argv[1] = SEE 的 webAppName;argv[2] = 配置名(不含 .js,默认 sysconfig);argv[3] = 发布包根目录(可选,默认可用 path.resolve(__dirname, '..', '..'))。
|
|
4
|
+
支持环境变量 WEB_APP_NAME、CONFIG_FILE_NAME。
|
|
5
|
+
缺 webAppName、文件不存在或混淆失败时 process.exit(1),便于 afterInstall.sh 判断。
|
|
6
|
+
|
|
7
|
+
2. scripts/afterInstall.sh
|
|
8
|
+
在安装前用 pkg_root=\pwd`记下发布包根目录(与检查${webAppName}` 时一致)。
|
|
9
|
+
cd 到脚本目录后执行:node ../js/confuse.js "${webAppName}" "{{configFileName}}" "$pkg_root"(原先 ./scripts/js/ 在 scripts/<name>/ 下会指错路径,已改为 ../js/)。
|
|
10
|
+
|
|
11
|
+
3. src/genWebPackage.ts
|
|
12
|
+
先生成 tplPath、再算 resolvedConfigFileName(与 winner / pro / 自定义 tpl 规则一致),再写脚本和 deploy.xml,避免以前「脚本里的名字」和「实际 template 名」不一致。
|
|
13
|
+
afterInstall 的 lodash 模板增加 configFileName: resolvedConfigFileName,打包后会把 {{configFileName}} 写成具体名字(如 sysconfig、config.local)。
|
|
14
|
+
genDeployXml 改为使用 resolvedConfigFileName。
|
|
15
|
+
生成 zip 时把 templates/see/bash/scripts/js 拷到 tmp/scripts/js,与 ../js/confuse.js 一致。
|
|
16
|
+
若你本地只改模板、不跑 genSeePackage,需在发布包里保留 scripts/js/,并保证 afterInstall 里第二段参数与 deploy.xml 里 ${webAppName}/xxx.js 的 xxx 一致。
|
|
@@ -8,62 +8,60 @@ import sys
|
|
|
8
8
|
import stat
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def clear(name,
|
|
11
|
+
def clear(name, deploy_type):
|
|
12
12
|
conf = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "conf")
|
|
13
|
-
|
|
14
13
|
manifest = ""
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
manifest
|
|
15
|
+
if os.path.exists(conf):
|
|
16
|
+
for file in os.listdir(conf):
|
|
17
|
+
if re.match(r'manifest\.[0-9]+\.json', file):
|
|
18
|
+
manifest = file
|
|
19
|
+
break
|
|
19
20
|
|
|
20
|
-
if
|
|
21
|
-
os.
|
|
21
|
+
if not manifest:
|
|
22
|
+
os.system("rm -rf ./" + name)
|
|
22
23
|
else:
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
with open(os.path.join(conf, manifest), "rb") as f:
|
|
25
|
+
fileJson = json.load(f)
|
|
25
26
|
|
|
26
27
|
dirs = []
|
|
27
|
-
|
|
28
|
-
prefix = ""
|
|
29
|
-
|
|
30
|
-
if(type == "bizframe"):
|
|
31
|
-
prefix = "./" + name + "/"
|
|
32
|
-
elif(type == "subsystem"):
|
|
33
|
-
prefix = "./"
|
|
28
|
+
prefix = "./" + name + "/" if deploy_type == "bizframe" else "./"
|
|
34
29
|
|
|
35
30
|
for x in fileJson:
|
|
36
31
|
if fileJson[x]["dir"] not in dirs:
|
|
37
32
|
dirs.append(fileJson[x]["dir"])
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
file_path = prefix + fileJson[x]["path"]
|
|
35
|
+
if os.path.exists(file_path):
|
|
36
|
+
os.remove(file_path)
|
|
41
37
|
|
|
42
38
|
for x in dirs:
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
should_remove = (deploy_type == "bizframe" and x != "") or (deploy_type == "subsystem" and x != name)
|
|
40
|
+
if should_remove:
|
|
41
|
+
dir_path = prefix + x
|
|
42
|
+
if os.path.exists(dir_path):
|
|
45
43
|
try:
|
|
46
|
-
os.removedirs(
|
|
44
|
+
os.removedirs(dir_path)
|
|
47
45
|
except OSError:
|
|
48
46
|
pass
|
|
49
47
|
|
|
50
48
|
RD, WD, XD = 4, 2, 1
|
|
51
49
|
BNS = [RD, WD, XD]
|
|
52
50
|
MDS = [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
[stat.S_IRUSR, stat.S_IRGRP, stat.S_IROTH],
|
|
52
|
+
[stat.S_IWUSR, stat.S_IWGRP, stat.S_IWOTH],
|
|
53
|
+
[stat.S_IXUSR, stat.S_IXGRP, stat.S_IXOTH]
|
|
56
54
|
]
|
|
57
55
|
|
|
58
56
|
def chmod(path, mode):
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
if isinstance(mode, int):
|
|
58
|
+
mode = str(mode)
|
|
59
|
+
if not re.match("^[0-7]{1,3}$", mode):
|
|
60
|
+
raise Exception("mode does not conform to ^[0-7]{1,3}$ pattern")
|
|
61
|
+
mode = "{0:0>3}".format(mode)
|
|
62
|
+
mode_num = 0
|
|
63
|
+
for midx, m in enumerate(mode):
|
|
64
|
+
for bnidx, bn in enumerate(BNS):
|
|
65
|
+
if (int(m) & bn) > 0:
|
|
66
|
+
mode_num += MDS[bnidx][midx]
|
|
67
|
+
os.chmod(path, mode_num)
|