@flun/node-mobile-app 2.0.8 → 2.1.0
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 +20 -0
- package/package.json +4 -6
- package/src/utils.js +28 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# 变更日志
|
|
2
2
|
|
|
3
|
+
## [2.1.0] - 2026-09-29 10:39
|
|
4
|
+
|
|
5
|
+
### 变更
|
|
6
|
+
|
|
7
|
+
- **ESLint 插件换代**:`@babel/eslint-parser`、`eslint-plugin-react`、`eslint-plugin-react-native` 三个包的最新版均不支持 ESLint 10(分别止步于 9.0.0 / 9.7 / 9),导致安装 `eslint@10` 时被额外拉入一份 `eslint@9.39.5`(npm 的 peer 兼容回退),并触发 npm 的 deprecated 警告。现替换为:
|
|
8
|
+
|
|
9
|
+
| 原 | 新 |
|
|
10
|
+
| ---------------------------------------------------- | --------------------------------------------------- |
|
|
11
|
+
| `@babel/eslint-parser` | `@typescript-eslint/parser`(已支持 ESLint 10) |
|
|
12
|
+
| `eslint-plugin-react` + `eslint-plugin-react-native` | `@eslint-react/eslint-plugin`(原生支持 ESLint 10) |
|
|
13
|
+
|
|
14
|
+
生成的 `eslint.config.js` 随之更新。`eslint-plugin-react-hooks` 保留(其 7.1.x 已支持 ESLint 10)。
|
|
15
|
+
|
|
16
|
+
> **注意**:lint 规则集与原先不同,升级后对同一份代码可能报出不同的检查结果。这只影响静态检查,不影响构建产物与运行。
|
|
17
|
+
|
|
18
|
+
### 修复
|
|
19
|
+
|
|
20
|
+
- **`DEP0190` 弃用警告**:`src/utils.js` 中的 `run` / `runQuiet` / `runSilent` 原先统一用 `spawnSync(bin, args, { shell: true })`。Node 20+ 对「参数数组 + shell」这种组合会提示参数未转义(`DEP0190`),每次执行 CLI 都会在输出末尾出现该警告。现改为:
|
|
21
|
+
- Windows:把命令与参数拼成单个字符串(参数按需加引号)后交给 shell——`.cmd` / `.bat` 仍能执行,且不再触发警告;
|
|
22
|
+
- 其它平台:不使用 shell,参数交由 Node 转义。
|
|
3
23
|
## [2.0.8] - 2026-09-28 22:17
|
|
4
24
|
### 修复
|
|
5
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flun/node-mobile-app",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "将 Node.js 项目一键打包为 Android / iOS 移动应用,运行时由 @flun/nodejs-mobile-react-native 提供,无需修改你的 Node 代码;",
|
|
5
5
|
"author": "flun <open@flun.top>",
|
|
6
6
|
"keywords": [
|
|
@@ -54,14 +54,12 @@
|
|
|
54
54
|
"prettier": "^3.9.8",
|
|
55
55
|
"eslint": "^10.11.0",
|
|
56
56
|
"@eslint/js": "^10.0.1",
|
|
57
|
-
"@
|
|
58
|
-
"@typescript-eslint/
|
|
59
|
-
"@typescript-eslint/parser": "^8.70.1",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^8.71.0",
|
|
58
|
+
"@typescript-eslint/parser": "^8.71.0",
|
|
60
59
|
"eslint-config-prettier": "^10.1.8",
|
|
61
60
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
62
|
-
"eslint-plugin-react": "^7.37.5",
|
|
63
61
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
64
|
-
"eslint-
|
|
62
|
+
"@eslint-react/eslint-plugin": "^5.21.3",
|
|
65
63
|
"@flun/nodejs-mobile-react-native": "^2.0.6"
|
|
66
64
|
},
|
|
67
65
|
"allowScripts": {
|
package/src/utils.js
CHANGED
|
@@ -61,14 +61,33 @@ const ensureDir = dir => {
|
|
|
61
61
|
fs.copyFileSync(src, dst);
|
|
62
62
|
return true;
|
|
63
63
|
},
|
|
64
|
+
// 把单个参数转成适合 Windows cmd.exe 的形式:含空白或 shell 元字符时加双引号。
|
|
65
|
+
quoteShellArg = (s) => {
|
|
66
|
+
const str = String(s);
|
|
67
|
+
if (str === '') return '""';
|
|
68
|
+
return /[\s"&|<>^()]/.test(str) ? '"' + str.replace(/"/g, '""') + '"' : str;
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* 统一的子进程启动:
|
|
72
|
+
* - Windows:.cmd / .bat 需经 shell;把命令与参数拼成单字符串,
|
|
73
|
+
* 避免 spawnSync(bin, args, { shell: true }) 触发 DEP0190。
|
|
74
|
+
* - 其它平台:不用 shell,参数交由 Node 转义。
|
|
75
|
+
*/
|
|
76
|
+
spawnCmd = (bin, args, baseOpts = {}) => {
|
|
77
|
+
if (process.platform === 'win32') {
|
|
78
|
+
const cmd = [bin, ...args].map(quoteShellArg).join(' ');
|
|
79
|
+
return spawnSync(cmd, { ...baseOpts, shell: true });
|
|
80
|
+
}
|
|
81
|
+
return spawnSync(bin, args, { ...baseOpts, shell: false });
|
|
82
|
+
},
|
|
64
83
|
run = (bin, args, opts = {}) => {
|
|
65
|
-
const r =
|
|
84
|
+
const r = spawnCmd(bin, args, { stdio: 'inherit', ...opts });
|
|
66
85
|
if (r.status !== 0) throw new Error(`${bin} ${args.join(' ')} 退出码 ${r.status}`);
|
|
67
86
|
return r;
|
|
68
87
|
},
|
|
69
|
-
runQuiet = (bin, args, opts = {}) =>
|
|
88
|
+
runQuiet = (bin, args, opts = {}) => spawnCmd(bin, args, { encoding: 'utf-8', ...opts }),
|
|
70
89
|
runSilent = (bin, args, opts = {}) => {
|
|
71
|
-
const r =
|
|
90
|
+
const r = spawnCmd(bin, args, { encoding: 'utf-8', ...opts });
|
|
72
91
|
if (r.status !== 0) {
|
|
73
92
|
if (r.stdout) process.stderr.write(r.stdout);
|
|
74
93
|
if (r.stderr) process.stderr.write(r.stderr);
|
|
@@ -128,12 +147,10 @@ const ensureDir = dir => {
|
|
|
128
147
|
* 生成 ESLint flat config 源码(替代 @react-native/eslint-config/flat)
|
|
129
148
|
*/
|
|
130
149
|
buildEslintConfigSource = () => `import js from '@eslint/js';
|
|
131
|
-
import babelParser from '@babel/eslint-parser';
|
|
132
150
|
import tsParser from '@typescript-eslint/parser';
|
|
133
151
|
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
134
|
-
import reactPlugin from 'eslint-plugin
|
|
152
|
+
import reactPlugin from '@eslint-react/eslint-plugin';
|
|
135
153
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
136
|
-
import reactNative from 'eslint-plugin-react-native';
|
|
137
154
|
import prettier from 'eslint-config-prettier';
|
|
138
155
|
|
|
139
156
|
export default [
|
|
@@ -141,19 +158,17 @@ const ensureDir = dir => {
|
|
|
141
158
|
{
|
|
142
159
|
files: ['**/*.{js,jsx,ts,tsx}'],
|
|
143
160
|
languageOptions: {
|
|
144
|
-
parser:
|
|
145
|
-
parserOptions: {
|
|
161
|
+
parser: tsParser,
|
|
162
|
+
parserOptions: { ecmaFeatures: { jsx: true }, sourceType: 'module' },
|
|
146
163
|
},
|
|
147
|
-
plugins: {
|
|
148
|
-
settings: {
|
|
164
|
+
plugins: { ...reactPlugin.configs.recommended.plugins, 'react-hooks': reactHooks },
|
|
165
|
+
settings: { ...reactPlugin.configs.recommended.settings },
|
|
149
166
|
rules: {
|
|
150
167
|
...reactPlugin.configs.recommended.rules,
|
|
151
168
|
...reactHooks.configs.recommended.rules,
|
|
152
|
-
'react/react-in-jsx-scope': 'off',
|
|
153
|
-
'react/prop-types': 'off',
|
|
154
169
|
},
|
|
155
170
|
},
|
|
156
|
-
{ files: ['**/*.{ts,tsx}'],
|
|
171
|
+
{ files: ['**/*.{ts,tsx}'], plugins: { '@typescript-eslint': tsPlugin },
|
|
157
172
|
rules: tsPlugin.configs.recommended.rules }, prettier];`;
|
|
158
173
|
|
|
159
174
|
export {
|