@winner-fed/winner-deploy 4.3.7 → 4.3.8
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/README.md +174 -161
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -1
- package/templates/see/bash/scripts/afterInstall.sh +8 -2
- package/templates/see/bash/scripts/js/confuse.sh +58 -0
- package/templates/see/bash/scripts/js/readme.md +13 -13
- package/templates/see/python/scripts/afterInstall.py +15 -2
- package/templates/see/python/scripts/js/confuse.sh +58 -0
- package/templates/see/python/scripts/js/readme.md +14 -14
package/README.md
CHANGED
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
## 特性
|
|
10
10
|
|
|
11
11
|
- 🚀 支持外框架(bizframe)和子系统(subsystem)两种应用类型
|
|
12
|
-
- 📦 自动生成 SEE 平台所需的
|
|
13
|
-
- 🐳 支持 Docker
|
|
14
|
-
- 🔧
|
|
12
|
+
- 📦 自动生成 SEE 平台所需的 deploy.xml 与 template 配置文件
|
|
13
|
+
- 🐳 支持 Docker 容器化部署(`seePackageType: 'docker'`)
|
|
14
|
+
- 🔧 灵活的模板变量配置系统(`variablesFunc` / `tplPath`)
|
|
15
15
|
- 📝 支持 Python 和 Bash 两种脚本类型
|
|
16
|
+
- 🔒 可选的安装后配置 JS 混淆(`enableObfuscation`)
|
|
16
17
|
- 🎯 可自定义文件拷贝和配置生成逻辑
|
|
17
18
|
|
|
18
19
|
## 安装
|
|
@@ -32,12 +33,16 @@ pnpm add @winner-fed/winner-deploy
|
|
|
32
33
|
```javascript
|
|
33
34
|
import { generateSeePackageZip } from '@winner-fed/winner-deploy';
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
36
|
+
generateSeePackageZip(
|
|
37
|
+
{
|
|
38
|
+
name: 'my-app',
|
|
39
|
+
version: '1.0.0',
|
|
40
|
+
description: '我的应用'
|
|
41
|
+
},
|
|
42
|
+
() => {
|
|
43
|
+
console.log('生成完成');
|
|
44
|
+
}
|
|
45
|
+
);
|
|
41
46
|
```
|
|
42
47
|
|
|
43
48
|
### 完整配置示例
|
|
@@ -51,34 +56,29 @@ generateSeePackageZip(
|
|
|
51
56
|
type: 'subsystem',
|
|
52
57
|
name: 'my-app',
|
|
53
58
|
appType: 'my-app',
|
|
59
|
+
appName: 'my-app',
|
|
54
60
|
version: '1.0.0',
|
|
55
61
|
group: 'bizframe',
|
|
56
62
|
configName: 'config.local',
|
|
57
63
|
outputName: 'dist',
|
|
58
64
|
description: '我的应用部署包',
|
|
65
|
+
seePackagePath: 'package',
|
|
59
66
|
seePackageType: 'web',
|
|
60
67
|
scriptsType: 'python',
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
variablesFunc: () =>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
];
|
|
74
|
-
}
|
|
68
|
+
enableObfuscation: false,
|
|
69
|
+
copyFiles: ['version.js'],
|
|
70
|
+
tplPath: {},
|
|
71
|
+
templateFunc: () => './dist/my-app/sysconfig.js',
|
|
72
|
+
variablesFunc: () => [
|
|
73
|
+
{
|
|
74
|
+
type: 'input',
|
|
75
|
+
label: '应用标题',
|
|
76
|
+
name: 'APP_TITLE'
|
|
77
|
+
}
|
|
78
|
+
]
|
|
75
79
|
},
|
|
76
|
-
(
|
|
77
|
-
|
|
78
|
-
console.error('生成失败:', err);
|
|
79
|
-
} else {
|
|
80
|
-
console.log('生成成功:', result);
|
|
81
|
-
}
|
|
80
|
+
() => {
|
|
81
|
+
console.log('生成成功');
|
|
82
82
|
}
|
|
83
83
|
);
|
|
84
84
|
```
|
|
@@ -87,100 +87,101 @@ generateSeePackageZip(
|
|
|
87
87
|
|
|
88
88
|
### generateSeePackageZip(options, callback)
|
|
89
89
|
|
|
90
|
-
生成 SEE
|
|
90
|
+
生成 SEE 平台部署包。`name`、`version` 缺失时会抛出错误;`name` 与 `seePackageName` 中的 `@`、`/` 会自动替换为 `-`。
|
|
91
91
|
|
|
92
92
|
#### 参数说明
|
|
93
93
|
|
|
94
|
-
| 参数名
|
|
95
|
-
|
|
|
96
|
-
| system
|
|
97
|
-
| type
|
|
98
|
-
| name
|
|
99
|
-
|
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
94
|
+
| 参数名 | 类型 | 默认值 | 必填 | 说明 |
|
|
95
|
+
| ----------------- | -------------------------------------- | ------------------------------------ | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
96
|
+
| system | string | `'winner-front'` | 否 | 系统类型,SEE 平台分组维度 |
|
|
97
|
+
| type | `'bizframe' \| 'subsystem'` | `'bizframe'` | 否 | 应用类型:外框架或子系统 |
|
|
98
|
+
| name | string | - | 是 | 发布物名称(子系统标识、脚本目录名等) |
|
|
99
|
+
| version | string | - | 是 | 发布包版本 |
|
|
100
|
+
| description | string | - | 否 | 发布包说明,写入 deploy.xml |
|
|
101
|
+
| appType | string | `name` | 否 | 发布物类型 |
|
|
102
|
+
| appName | string | `name` | 否 | deploy.xml 中 `appName` 标签 |
|
|
103
|
+
| group | string | `'bizframe'` | 否 | 应用分组 |
|
|
104
|
+
| configName | string | `'config.local'` | 否 | 配置文件名(不含 `.js`)。为空时可构建不含配置 JS 的静态包,此时 `scriptsType` 应使用 `bash`。实际写入 template 的文件名还会按项目类型自动推断:存在 `dist/config.local.js` 时用 `config.local`,存在 `dist/sysconfig.js`(或子包路径下)时用 `sysconfig` |
|
|
105
|
+
| outputName | string | `'dist'` | 否 | 构建产物目录名(相对项目根目录) |
|
|
106
|
+
| seePackageName | string | `` `${system}-${name}-${version}` `` | 否 | zip 包文件名(不含 `.zip`) |
|
|
107
|
+
| seePackagePath | string | `'package'` | 否 | zip 输出目录,相对项目根目录;设为 `'/'` 时输出到当前目录 |
|
|
108
|
+
| seePackageType | `'web' \| 'docker'` | `'web'` | 否 | 发布物类型 |
|
|
109
|
+
| dockerImage | string | - | 否 | Docker 镜像名,`seePackageType` 为 `'docker'` 时生效 |
|
|
110
|
+
| scriptsType | `'python' \| 'bash'` | `'python'` | 否 | 集群脚本语言 |
|
|
111
|
+
| enableObfuscation | boolean | `false` | 否 | 为 `true` 时打包 `scripts/{name}/js/`(含 `confuse.js`),并在 `afterInstall` 中对 template 配置 JS 做混淆;为 `false` 时不拷贝、不执行混淆 |
|
|
112
|
+
| tplPath | `Record<string, string>` | `{}` | 否 | 自定义模板:`key` 为包内文件名,`value` 为本地绝对路径。`deploy.xml` 同名则覆盖生成的 deploy.xml;`sysconfig.js` / `config.local.js` 会跳过自动生成对应配置 |
|
|
113
|
+
| copyFiles | `string[]` | - | 否 | 额外拷贝到包内 `source/{name}/` 的文件名列表,源路径为 `` `${outputName}/${name}/${file}` `` |
|
|
114
|
+
| templateFunc | `() => string \| undefined` | 见下文 | 否 | 返回待写入 template 的配置 JS 源文件路径 |
|
|
115
|
+
| variablesFunc | `() => FieldAttributes[] \| undefined` | 见下文 | 否 | 返回 deploy.xml 动态表单项 |
|
|
116
|
+
|
|
117
|
+
#### templateFunc 默认值
|
|
118
|
+
|
|
119
|
+
未传入时按 `type` 与 `outputName` 解析:
|
|
116
120
|
|
|
117
121
|
```javascript
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
122
|
+
// type === 'bizframe'
|
|
123
|
+
() => `./${outputName}/config.local.js`
|
|
124
|
+
|
|
125
|
+
// type === 'subsystem'
|
|
126
|
+
() => `./${outputName}/${name}/sysconfig.js`
|
|
124
127
|
```
|
|
125
128
|
|
|
126
|
-
#### variablesFunc
|
|
129
|
+
#### variablesFunc 默认值
|
|
127
130
|
|
|
128
|
-
|
|
131
|
+
未传入时尝试加载项目根目录下 `build/package/variables.js` 的 `variables` 字段;加载失败则返回 `[]`(与 `type` 无关)。
|
|
129
132
|
|
|
130
133
|
```javascript
|
|
131
|
-
variablesFunc:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
'build',
|
|
138
|
-
'package',
|
|
139
|
-
'./variables.js'
|
|
140
|
-
));
|
|
141
|
-
return variables || [];
|
|
142
|
-
} catch (error) {
|
|
143
|
-
console.error(error);
|
|
144
|
-
return [];
|
|
145
|
-
}
|
|
134
|
+
variablesFunc: () => {
|
|
135
|
+
try {
|
|
136
|
+
const { variables } = require('./build/package/variables.js');
|
|
137
|
+
return variables || [];
|
|
138
|
+
} catch {
|
|
139
|
+
return [];
|
|
146
140
|
}
|
|
147
|
-
|
|
141
|
+
};
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### tplPath 说明
|
|
145
|
+
|
|
146
|
+
```javascript
|
|
147
|
+
tplPath: {
|
|
148
|
+
'deploy.xml': '/abs/path/custom-deploy.xml',
|
|
149
|
+
'sysconfig.js': '/abs/path/sysconfig.js'
|
|
148
150
|
}
|
|
149
151
|
```
|
|
150
152
|
|
|
151
|
-
|
|
153
|
+
- 除 `deploy.xml` 外,其余文件复制到包内 `template/` 目录。
|
|
154
|
+
- 提供 `sysconfig.js` 或 `config.local.js` 时,不再根据 `templateFunc` 生成同名配置。
|
|
152
155
|
|
|
153
|
-
|
|
156
|
+
#### copyFiles 说明
|
|
157
|
+
|
|
158
|
+
适用于 manifest 未收录、但需要打进 SEE 包的文件:
|
|
154
159
|
|
|
155
160
|
```javascript
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
'assets/logo.png', // assets 目录下的 logo.png
|
|
159
|
-
'config/env.json' // config 目录下的 env.json
|
|
160
|
-
];
|
|
161
|
+
// 将 dist/my-app/version.js 拷贝到包内 source/my-app/version.js
|
|
162
|
+
copyFiles: ['version.js'];
|
|
161
163
|
```
|
|
162
164
|
|
|
163
|
-
#### callback
|
|
165
|
+
#### callback 回调
|
|
166
|
+
|
|
167
|
+
第二个参数为无参函数,在 zip 写入完成且临时目录清理后调用,**不传递 error / result**:
|
|
164
168
|
|
|
165
169
|
```javascript
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
console.error('生成失败:', error);
|
|
170
|
-
} else {
|
|
171
|
-
// 处理成功结果
|
|
172
|
-
console.log('生成成功:', result);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
170
|
+
generateSeePackageZip(options, () => {
|
|
171
|
+
console.log('打包结束');
|
|
172
|
+
});
|
|
175
173
|
```
|
|
176
174
|
|
|
175
|
+
打包过程中会先组装 `tmp/`,在回调阶段写入 `source/`(及 python 的 manifest 相关文件),再压缩为 zip。
|
|
176
|
+
|
|
177
177
|
## 模板变量配置
|
|
178
178
|
|
|
179
|
-
SEE
|
|
179
|
+
SEE 平台支持多种类型的模板变量控件,用于在部署时动态配置应用参数。详细说明见 [TYPE.md](./TYPE.md)。
|
|
180
180
|
|
|
181
181
|
### 支持的控件类型
|
|
182
182
|
|
|
183
183
|
- **input**: 普通文本输入框
|
|
184
|
+
- **editor**: 大文本编辑框
|
|
184
185
|
- **select**: 单选下拉框
|
|
185
186
|
- **switch**: 开关组件
|
|
186
187
|
- **smallfile**: 文件上传控件(小于 2M)
|
|
@@ -188,8 +189,8 @@ SEE 平台支持多种类型的模板变量控件,用于在部署时动态配
|
|
|
188
189
|
- **complexSelect**: 复杂单选框
|
|
189
190
|
- **table**: 表格控件
|
|
190
191
|
- **division**: 分栏折叠控件
|
|
191
|
-
- **password**:
|
|
192
|
-
- **hidden**:
|
|
192
|
+
- **password**: 密码输入框(加密存储)
|
|
193
|
+
- **hidden**: 隐藏输入框
|
|
193
194
|
|
|
194
195
|
### 示例配置
|
|
195
196
|
|
|
@@ -199,112 +200,124 @@ const variables = [
|
|
|
199
200
|
type: 'input',
|
|
200
201
|
label: '应用标题',
|
|
201
202
|
tooltip: '设置应用的显示标题',
|
|
202
|
-
name: 'APP_TITLE'
|
|
203
|
-
default: '默认应用标题'
|
|
203
|
+
name: 'APP_TITLE'
|
|
204
204
|
},
|
|
205
205
|
{
|
|
206
206
|
type: 'select',
|
|
207
207
|
label: '环境选择',
|
|
208
208
|
options: 'dev:开发环境;test:测试环境;prod:生产环境',
|
|
209
|
-
|
|
210
|
-
name: 'ENVIRONMENT',
|
|
211
|
-
default: 'dev'
|
|
209
|
+
name: 'ENVIRONMENT'
|
|
212
210
|
},
|
|
213
211
|
{
|
|
214
212
|
type: 'switch',
|
|
215
213
|
label: '启用调试',
|
|
216
|
-
|
|
217
|
-
name: 'DEBUG_MODE',
|
|
218
|
-
default: false
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
type: 'password',
|
|
222
|
-
label: '数据库密码',
|
|
223
|
-
tooltip: '数据库连接密码',
|
|
224
|
-
name: 'DB_PASSWORD',
|
|
225
|
-
required: true,
|
|
226
|
-
default: ''
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
type: 'hidden',
|
|
230
|
-
label: '应用版本号',
|
|
231
|
-
tooltip: '应用内部版本号,用于系统识别',
|
|
232
|
-
name: 'APP_VERSION',
|
|
233
|
-
default: '1.0.0'
|
|
214
|
+
name: 'DEBUG_MODE'
|
|
234
215
|
}
|
|
235
216
|
];
|
|
236
217
|
```
|
|
237
218
|
|
|
238
|
-
##
|
|
219
|
+
## 发布包结构
|
|
239
220
|
|
|
240
|
-
|
|
221
|
+
默认输出路径:`{seePackagePath}/{seePackageName}.zip`(例如 `package/winner-front-my-app-1.0.0.zip`)。
|
|
241
222
|
|
|
242
223
|
```
|
|
243
224
|
see-package.zip
|
|
244
|
-
├──
|
|
245
|
-
├──
|
|
246
|
-
|
|
247
|
-
├──
|
|
248
|
-
|
|
249
|
-
├──
|
|
250
|
-
├──
|
|
251
|
-
|
|
225
|
+
├── deploy.xml
|
|
226
|
+
├── template/
|
|
227
|
+
│ └── config.local.js | sysconfig.js | 自定义名.js
|
|
228
|
+
├── scripts/
|
|
229
|
+
│ └── {name}/
|
|
230
|
+
│ ├── install.py | install.sh
|
|
231
|
+
│ ├── afterInstall.py | afterInstall.sh
|
|
232
|
+
│ ├── uninstall.py | uninstall.sh
|
|
233
|
+
│ ├── utils.py # 仅 python
|
|
234
|
+
│ ├── beforeInstall.sh # 仅 python
|
|
235
|
+
│ ├── conf/manifest.*.json # 仅 python 且 dist 含 manifest 时
|
|
236
|
+
│ └── js/ # 仅 enableObfuscation === true
|
|
237
|
+
│ ├── confuse.js
|
|
238
|
+
│ └── javascript-obfuscator.js
|
|
239
|
+
└── source/ # 安装脚本从 tmp/source 部署到 workspace
|
|
252
240
|
└── ...
|
|
253
241
|
```
|
|
254
242
|
|
|
243
|
+
`scriptsType === 'python'` 且存在 `manifest.{timestamp}.json` 时,按 manifest 拷贝文件到 `source/`;否则将整个 `outputName` 目录拷贝到 `source/`。`scriptsType === 'bash'` 时始终拷贝整个 `outputName` 到 `source/`。
|
|
244
|
+
|
|
255
245
|
## 使用场景
|
|
256
246
|
|
|
257
247
|
### 1. 外框架应用(bizframe)
|
|
258
248
|
|
|
259
|
-
适用于作为主框架的运行的子应用。
|
|
260
|
-
|
|
261
249
|
```javascript
|
|
262
|
-
generateSeePackageZip(
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
250
|
+
generateSeePackageZip(
|
|
251
|
+
{
|
|
252
|
+
type: 'bizframe',
|
|
253
|
+
name: 'main-frame',
|
|
254
|
+
version: '1.0.0',
|
|
255
|
+
description: '主框架应用'
|
|
256
|
+
},
|
|
257
|
+
() => {}
|
|
258
|
+
);
|
|
268
259
|
```
|
|
269
260
|
|
|
270
261
|
### 2. 子系统应用(subsystem)
|
|
271
262
|
|
|
272
|
-
适用于业务子系统,通常作为微前端模块。
|
|
273
|
-
|
|
274
263
|
```javascript
|
|
275
|
-
generateSeePackageZip(
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
264
|
+
generateSeePackageZip(
|
|
265
|
+
{
|
|
266
|
+
type: 'subsystem',
|
|
267
|
+
name: 'user-management',
|
|
268
|
+
version: '1.0.0',
|
|
269
|
+
description: '用户管理子系统'
|
|
270
|
+
},
|
|
271
|
+
() => {}
|
|
272
|
+
);
|
|
281
273
|
```
|
|
282
274
|
|
|
283
|
-
|
|
275
|
+
子系统安装目录需指向具体前端根目录(如 `/home/hsiar/hsiar-green/html/`),详见控制台完成提示。
|
|
284
276
|
|
|
285
|
-
|
|
277
|
+
### 3. 开启配置 JS 混淆
|
|
278
|
+
|
|
279
|
+
需目标环境已安装 `node`:
|
|
286
280
|
|
|
287
281
|
```javascript
|
|
288
|
-
generateSeePackageZip(
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
282
|
+
generateSeePackageZip(
|
|
283
|
+
{
|
|
284
|
+
name: 'my-app',
|
|
285
|
+
version: '1.0.0',
|
|
286
|
+
scriptsType: 'bash',
|
|
287
|
+
enableObfuscation: true,
|
|
288
|
+
description: '开启 afterInstall 混淆'
|
|
289
|
+
},
|
|
290
|
+
() => {}
|
|
291
|
+
);
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### 4. Docker 容器化部署
|
|
295
|
+
|
|
296
|
+
```javascript
|
|
297
|
+
generateSeePackageZip(
|
|
298
|
+
{
|
|
299
|
+
name: 'my-app',
|
|
300
|
+
version: '1.0.0',
|
|
301
|
+
seePackageType: 'docker',
|
|
302
|
+
dockerImage: 'my-app:1.0.0',
|
|
303
|
+
description: '容器化应用'
|
|
304
|
+
},
|
|
305
|
+
() => {}
|
|
306
|
+
);
|
|
295
307
|
```
|
|
296
308
|
|
|
297
309
|
## 注意事项
|
|
298
310
|
|
|
299
|
-
1.
|
|
300
|
-
2.
|
|
301
|
-
3.
|
|
302
|
-
4. **Docker
|
|
303
|
-
5.
|
|
311
|
+
1. **copyFiles**:源文件路径为 `` `${outputName}/${name}/文件名` ``,不是项目根目录直写路径。
|
|
312
|
+
2. **configName**:除手动指定外,会根据 `outputName` 下是否存在 `config.local.js` / `sysconfig.js` 自动选用文件名。
|
|
313
|
+
3. **name 特殊字符**:`@`、`/` 会在打包前替换为 `-`。
|
|
314
|
+
4. **Docker**:使用 Docker 部署时需确保镜像已构建并可被 SEE 环境拉取。
|
|
315
|
+
5. **混淆**:`enableObfuscation: true` 时 `afterInstall` 依赖 `node` 执行 `confuse.js`。
|
|
316
|
+
6. **Python 脚本**:目标环境需具备 Python 运行时(及 `node`,若开启混淆)。
|
|
304
317
|
|
|
305
318
|
## 更新日志
|
|
306
319
|
|
|
307
|
-
|
|
320
|
+
详见 [CHANGELOG.md](./CHANGELOG.md)。
|
|
308
321
|
|
|
309
322
|
## 许可证
|
|
310
323
|
|
|
@@ -312,4 +325,4 @@ MIT License
|
|
|
312
325
|
|
|
313
326
|
## 贡献
|
|
314
327
|
|
|
315
|
-
欢迎提交 Issue 和 Pull Request
|
|
328
|
+
欢迎提交 Issue 和 Pull Request。
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** build time:
|
|
1
|
+
/** build time: Thu Jul 30 2026 10:40:12 GMT+0800 (中国标准时间), build version 4.3.8 **/
|
|
2
2
|
var xe=Object.create;var X=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames,ee=Object.getOwnPropertySymbols,Te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable;var te=(r,t,n)=>t in r?X(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,U=(r,t)=>{for(var n in t||(t={}))ne.call(t,n)&&te(r,n,t[n]);if(ee)for(var n of ee(t))ke.call(t,n)&&te(r,n,t[n]);return r};var _e=(r,t)=>{for(var n in t)X(r,n,{get:t[n],enumerable:!0})},oe=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Oe(t))!ne.call(r,l)&&l!==n&&X(r,l,{get:()=>t[l],enumerable:!(i=be(t,l))||i.enumerable});return r};var O=(r,t,n)=>(n=r!=null?xe(Te(r)):{},oe(t||!r||!r.__esModule?X(n,"default",{value:r,enumerable:!0}):n,r)),Ae=r=>oe(X({},"__esModule",{value:!0}),r);var ve={};_e(ve,{generateSeePackageZip:()=>De});module.exports=Ae(ve);var Se=O(require("chalk"),1),$e=O(require("path"),1),T=O(require("fs-extra"),1);var ye=O(require("path"),1),b=O(require("fs-extra"),1),W=require("rimraf");var C=O(require("path"),1),K=O(require("fs-extra"),1),re=O(require("archiver"),1),q=O(require("xml"),1);var B=process.cwd(),V=function(t){let n={""":'"',"'":"'","<":"<",">":">"},i=/(")|(')|(<)|(>)/g;return t&&t.replace?t.replace(i,function(l){return n[l]}):t},D=function(t,n){let i=n||"",l=C.default.resolve(B,t,i,"sysconfig.js");return K.default.pathExistsSync(l)},L=function(t){let n=C.default.resolve(B,t,"config.local.js");return K.default.pathExistsSync(n)},I=function(t,n,i,l){let o=C.default.join(B,n);n!=="/"&&K.default.ensureDirSync(o);let e=K.default.createWriteStream(`${n==="/"?".":o}/${t}.zip`);e.on("close",function(){setTimeout(function(){l&&l()})});let s=(0,re.default)("zip",{zlib:{level:9}});s.on("error",function(c){console.error(),console.error(c.stack||c),c.details&&console.error(c.details)}),s.pipe(e),s.directory(i,!1),s.finalize()},Z=function(t,n,i){let{type:l,label:o,name:e,tooltip:s="",visible:c="true",required:a="false",fixed:$="false",fold:f="false",options:m="",validate:d="",upgrade:p="false"}=t,P=t.default;if(i==="form"){let k=(0,q.default)({form:[{_attr:{name:e,tooltip:s,visible:c,required:a,fixed:$,fold:f,options:m,validate:d,upgrade:p}},n]});return V(k)}let y=l==="complexSelect"?{default:t.default}:{},g=(0,q.default)({field:[{_attr:U({type:l,label:o,name:e,tooltip:s,visible:c,required:a,fixed:$,fold:f,options:m,validate:d,upgrade:p},y)},n||P]});return V(g)},ie=function(t){let i=t.children.map(l=>{let e=l.children.map(s=>Z(s)).join("");return Z(l,e,"form")}).join("");return Z(t,i)},z=function r(t,n,i="",l=""){for(let o=0;o<t.length;o++){let e=t[o];if(e.type==="complexSelect"?(e.fullName=`${e.name}`,e.fullPath=`${e.type}`):(e.fullName=`${i===""?"":i+"."}${e.name}`,e.fullPath=`${l===""?"":l+"-"}${e.type}`),n(e))return e;if(e.children&&e.children.length>0){let s=r(e.children,n,e.fullName,e.fullPath);if(s)return s}}return null};function le(r="python"){return r==="python"?"py":"sh"}var w=O(require("fs-extra"),1),se=O(require("path"),1),E=O(require("lodash.template"),1),ce=O(require("xml"),1),ae=O(require("@babel/core"),1);var Pe=["input","editor","select","switch","smallfile","table","mselect","switchForm","complexSelect","division","password","hidden"],Q=r=>se.default.resolve(__dirname,`../templates/see/${r}`),J=r=>{let t=r.type;if(!Pe.includes(t))return"";let{label:n,name:i,tooltip:l="",visible:o="true",required:e="false",fixed:s="false",fold:c="false",options:a="",validate:$="",upgrade:f="false",expose:m="",algorithm:d="",merge:p="",isomeris:P="",old_name:y=""}=r,g=r.default;if(t==="table"){let u=r.keys||[];g=(r.columns||u).map(x=>J(x)).join(`
|
|
3
3
|
`)}else if(t==="switchForm"||t==="division"){let u=r.children;g=u?u.map(h=>J(h)).join(`
|
|
4
4
|
`):""}else{if(t==="complexSelect")return ie(r);t==="editor"?g=typeof g=="object"?[JSON.stringify(g)]:[g]:g=[g]}let k=t==="switchForm"?{default:r.default}:{},F=U({type:t,label:n,name:i,tooltip:l,visible:o,required:e,fixed:s,fold:c,options:a,validate:$,upgrade:f,expose:m,algorithm:d,merge:p,isomeris:P,old_name:y},k),N=Object.fromEntries(Object.entries(F).filter(([u,h])=>h!==""&&h!==null&&h!==void 0)),j=(0,ce.default)({field:[{_attr:N},...Array.isArray(g)?g:[g]]});return V(j)},fe=function({system:t,type:n,name:i,appType:l,appName:o,group:e,version:s,configFileName:c="config.local",variables:a=[],description:$,scriptsType:f="python"}){let m=w.default.readFileSync(Q(`${f}/deploy.xml`)).toString();return(0,E.default)(m,{interpolate:/{{([\s\S]+?)}}/g})({system:t,type:n,name:i,appName:o,appType:l,group:e,version:s,configFileName:c,variables:a.map(d=>J(d)).join(`
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** build time:
|
|
1
|
+
/** build time: Thu Jul 30 2026 10:40:12 GMT+0800 (中国标准时间), build version 4.3.8 **/
|
|
2
2
|
var fe=Object.defineProperty;var q=Object.getOwnPropertySymbols;var pe=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var B=(i,t,n)=>t in i?fe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n,K=(i,t)=>{for(var n in t||(t={}))pe.call(t,n)&&B(i,n,t[n]);if(q)for(var n of q(t))me.call(t,n)&&B(i,n,t[n]);return i};var W=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(t,n)=>(typeof require!="undefined"?require:t)[n]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});import he from"chalk";import xe from"path";import k from"fs-extra";import $e from"path";import b from"fs-extra";import{rimraf as re}from"rimraf";import z from"path";import L from"fs-extra";import ue from"archiver";import G from"xml";var J=process.cwd(),Q=function(t){let n={""":'"',"'":"'","<":"<",">":">"},r=/(")|(')|(<)|(>)/g;return t&&t.replace?t.replace(r,function(c){return n[c]}):t},j=function(t,n){let r=n||"",c=z.resolve(J,t,r,"sysconfig.js");return L.pathExistsSync(c)},E=function(t){let n=z.resolve(J,t,"config.local.js");return L.pathExistsSync(n)},N=function(t,n,r,c){let o=z.join(J,n);n!=="/"&&L.ensureDirSync(o);let e=L.createWriteStream(`${n==="/"?".":o}/${t}.zip`);e.on("close",function(){setTimeout(function(){c&&c()})});let l=ue("zip",{zlib:{level:9}});l.on("error",function(s){console.error(),console.error(s.stack||s),s.details&&console.error(s.details)}),l.pipe(e),l.directory(r,!1),l.finalize()},C=function(t,n,r){let{type:c,label:o,name:e,tooltip:l="",visible:s="true",required:a="false",fixed:$="false",fold:f="false",options:m="",validate:d="",upgrade:p="false"}=t,A=t.default;if(r==="form"){let O=G({form:[{_attr:{name:e,tooltip:l,visible:s,required:a,fixed:$,fold:f,options:m,validate:d,upgrade:p}},n]});return Q(O)}let y=c==="complexSelect"?{default:t.default}:{},g=G({field:[{_attr:K({type:c,label:o,name:e,tooltip:l,visible:s,required:a,fixed:$,fold:f,options:m,validate:d,upgrade:p},y)},n||A]});return Q(g)},H=function(t){let r=t.children.map(c=>{let e=c.children.map(l=>C(l)).join("");return C(c,e,"form")}).join("");return C(t,r)},U=function i(t,n,r="",c=""){for(let o=0;o<t.length;o++){let e=t[o];if(e.type==="complexSelect"?(e.fullName=`${e.name}`,e.fullPath=`${e.type}`):(e.fullName=`${r===""?"":r+"."}${e.name}`,e.fullPath=`${c===""?"":c+"-"}${e.type}`),n(e))return e;if(e.children&&e.children.length>0){let l=i(e.children,n,e.fullName,e.fullPath);if(l)return l}}return null};function Y(i="python"){return i==="python"?"py":"sh"}import M from"fs-extra";import ye from"path";import R from"lodash.template";import ge from"xml";import de from"@babel/core";var Se=["input","editor","select","switch","smallfile","table","mselect","switchForm","complexSelect","division","password","hidden"],X=i=>ye.resolve(__dirname,`../templates/see/${i}`),V=i=>{let t=i.type;if(!Se.includes(t))return"";let{label:n,name:r,tooltip:c="",visible:o="true",required:e="false",fixed:l="false",fold:s="false",options:a="",validate:$="",upgrade:f="false",expose:m="",algorithm:d="",merge:p="",isomeris:A="",old_name:y=""}=i,g=i.default;if(t==="table"){let u=i.keys||[];g=(i.columns||u).map(x=>V(x)).join(`
|
|
3
3
|
`)}else if(t==="switchForm"||t==="division"){let u=i.children;g=u?u.map(h=>V(h)).join(`
|
|
4
4
|
`):""}else{if(t==="complexSelect")return H(i);t==="editor"?g=typeof g=="object"?[JSON.stringify(g)]:[g]:g=[g]}let O=t==="switchForm"?{default:i.default}:{},P=K({type:t,label:n,name:r,tooltip:c,visible:o,required:e,fixed:l,fold:s,options:a,validate:$,upgrade:f,expose:m,algorithm:d,merge:p,isomeris:A,old_name:y},O),v=Object.fromEntries(Object.entries(P).filter(([u,h])=>h!==""&&h!==null&&h!==void 0)),F=ge({field:[{_attr:v},...Array.isArray(g)?g:[g]]});return Q(F)},ee=function({system:t,type:n,name:r,appType:c,appName:o,group:e,version:l,configFileName:s="config.local",variables:a=[],description:$,scriptsType:f="python"}){let m=M.readFileSync(X(`${f}/deploy.xml`)).toString();return R(m,{interpolate:/{{([\s\S]+?)}}/g})({system:t,type:n,name:r,appName:o,appType:c,group:e,version:l,configFileName:s,variables:a.map(d=>V(d)).join(`
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@winner-fed/winner-deploy",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.8",
|
|
4
4
|
"description": "Generate a publication deployed by the See platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"winner",
|
|
7
7
|
"see",
|
|
8
8
|
"deploy"
|
|
9
9
|
],
|
|
10
|
+
"packageManager": "pnpm@10.0.0",
|
|
10
11
|
"main": "dist/index.js",
|
|
11
12
|
"module": "dist/index.js",
|
|
12
13
|
"types": "dist/index.d.ts",
|
|
@@ -29,11 +29,17 @@ echo -e "${CHECK_ICON} 成功: 应用目录 '${webAppName}' 已找到且不为
|
|
|
29
29
|
echo -e "${CHECK_ICON} 安装验证通过。"
|
|
30
30
|
|
|
31
31
|
<% if (enableObfuscation) { %>
|
|
32
|
-
#
|
|
32
|
+
# 混淆配置文件:优先 node(javascript-obfuscator),无 node 时回退 bash 轻量混淆
|
|
33
33
|
echo -e "${CHECK_ICON} 开始混淆配置文件..."
|
|
34
34
|
pkg_root=`pwd`
|
|
35
35
|
cd "$(dirname "$0")"
|
|
36
|
-
node
|
|
36
|
+
if command -v node >/dev/null 2>&1; then
|
|
37
|
+
echo -e "${INFO_ICON} 检测到 node,使用 confuse.js 强混淆"
|
|
38
|
+
node ./js/confuse.js "${webAppName}" "{{configFileName}}" "$pkg_root"
|
|
39
|
+
else
|
|
40
|
+
echo -e "${WARNING_ICON} 未检测到 node,使用 confuse.sh 轻量混淆(强度较弱)"
|
|
41
|
+
bash ./js/confuse.sh "${webAppName}" "{{configFileName}}" "$pkg_root"
|
|
42
|
+
fi
|
|
37
43
|
if [ $? -ne 0 ]; then
|
|
38
44
|
echo -e "${ERROR_ICON} 错误: 混淆配置文件失败。" >&2
|
|
39
45
|
exit 1
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# 无 node 时的轻量混淆:整文件 base64 + atob/eval 包裹。
|
|
3
|
+
# 强度远低于 confuse.js(javascript-obfuscator),仅作兼容兜底。
|
|
4
|
+
# 参数:webAppName configBase [pkgRoot]
|
|
5
|
+
|
|
6
|
+
ERROR_ICON="❌"
|
|
7
|
+
INFO_ICON="ℹ️"
|
|
8
|
+
CHECK_ICON="✅"
|
|
9
|
+
|
|
10
|
+
webAppName="${1:-${WEB_APP_NAME}}"
|
|
11
|
+
configBase="${2:-${CONFIG_FILE_NAME:-sysconfig}}"
|
|
12
|
+
pkgRoot="${3:-}"
|
|
13
|
+
|
|
14
|
+
if [ -z "$pkgRoot" ]; then
|
|
15
|
+
pkgRoot="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ -z "$webAppName" ]; then
|
|
19
|
+
echo -e "${ERROR_ICON} 缺少前端应用目录名:请传入第 1 个参数或设置 WEB_APP_NAME" >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
filepath="${pkgRoot}/${webAppName}/${configBase}.js"
|
|
24
|
+
echo -e "${INFO_ICON} 文件路径:${filepath}"
|
|
25
|
+
|
|
26
|
+
if [ ! -f "$filepath" ]; then
|
|
27
|
+
echo -e "${ERROR_ICON} 文件不存在: ${filepath}" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# 已混淆过则跳过,避免重复包裹
|
|
32
|
+
if grep -q '__WINNER_BASH_OBFUSCATED__' "$filepath" 2>/dev/null; then
|
|
33
|
+
echo -e "${CHECK_ICON} 配置文件已混淆,跳过"
|
|
34
|
+
exit 0
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
b64=$(base64 < "$filepath" | tr -d '\n\r')
|
|
38
|
+
if [ -z "$b64" ]; then
|
|
39
|
+
echo -e "${ERROR_ICON} base64 编码失败" >&2
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
tmpfile="${filepath}.obf.$$"
|
|
44
|
+
cat > "$tmpfile" <<EOF
|
|
45
|
+
/* __WINNER_BASH_OBFUSCATED__ */
|
|
46
|
+
(function(_0x){eval(atob(_0x))})('${b64}');
|
|
47
|
+
EOF
|
|
48
|
+
|
|
49
|
+
if [ $? -ne 0 ]; then
|
|
50
|
+
rm -f "$tmpfile"
|
|
51
|
+
echo -e "${ERROR_ICON} 写入临时文件失败" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
mv "$tmpfile" "$filepath"
|
|
56
|
+
echo -e "${CHECK_ICON} bash 轻量混淆完成"
|
|
57
|
+
echo -e "${INFO_ICON} 更新路径:${filepath}"
|
|
58
|
+
exit 0
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
1. scripts/js/confuse.js
|
|
2
|
-
用 path.join(pkgRoot, webAppName, configBase + '.js')
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
缺 webAppName、文件不存在或混淆失败时 process.exit(1),便于 afterInstall.sh 判断。
|
|
2
|
+
用 path.join(pkgRoot, webAppName, configBase + '.js') 定位配置文件。
|
|
3
|
+
参数:argv[1]=webAppName;argv[2]=配置名(不含 .js,默认 sysconfig);argv[3]=发布包根目录。
|
|
4
|
+
依赖 node + javascript-obfuscator(obfuscator.js),强混淆。
|
|
6
5
|
|
|
7
|
-
2. scripts/
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
2. scripts/js/confuse.sh
|
|
7
|
+
无 node 时的 bash 兜底:整文件 base64 + `(function(_0x){eval(atob(_0x))})('...')` 包裹。
|
|
8
|
+
参数与 confuse.js 相同。强度远弱于 confuse.js,仅兼容无 node 环境。
|
|
9
|
+
已带 `__WINNER_BASH_OBFUSCATED__` 标记时会跳过,避免重复包裹。
|
|
10
10
|
|
|
11
|
-
3.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
3. scripts/afterInstall.sh
|
|
12
|
+
`enableObfuscation` 为真时:有 node 走 confuse.js,否则走 confuse.sh。
|
|
13
|
+
调用前先 `pkg_root=\`pwd\``,再 `cd` 到脚本目录,执行 `./js/confuse.*`。
|
|
14
|
+
|
|
15
|
+
4. genWebPackage.ts
|
|
16
|
+
`enableObfuscation === true` 时拷贝 `templates/see/{bash|python}/scripts/js` 到 `tmp/scripts/{name}/js`。
|
|
@@ -35,8 +35,21 @@ chmodPkg()
|
|
|
35
35
|
<% if (enableObfuscation) { %>
|
|
36
36
|
import subprocess
|
|
37
37
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
confuse_js = os.path.normpath(os.path.join(script_dir, 'js', 'confuse.js'))
|
|
39
|
+
confuse_sh = os.path.normpath(os.path.join(script_dir, 'js', 'confuse.sh'))
|
|
40
|
+
config_name = '{{configFileName}}'
|
|
41
|
+
|
|
42
|
+
def which(cmd):
|
|
43
|
+
for p in os.environ.get('PATH', '').split(os.pathsep):
|
|
44
|
+
f = os.path.join(p, cmd)
|
|
45
|
+
if os.path.isfile(f) and os.access(f, os.X_OK):
|
|
46
|
+
return f
|
|
47
|
+
return None
|
|
48
|
+
|
|
49
|
+
if which('node'):
|
|
50
|
+
cmd = ['node', confuse_js, webAppName, config_name, pkg_root]
|
|
51
|
+
else:
|
|
52
|
+
cmd = ['bash', confuse_sh, webAppName, config_name, pkg_root]
|
|
40
53
|
ret = subprocess.call(cmd)
|
|
41
54
|
if ret != 0:
|
|
42
55
|
sys.stderr.write("错误: 混淆配置文件失败。\n")
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# 无 node 时的轻量混淆:整文件 base64 + atob/eval 包裹。
|
|
3
|
+
# 强度远低于 confuse.js(javascript-obfuscator),仅作兼容兜底。
|
|
4
|
+
# 参数:webAppName configBase [pkgRoot]
|
|
5
|
+
|
|
6
|
+
ERROR_ICON="❌"
|
|
7
|
+
INFO_ICON="ℹ️"
|
|
8
|
+
CHECK_ICON="✅"
|
|
9
|
+
|
|
10
|
+
webAppName="${1:-${WEB_APP_NAME}}"
|
|
11
|
+
configBase="${2:-${CONFIG_FILE_NAME:-sysconfig}}"
|
|
12
|
+
pkgRoot="${3:-}"
|
|
13
|
+
|
|
14
|
+
if [ -z "$pkgRoot" ]; then
|
|
15
|
+
pkgRoot="$(cd "$(dirname "$0")/../.." && pwd)"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ -z "$webAppName" ]; then
|
|
19
|
+
echo -e "${ERROR_ICON} 缺少前端应用目录名:请传入第 1 个参数或设置 WEB_APP_NAME" >&2
|
|
20
|
+
exit 1
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
filepath="${pkgRoot}/${webAppName}/${configBase}.js"
|
|
24
|
+
echo -e "${INFO_ICON} 文件路径:${filepath}"
|
|
25
|
+
|
|
26
|
+
if [ ! -f "$filepath" ]; then
|
|
27
|
+
echo -e "${ERROR_ICON} 文件不存在: ${filepath}" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# 已混淆过则跳过,避免重复包裹
|
|
32
|
+
if grep -q '__WINNER_BASH_OBFUSCATED__' "$filepath" 2>/dev/null; then
|
|
33
|
+
echo -e "${CHECK_ICON} 配置文件已混淆,跳过"
|
|
34
|
+
exit 0
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
b64=$(base64 < "$filepath" | tr -d '\n\r')
|
|
38
|
+
if [ -z "$b64" ]; then
|
|
39
|
+
echo -e "${ERROR_ICON} base64 编码失败" >&2
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
tmpfile="${filepath}.obf.$$"
|
|
44
|
+
cat > "$tmpfile" <<EOF
|
|
45
|
+
/* __WINNER_BASH_OBFUSCATED__ */
|
|
46
|
+
(function(_0x){eval(atob(_0x))})('${b64}');
|
|
47
|
+
EOF
|
|
48
|
+
|
|
49
|
+
if [ $? -ne 0 ]; then
|
|
50
|
+
rm -f "$tmpfile"
|
|
51
|
+
echo -e "${ERROR_ICON} 写入临时文件失败" >&2
|
|
52
|
+
exit 1
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
mv "$tmpfile" "$filepath"
|
|
56
|
+
echo -e "${CHECK_ICON} bash 轻量混淆完成"
|
|
57
|
+
echo -e "${INFO_ICON} 更新路径:${filepath}"
|
|
58
|
+
exit 0
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
1. scripts/js/confuse.js
|
|
2
|
-
用 path.join(pkgRoot, webAppName, configBase + '.js')
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
缺 webAppName、文件不存在或混淆失败时 process.exit(1),便于 afterInstall.sh 判断。
|
|
2
|
+
用 path.join(pkgRoot, webAppName, configBase + '.js') 定位配置文件。
|
|
3
|
+
参数:argv[1]=webAppName;argv[2]=配置名(不含 .js,默认 sysconfig);argv[3]=发布包根目录。
|
|
4
|
+
依赖 node + javascript-obfuscator(obfuscator.js),强混淆。
|
|
6
5
|
|
|
7
|
-
2. scripts/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
2. scripts/js/confuse.sh
|
|
7
|
+
无 node 时的 bash 兜底:整文件 base64 + `(function(_0x){eval(atob(_0x))})('...')` 包裹。
|
|
8
|
+
参数与 confuse.js 相同。强度远弱于 confuse.js,仅兼容无 node 环境。
|
|
9
|
+
已带 `__WINNER_BASH_OBFUSCATED__` 标记时会跳过,避免重复包裹。
|
|
10
|
+
|
|
11
|
+
3. scripts/afterInstall.sh
|
|
12
|
+
`enableObfuscation` 为真时:有 node 走 confuse.js,否则走 confuse.sh。
|
|
13
|
+
调用前先 `pkg_root=\`pwd\``,再 `cd` 到脚本目录,执行 `./js/confuse.*`。
|
|
14
|
+
|
|
15
|
+
4. genWebPackage.ts
|
|
16
|
+
`enableObfuscation === true` 时拷贝 `templates/see/{bash|python}/scripts/js` 到 `tmp/scripts/{name}/js`。
|