@flun/node-mobile-app 2.0.1 → 2.0.2

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/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
  # Changelog
2
+ ## [2.0.2] - 2026-09-23 20:25
3
+
4
+ ### 修复
5
+
6
+ - **`syncTemplateDependencies` 计数不准确**:`src/copy.js` 里 `_comment` 字段的移除被一并计入 `updated`,导致日志里打印的"已同步 N 个依赖版本"比实际多 1。拆分为 `depsUpdated`(仅统计真正变化的依赖)和 `needWrite`(是否需要写文件),`_comment` 仍会被移除,但不再计入。
7
+
8
+ ---
9
+
2
10
  ## [2.0.1] - 2026-09-23 19:53
3
11
  ### 更新
4
12
  - 升级了有bug的 `@flun/nodejs-mobile-react-native` v1.0.1版本到v1.0.3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flun/node-mobile-app",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "将 Node.js 项目一键打包为 Android / iOS 移动应用,运行时由 @flun/nodejs-mobile-react-native 提供,无需修改你的 Node 代码;",
5
5
  "author": "flun <open@flun.top>",
6
6
  "keywords": [
package/src/copy.js CHANGED
@@ -73,25 +73,29 @@ const BUILD_DIR_NAME = 'node-mobile-app-build',
73
73
 
74
74
  const mainDeps = mainPkg.dependencies || {};
75
75
  const missing = [];
76
- let updated = 0;
76
+ let depsUpdated = 0;
77
+ let needWrite = false;
77
78
 
78
79
  // 移除仅用于模板占位说明的 _comment 字段,避免带进最终 build 工程
79
80
  if ('_comment' in buildPkg) {
80
81
  delete buildPkg._comment;
81
- updated++;
82
+ needWrite = true;
82
83
  }
83
84
  for (const name of Object.keys(buildPkg.dependencies)) {
84
85
  const v = mainDeps[name];
85
86
  if (!v) { missing.push(name); continue; }
86
87
  if (buildPkg.dependencies[name] !== v) {
87
88
  buildPkg.dependencies[name] = v;
88
- updated++;
89
+ depsUpdated++;
90
+ needWrite = true;
89
91
  }
90
92
  }
91
93
 
92
- if (updated > 0) {
94
+ if (needWrite) {
93
95
  writeIfChanged(buildPkgPath, JSON.stringify(buildPkg, null, 2) + '\n');
94
- console.log(' ✓ 已同步 ' + updated + ' 个依赖版本到 ' + BUILD_DIR_NAME + '/package.json');
96
+ if (depsUpdated > 0) {
97
+ console.log(' ✓ 已同步 ' + depsUpdated + ' 个依赖版本到 ' + BUILD_DIR_NAME + '/package.json');
98
+ }
95
99
  }
96
100
 
97
101
  if (missing.length > 0) {