@winner-fed/winner-deploy 4.3.7 → 4.3.9

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 CHANGED
@@ -9,10 +9,11 @@
9
9
  ## 特性
10
10
 
11
11
  - 🚀 支持外框架(bizframe)和子系统(subsystem)两种应用类型
12
- - 📦 自动生成 SEE 平台所需的 manifest.json 和 deploy.xml 配置文件
13
- - 🐳 支持 Docker 容器化部署
14
- - 🔧 灵活的模板变量配置系统
12
+ - 📦 自动生成 SEE 平台所需的 deploy.xml 与 template 配置文件
13
+ - 🐳 支持 Docker 容器化部署(`seePackageType: 'docker'`)
14
+ - 🔧 灵活的模板变量配置系统(`variablesFunc` / `tplPath`)
15
15
  - 📝 支持 Python 和 Bash 两种脚本类型
16
+ - 🔒 可选的安装后配置 JS 混淆(`enableObfuscation`):有 node 走强混淆,无 node 回退 bash 轻量混淆
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
- generateSeePackageZip({
37
- name: 'my-app',
38
- version: '1.0.0',
39
- description: '我的应用'
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
- copyFiles: ['version.js', 'logo.png'],
62
- templateFunc: () => {
63
- return './dist/config.local.js';
64
- },
65
- variablesFunc: () => {
66
- return [
67
- {
68
- type: 'input',
69
- label: '应用标题',
70
- name: 'APP_TITLE',
71
- default: '默认标题'
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
- (err, result) => {
77
- if (err) {
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 | string | 'winner-front' | 否 | 系统类型,SEE 平台的分组维度 |
97
- | type | string | 'subsystem' | 否 | 应用类型:'bizframe'(外框架)或 'subsystem'(子系统) |
98
- | name | string | - | 是 | 发布物名称 |
99
- | appType | string | name 的值 | 否 | 发布物类型 |
100
- | version | string | - | 是 | 发布包版本 |
101
- | group | string | 'bizframe' | 否 | 应用分组 |
102
- | configName | string | 'config.local' | 否 | 配置文件名称(不含 .js 后缀) |
103
- | outputName | string | 'dist' | 否 | 输出目录名称 |
104
- | description | string | - | 否 | 发布包说明 |
105
- | seePackageName | string | `${system}-${name}-${version}` | 否 | SEE 发布物的包名(zip 文件名) |
106
- | seePackageType | string | 'web' | 否 | SEE 平台发布物包类型:'web' 或 'docker' |
107
- | dockerImage | string | - | 否 | Docker 容器化镜像名(seePackageType 为 'docker' 时生效) |
108
- | scriptsType | string | 'python' | 否 | 脚本类型:'python' 或 'bash' |
109
- | copyFiles | Array<string> | [] | 否 | 需要直接拷贝到 SEE 包的文件列表 |
110
- | templateFunc | function | - | 否 | 自定义变量配置文件生成函数 |
111
- | variablesFunc | function | - | 否 | deploy.xml 模板变量配置函数 |
112
-
113
- #### templateFunc 函数
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/`,并在 `afterInstall` 中对已注入变量后的配置 JS 做混淆:有 `node` 用 `confuse.js`(javascript-obfuscator 强混淆),无 `node` 用 `confuse.sh`(base64 + `TextDecoder`/`new Function` 轻量包裹,UTF-8 安全,强度较弱);为 `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
- templateFunc: function() {
119
- if (type === 'bizframe') {
120
- return `./dist/config.local.js`;
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
- 用于配置 deploy.xml 模板变量,支持动态配置。
131
+ 未传入时尝试加载项目根目录下 `build/package/variables.js` 的 `variables` 字段;加载失败则返回 `[]`(与 `type` 无关)。
129
132
 
130
133
  ```javascript
131
- variablesFunc: function() {
132
- const context = process.cwd();
133
- if (type === 'bizframe') {
134
- try {
135
- const { variables } = require(path.resolve(
136
- context,
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
- return [];
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
- #### copyFiles 配置
153
+ - 除 `deploy.xml` 外,其余文件复制到包内 `template/` 目录。
154
+ - 提供 `sysconfig.js` 或 `config.local.js` 时,不再根据 `templateFunc` 生成同名配置。
155
+
156
+ #### copyFiles 说明
152
157
 
153
- 指定需要直接拷贝到 SEE 包中但不包含在 manifest.json 配置中的文件。
158
+ 适用于 manifest 未收录、但需要打进 SEE 包的文件:
154
159
 
155
160
  ```javascript
156
- copyFiles: [
157
- 'version.js', // 项目根目录下的 version.js
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
- function callback(error, result) {
167
- if (error) {
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 平台支持多种类型的模板变量控件,用于在部署时动态配置应用参数。详细的模板变量配置说明请参考 [TYPE.md](./TYPE.md)。
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,133 @@ 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
- tooltip: '选择部署环境',
210
- name: 'ENVIRONMENT',
211
- default: 'dev'
209
+ name: 'ENVIRONMENT'
212
210
  },
213
211
  {
214
212
  type: 'switch',
215
213
  label: '启用调试',
216
- tooltip: '是否启用调试模式',
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
- 生成的 SEE 部署包包含以下文件:
221
+ 默认输出路径:`{seePackagePath}/{seePackageName}.zip`(例如 `package/winner-front-my-app-1.0.0.zip`)。
241
222
 
242
223
  ```
243
224
  see-package.zip
244
- ├── manifest.json # 应用清单文件
245
- ├── deploy.xml # 部署配置文件
246
- ├── install.py/.sh # 安装脚本
247
- ├── uninstall.py/.sh # 卸载脚本
248
- ├── start.py/.sh # 启动脚本
249
- ├── stop.py/.sh # 停止脚本
250
- ├── config.local.js # 配置文件(如果存在)
251
- └── dist/ # 应用文件目录
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 # node 强混淆入口
238
+ │ ├── confuse.sh # 无 node 时的 bash 轻量混淆
239
+ │ └── obfuscator.js # javascript-obfuscator 运行时
240
+ └── source/ # 安装脚本从 tmp/source 部署到 workspace
252
241
  └── ...
253
242
  ```
254
243
 
244
+ `scriptsType === 'python'` 且存在 `manifest.{timestamp}.json` 时,按 manifest 拷贝文件到 `source/`;否则将整个 `outputName` 目录拷贝到 `source/`。`scriptsType === 'bash'` 时始终拷贝整个 `outputName` 到 `source/`。
245
+
255
246
  ## 使用场景
256
247
 
257
248
  ### 1. 外框架应用(bizframe)
258
249
 
259
- 适用于作为主框架的运行的子应用。
260
-
261
250
  ```javascript
262
- generateSeePackageZip({
263
- type: 'bizframe',
264
- name: 'main-frame',
265
- version: '1.0.0',
266
- description: '主框架应用'
267
- });
251
+ generateSeePackageZip(
252
+ {
253
+ type: 'bizframe',
254
+ name: 'main-frame',
255
+ version: '1.0.0',
256
+ description: '主框架应用'
257
+ },
258
+ () => {}
259
+ );
268
260
  ```
269
261
 
270
262
  ### 2. 子系统应用(subsystem)
271
263
 
272
- 适用于业务子系统,通常作为微前端模块。
264
+ ```javascript
265
+ generateSeePackageZip(
266
+ {
267
+ type: 'subsystem',
268
+ name: 'user-management',
269
+ version: '1.0.0',
270
+ description: '用户管理子系统'
271
+ },
272
+ () => {}
273
+ );
274
+ ```
275
+
276
+ 子系统安装目录需指向具体前端根目录(如 `/home/hsiar/hsiar-green/html/`),详见控制台完成提示。
277
+
278
+ ### 3. 开启配置 JS 混淆
279
+
280
+ 混淆必须在 SEE 注入配置变量之后执行,因此放在 `afterInstall`,不能提前到打包阶段。
273
281
 
274
282
  ```javascript
275
- generateSeePackageZip({
276
- type: 'subsystem',
277
- name: 'user-management',
278
- version: '1.0.0',
279
- description: '用户管理子系统'
280
- });
283
+ generateSeePackageZip(
284
+ {
285
+ name: 'my-app',
286
+ version: '1.0.0',
287
+ scriptsType: 'bash',
288
+ enableObfuscation: true,
289
+ description: '开启 afterInstall 混淆'
290
+ },
291
+ () => {}
292
+ );
281
293
  ```
282
294
 
283
- ### 3. Docker 容器化部署
295
+ 运行时策略(bash / python 脚本一致):
296
+
297
+ 1. 检测到 `node` → 执行 `confuse.js`(AST 级强混淆)
298
+ 2. 未检测到 `node` → 执行 `confuse.sh`(整文件 base64 + `TextDecoder`/`new Function` 包裹,UTF-8 安全)
299
+ 3. 文件已含 `__WINNER_BASH_OBFUSCATED__` 标记时,`confuse.sh` 会跳过,避免重复包裹
300
+
301
+ `confuse.sh` 仅作无 node 环境的兼容兜底,防护强度远低于 `confuse.js`。
284
302
 
285
- 支持生成容器化部署的 SEE 包。
303
+ ### 4. Docker 容器化部署
286
304
 
287
305
  ```javascript
288
- generateSeePackageZip({
289
- name: 'my-app',
290
- version: '1.0.0',
291
- seePackageType: 'docker',
292
- dockerImage: 'my-app:1.0.0',
293
- description: '容器化应用'
294
- });
306
+ generateSeePackageZip(
307
+ {
308
+ name: 'my-app',
309
+ version: '1.0.0',
310
+ seePackageType: 'docker',
311
+ dockerImage: 'my-app:1.0.0',
312
+ description: '容器化应用'
313
+ },
314
+ () => {}
315
+ );
295
316
  ```
296
317
 
297
318
  ## 注意事项
298
319
 
299
- 1. **文件路径**: `copyFiles` 中的文件路径是相对于项目根目录的
300
- 2. **配置文件**: 配置文件名不需要包含 `.js` 后缀
301
- 3. **版本号**: 建议使用语义化版本号格式
302
- 4. **Docker 镜像**: 使用 Docker 部署时需要确保镜像已构建并推送到镜像仓库
303
- 5. **脚本类型**: Python 脚本需要目标环境支持 Python 运行时
320
+ 1. **copyFiles**:源文件路径为 `` `${outputName}/${name}/文件名` ``,不是项目根目录直写路径。
321
+ 2. **configName**:除手动指定外,会根据 `outputName` 下是否存在 `config.local.js` / `sysconfig.js` 自动选用文件名。
322
+ 3. **name 特殊字符**:`@`、`/` 会在打包前替换为 `-`。
323
+ 4. **Docker**:使用 Docker 部署时需确保镜像已构建并可被 SEE 环境拉取。
324
+ 5. **混淆**:`enableObfuscation: true` 时打包 `scripts/{name}/js/`;`afterInstall` 优先用 `node`+`confuse.js`,无 `node` 时回退 `bash`+`confuse.sh`。纯 bash 无法复现 javascript-obfuscator 级别的混淆。
325
+ 6. **Python 脚本**:目标环境需具备 Python 运行时;开启混淆时建议有 `node`,否则走 bash 轻量混淆(仍需系统有 `bash` / `base64`)。
304
326
 
305
327
  ## 更新日志
306
328
 
307
- 详细的更新日志请查看 [CHANGELOG.md](./CHANGELOG.md)。
329
+ 详见 [CHANGELOG.md](./CHANGELOG.md)。
308
330
 
309
331
  ## 许可证
310
332
 
@@ -312,4 +334,4 @@ MIT License
312
334
 
313
335
  ## 贡献
314
336
 
315
- 欢迎提交 Issue 和 Pull Request 来改进这个项目。
337
+ 欢迎提交 Issue 和 Pull Request。
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /** build time: Wed Apr 15 2026 10:38:51 GMT+0800 (中国标准时间), build version 4.3.7 **/
1
+ /** build time: Thu Jul 30 2026 11:03:48 GMT+0800 (中国标准时间), build version 4.3.9 **/
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={"&quot;":'"',"&apos;":"'","&lt;":"<","&gt;":">"},i=/(&quot;)|(&apos;)|(&lt;)|(&gt;)/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
@@ -137,7 +137,7 @@ interface DeployOptions {
137
137
  scriptsType?: 'python' | 'bash';
138
138
  /**
139
139
  * 是否在安装后对 template 中的配置 .js 做混淆;为 false 时不拷贝 scripts/js,afterInstall 不执行 node 混淆
140
- * @default true
140
+ * @default false
141
141
  */
142
142
  enableObfuscation?: boolean;
143
143
  /**
package/dist/index.d.ts CHANGED
@@ -137,7 +137,7 @@ interface DeployOptions {
137
137
  scriptsType?: 'python' | 'bash';
138
138
  /**
139
139
  * 是否在安装后对 template 中的配置 .js 做混淆;为 false 时不拷贝 scripts/js,afterInstall 不执行 node 混淆
140
- * @default true
140
+ * @default false
141
141
  */
142
142
  enableObfuscation?: boolean;
143
143
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** build time: Wed Apr 15 2026 10:38:51 GMT+0800 (中国标准时间), build version 4.3.7 **/
1
+ /** build time: Thu Jul 30 2026 11:03:48 GMT+0800 (中国标准时间), build version 4.3.9 **/
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={"&quot;":'"',"&apos;":"'","&lt;":"<","&gt;":">"},r=/(&quot;)|(&apos;)|(&lt;)|(&gt;)/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.7",
3
+ "version": "4.3.9",
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
- # 混淆配置文件(第 1 参数为 SEE 变量 webAppName,第 2 参数为打包时写入的配置文件名不含 .js)
32
+ # 混淆配置文件:优先 node(javascript-obfuscator),无 node 时回退 bash 轻量混淆
33
33
  echo -e "${CHECK_ICON} 开始混淆配置文件..."
34
34
  pkg_root=`pwd`
35
35
  cd "$(dirname "$0")"
36
- node ./js/confuse.js "${webAppName}" "{{configFileName}}" "$pkg_root"
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,60 @@
1
+ #!/bin/bash
2
+ # 无 node 时的轻量混淆:整文件 base64 + TextDecoder/new Function 包裹。
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
+ # 可移植:避免 GNU 专用的 base64 -w 0
38
+ b64=$(base64 < "$filepath" | tr -d '\n\r')
39
+ if [ -z "$b64" ]; then
40
+ echo -e "${ERROR_ICON} base64 编码失败" >&2
41
+ exit 1
42
+ fi
43
+
44
+ tmpfile="${filepath}.obf.$$"
45
+ # UTF-8 安全:atob → Uint8Array → TextDecoder,再 new Function 执行
46
+ cat > "$tmpfile" <<EOF
47
+ /* __WINNER_BASH_OBFUSCATED__ */
48
+ (new Function(new TextDecoder("utf-8").decode(Uint8Array.from(atob("${b64}"),function(c){return c.charCodeAt(0)}))))();
49
+ EOF
50
+
51
+ if [ $? -ne 0 ]; then
52
+ rm -f "$tmpfile"
53
+ echo -e "${ERROR_ICON} 写入临时文件失败" >&2
54
+ exit 1
55
+ fi
56
+
57
+ mv "$tmpfile" "$filepath"
58
+ echo -e "${CHECK_ICON} bash 轻量混淆完成"
59
+ echo -e "${INFO_ICON} 更新路径:${filepath}"
60
+ exit 0
@@ -1,16 +1,16 @@
1
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 判断。
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/afterInstall.sh
8
- 在安装前用 pkg_root=\pwd`记下发布包根目录(与检查${webAppName}` 时一致)。
9
- cd 到脚本目录后执行:node ../js/confuse.js "${webAppName}" "{{configFileName}}" "$pkg_root"(原先 ./scripts/js/ 在 scripts/<name>/ 下会指错路径,已改为 ../js/)。
6
+ 2. scripts/js/confuse.sh
7
+ 无 node 时的 bash 兜底:整文件 base64 + `(new Function(new TextDecoder("utf-8").decode(Uint8Array.from(atob("..."), ...))))()` 包裹(UTF-8 安全)。
8
+ 参数与 confuse.js 相同。强度远弱于 confuse.js,仅兼容无 node 环境。
9
+ `base64 | tr -d` 保证 Linux/macOS 可移植;已带 `__WINNER_BASH_OBFUSCATED__` 时跳过。
10
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 一致。
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
- index_js = os.path.normpath(os.path.join(script_dir, '.', 'js', 'confuse.js'))
39
- cmd = ['node', index_js, webAppName, '{{configFileName}}', pkg_root]
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,60 @@
1
+ #!/bin/bash
2
+ # 无 node 时的轻量混淆:整文件 base64 + TextDecoder/new Function 包裹。
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
+ # 可移植:避免 GNU 专用的 base64 -w 0
38
+ b64=$(base64 < "$filepath" | tr -d '\n\r')
39
+ if [ -z "$b64" ]; then
40
+ echo -e "${ERROR_ICON} base64 编码失败" >&2
41
+ exit 1
42
+ fi
43
+
44
+ tmpfile="${filepath}.obf.$$"
45
+ # UTF-8 安全:atob → Uint8Array → TextDecoder,再 new Function 执行
46
+ cat > "$tmpfile" <<EOF
47
+ /* __WINNER_BASH_OBFUSCATED__ */
48
+ (new Function(new TextDecoder("utf-8").decode(Uint8Array.from(atob("${b64}"),function(c){return c.charCodeAt(0)}))))();
49
+ EOF
50
+
51
+ if [ $? -ne 0 ]; then
52
+ rm -f "$tmpfile"
53
+ echo -e "${ERROR_ICON} 写入临时文件失败" >&2
54
+ exit 1
55
+ fi
56
+
57
+ mv "$tmpfile" "$filepath"
58
+ echo -e "${CHECK_ICON} bash 轻量混淆完成"
59
+ echo -e "${INFO_ICON} 更新路径:${filepath}"
60
+ exit 0
@@ -1,16 +1,16 @@
1
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 判断。
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/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 一致。
6
+ 2. scripts/js/confuse.sh
7
+ 无 node 时的 bash 兜底:整文件 base64 + `(new Function(new TextDecoder("utf-8").decode(Uint8Array.from(atob("..."), ...))))()` 包裹(UTF-8 安全)。
8
+ 参数与 confuse.js 相同。强度远弱于 confuse.js,仅兼容无 node 环境。
9
+ `base64 | tr -d` 保证 Linux/macOS 可移植;已带 `__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`。