react-native-update-cli 2.3.0 → 2.3.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/lib/bundle.js +31 -6
- package/package.json +1 -1
- package/src/bundle.ts +31 -2
package/lib/bundle.js
CHANGED
|
@@ -109,15 +109,28 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
109
109
|
let usingExpo = false;
|
|
110
110
|
const getExpoCli = ()=>{
|
|
111
111
|
try {
|
|
112
|
+
const searchPaths = [
|
|
113
|
+
process.cwd()
|
|
114
|
+
];
|
|
115
|
+
// 尝试添加 expo 包的路径作为额外的搜索路径
|
|
116
|
+
try {
|
|
117
|
+
const expoPath = require.resolve('expo/package.json', {
|
|
118
|
+
paths: [
|
|
119
|
+
process.cwd()
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
// 获取 expo 包的目录路径
|
|
123
|
+
const expoDir = expoPath.replace(/\/package\.json$/, '');
|
|
124
|
+
searchPaths.push(expoDir);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
// expo 包不存在,忽略
|
|
127
|
+
}
|
|
128
|
+
// 尝试从搜索路径中解析 @expo/cli
|
|
112
129
|
cliPath = require.resolve('@expo/cli', {
|
|
113
|
-
paths:
|
|
114
|
-
process.cwd()
|
|
115
|
-
]
|
|
130
|
+
paths: searchPaths
|
|
116
131
|
});
|
|
117
132
|
const expoCliVersion = JSON.parse(_fsextra.readFileSync(require.resolve('@expo/cli/package.json', {
|
|
118
|
-
paths:
|
|
119
|
-
process.cwd()
|
|
120
|
-
]
|
|
133
|
+
paths: searchPaths
|
|
121
134
|
})).toString()).version;
|
|
122
135
|
// expo cli 0.10.17 (expo 49) 开始支持 bundle:embed
|
|
123
136
|
if ((0, _compareversions.satisfies)(expoCliVersion, '>= 0.10.17')) {
|
|
@@ -244,6 +257,18 @@ async function runReactNativeBundleCommand({ bundleName, dev, entryFile, outputF
|
|
|
244
257
|
if (hermesEnabled) {
|
|
245
258
|
await compileHermesByteCode(bundleName, outputFolder, sourcemapOutput, !isSentry);
|
|
246
259
|
}
|
|
260
|
+
if (platform === 'harmony') {
|
|
261
|
+
const harmonyRawAssetsPath = 'harmony/entry/src/main/resources/rawfile/assets';
|
|
262
|
+
// copy all files in outputFolder to harmonyRawPath
|
|
263
|
+
// assets should be in rawfile/assets
|
|
264
|
+
_fsextra.ensureDirSync(harmonyRawAssetsPath);
|
|
265
|
+
_fsextra.copySync(outputFolder, harmonyRawAssetsPath, {
|
|
266
|
+
overwrite: true
|
|
267
|
+
});
|
|
268
|
+
_fsextra.moveSync(`${harmonyRawAssetsPath}/bundle.harmony.js`, `${harmonyRawAssetsPath}/../bundle.harmony.js`, {
|
|
269
|
+
overwrite: true
|
|
270
|
+
});
|
|
271
|
+
}
|
|
247
272
|
resolve(null);
|
|
248
273
|
}
|
|
249
274
|
});
|
package/package.json
CHANGED
package/src/bundle.ts
CHANGED
|
@@ -85,14 +85,30 @@ async function runReactNativeBundleCommand({
|
|
|
85
85
|
|
|
86
86
|
const getExpoCli = () => {
|
|
87
87
|
try {
|
|
88
|
+
const searchPaths = [process.cwd()];
|
|
89
|
+
|
|
90
|
+
// 尝试添加 expo 包的路径作为额外的搜索路径
|
|
91
|
+
try {
|
|
92
|
+
const expoPath = require.resolve('expo/package.json', {
|
|
93
|
+
paths: [process.cwd()],
|
|
94
|
+
});
|
|
95
|
+
// 获取 expo 包的目录路径
|
|
96
|
+
const expoDir = expoPath.replace(/\/package\.json$/, '');
|
|
97
|
+
searchPaths.push(expoDir);
|
|
98
|
+
} catch {
|
|
99
|
+
// expo 包不存在,忽略
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// 尝试从搜索路径中解析 @expo/cli
|
|
88
103
|
cliPath = require.resolve('@expo/cli', {
|
|
89
|
-
paths:
|
|
104
|
+
paths: searchPaths,
|
|
90
105
|
});
|
|
106
|
+
|
|
91
107
|
const expoCliVersion = JSON.parse(
|
|
92
108
|
fs
|
|
93
109
|
.readFileSync(
|
|
94
110
|
require.resolve('@expo/cli/package.json', {
|
|
95
|
-
paths:
|
|
111
|
+
paths: searchPaths,
|
|
96
112
|
}),
|
|
97
113
|
)
|
|
98
114
|
.toString(),
|
|
@@ -256,6 +272,19 @@ async function runReactNativeBundleCommand({
|
|
|
256
272
|
!isSentry,
|
|
257
273
|
);
|
|
258
274
|
}
|
|
275
|
+
if (platform === 'harmony') {
|
|
276
|
+
const harmonyRawAssetsPath =
|
|
277
|
+
'harmony/entry/src/main/resources/rawfile/assets';
|
|
278
|
+
// copy all files in outputFolder to harmonyRawPath
|
|
279
|
+
// assets should be in rawfile/assets
|
|
280
|
+
fs.ensureDirSync(harmonyRawAssetsPath);
|
|
281
|
+
fs.copySync(outputFolder, harmonyRawAssetsPath, { overwrite: true });
|
|
282
|
+
fs.moveSync(
|
|
283
|
+
`${harmonyRawAssetsPath}/bundle.harmony.js`,
|
|
284
|
+
`${harmonyRawAssetsPath}/../bundle.harmony.js`,
|
|
285
|
+
{ overwrite: true },
|
|
286
|
+
);
|
|
287
|
+
}
|
|
259
288
|
resolve(null);
|
|
260
289
|
}
|
|
261
290
|
});
|