fe-build-cli 1.2.4 → 1.2.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +9 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fe-build-cli",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "前端项目打包部署 CLI 工具,支持多服务器部署、分支管理、回滚、钉钉通知、智能处理本地改动等功能",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/cli.js CHANGED
@@ -268,20 +268,23 @@ async function deployCommand(config) {
268
268
  }
269
269
  }
270
270
 
271
- // 确定发布模式(根据部署环境自动选择)
272
- let deployMode = config.deployMode || 'main'; // 默认主分支发布
271
+ // 确定发布模式
272
+ // 优先级:命令行参数 > 配置文件 deployMode > 自动识别
273
+ let deployMode = 'main'; // 默认值
273
274
 
274
- // 命令行参数优先
275
+ // 1. 命令行参数优先
275
276
  if (useTestBranch) {
276
277
  deployMode = 'test';
277
278
  } else if (useCurrentBranch) {
278
279
  deployMode = 'current';
279
280
  } else if (useMainBranch) {
280
281
  deployMode = 'main';
282
+ } else if (config.deployMode) {
283
+ // 2. 使用配置文件的 deployMode
284
+ deployMode = config.deployMode;
285
+ console.log(`\n📌 使用配置文件发布模式: ${deployMode}`);
281
286
  } else {
282
- // 自动根据部署环境选择发布模式
283
- // test 环境 → test 发布模式
284
- // production 环境 → main 发布模式
287
+ // 3. 自动根据部署环境选择发布模式(仅当配置文件未设置时)
285
288
  const targetEnv = selectedServers[0];
286
289
  if (targetEnv === 'test') {
287
290
  deployMode = 'test';