@flun/node-mobile-app 2.1.1 → 2.1.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,7 @@
1
1
  # 变更日志
2
+ ## [2.1.2] - 2026-09-29 19:53
3
+ ### 更改
4
+ - 加固了拷贝文件的一些逻辑;
2
5
 
3
6
  ## [2.1.1] - 2026-09-29 13:55
4
7
  ### 优化
@@ -22,16 +25,4 @@
22
25
 
23
26
  - **`DEP0190` 弃用警告**:`src/utils.js` 中的 `run` / `runQuiet` / `runSilent` 原先统一用 `spawnSync(bin, args, { shell: true })`。Node 20+ 对「参数数组 + shell」这种组合会提示参数未转义(`DEP0190`),每次执行 CLI 都会在输出末尾出现该警告。现改为:
24
27
  - Windows:把命令与参数拼成单个字符串(参数按需加引号)后交给 shell——`.cmd` / `.bat` 仍能执行,且不再触发警告;
25
- - 其它平台:不使用 shell,参数交由 Node 转义。
26
- ## [2.0.8] - 2026-09-28 22:17
27
- ### 修复
28
-
29
- - **中文路径构建失败**:三处联动修复。
30
- - **AGP 拒绝非 ASCII 路径**:`template/android/gradle.properties` 增加 `android.overridePathCheck=true`,允许中文路径构建。
31
- - **`gradle.properties` 中文乱码**:该文件按 ISO-8859-1 读取,非 ASCII 字符(如路径中的「桌面」)会被读成乱码,导致 keystore 找不到。`patcher.js` 现在把写入的非 ASCII 字符转成 `\uXXXX` 转义(Java Properties 规范)。
32
- - 影响范围:项目路径含中文(或其它非 ASCII 字符)时,release 构建曾失败于 `Your project path contains non-ASCII characters` 与 `Keystore file ... not found`。
33
- - **签名配置缺项时报错含糊**:`android.signing.keystore` 已配置、但密码 / 别名 / 别名密码为空时,原先会一路跑到 Gradle 才报 `keystore password was incorrect`,容易误导排查方向。现在 `patcher.js` 在构建前即校验四项,缺项时抛出明确错误,并提示「仅本地测试可注释掉整个 signing 块」。
34
-
35
- ### 变更
36
-
37
- - **`mobileAppConfig.js` 模板**:`signing` 块内每项标注「必填」,并说明「取消整块注释即视为启用签名」。
28
+ - 其它平台:不使用 shell,参数交由 Node 转义。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flun/node-mobile-app",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "将 Node.js 项目一键打包为 Android / iOS 移动应用,运行时由 @flun/nodejs-mobile-react-native 提供,无需修改你的 Node 代码;",
5
5
  "author": "flun <open@flun.top>",
6
6
  "keywords": [
@@ -60,7 +60,7 @@
60
60
  "eslint-plugin-eslint-comments": "^3.2.0",
61
61
  "eslint-plugin-react-hooks": "^7.1.1",
62
62
  "@eslint-react/eslint-plugin": "^5.21.3",
63
- "@flun/nodejs-mobile-react-native": "^2.0.6"
63
+ "@flun/nodejs-mobile-react-native": "^2.0.7"
64
64
  },
65
65
  "allowScripts": {
66
66
  "node": true,
@@ -2,34 +2,33 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
4
 
5
- // 要复制的文件位置和文件目标位置
5
+ // 要复制的文件位置、目标目录和目标文件路径
6
6
  const __filename = fileURLToPath(import.meta.url), __dirname = path.dirname(__filename),
7
- initCwd = process.env.INIT_CWD, fileName = 'mobileAppConfig.js', targetDir = initCwd ? path.resolve(initCwd) : '',
8
- // 要拷贝的文件和目标文件路径
9
- sourceFile = path.join(__dirname, '..', fileName), targetFile = path.join(targetDir, fileName),
10
- /**
11
- * 复制文件到项目根目录
12
- * >查看定义:@see {@link copyFile}
13
- * @returns {boolean} - 复制是否成功
14
- */
15
- copyFile = () => {
16
- console.log(`🔍 检查 ${fileName} 文件...`), console.log(`📁 项目根目录:${targetDir}`);
17
- try {
18
- // 无 INIT_CWD(非用户项目安装场景)|| 目标目录不是 Node 项目 || 包自身的 npm install(开发调试)→ 跳过
19
- if (!targetDir) return true;
20
- if (!fs.existsSync(path.join(targetDir, 'package.json'))) return true;
21
- if (targetDir === path.resolve(__dirname, '..')) return true;
22
- if (fs.existsSync(targetFile)) return true; // 目标文件已存在 → 直接返回
23
- console.log(`⚠️ 在项目根目录未找到 ${fileName} 文件,正在创建...`);
7
+ fileName = 'mobileAppConfig.js', sourceFile = path.join(__dirname, '..', fileName),
8
+ targetDir = path.resolve(process.env.INIT_CWD || process.cwd()), targetFile = path.join(targetDir, fileName);
24
9
 
25
- fs.copyFileSync(sourceFile, targetFile); // 复制源文件到项目根目录
26
- console.log(`✓ 已创建 ${fileName} 示例文件:${targetFile}`);
27
- return true;
28
- } catch (error) {
29
- console.error(`✗ 创建 ${fileName} 文件失败:`, error.message);
30
- return false;
31
- }
10
+ /**
11
+ * 复制文件到项目根目录
12
+ * >查看定义:@see {@link copyFile}
13
+ * @returns {boolean} - 复制是否成功
14
+ */
15
+ const copyFile = () => {
16
+ console.log(`🔍 检查 ${fileName} 文件...`), console.log(`📁 项目根目录:${targetDir}`);
17
+ try {
18
+ // 目标目录不是 Node 项目 || 包自身的 npm install(开发调试)→ 跳过
19
+ if (!fs.existsSync(path.join(targetDir, 'package.json'))) return true;
20
+ if (targetDir === path.resolve(__dirname, '..')) return true;
21
+ if (fs.existsSync(targetFile)) return true; // 目标文件已存在 → 直接返回
22
+ console.log(`⚠️ 在项目根目录未找到 ${fileName} 文件,正在创建...`);
23
+
24
+ fs.copyFileSync(sourceFile, targetFile); // 复制源文件到项目根目录
25
+ console.log(`✓ 已创建 ${fileName} 示例文件:${targetFile}`);
26
+ return true;
27
+ } catch (error) {
28
+ console.error(`✗ 创建 ${fileName} 文件失败:`, error.message);
29
+ return false;
32
30
  }
31
+ };
33
32
 
34
33
  // 执行脚本并导出函数
35
34
  if (process.argv[1] === __filename) copyFile();