Skip to content

Commit 15c8052

Browse files
committed
Update version to 2.2.4 in package.json and enhance argument handling in runReactNativeBundleCommand for improved functionality.
1 parent c633af5 commit 15c8052

File tree

2 files changed

+13
-73
lines changed

2 files changed

+13
-73
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-update-cli",
3-
"version": "2.2.3",
3+
"version": "2.2.4",
44
"description": "command line tool for react-native-update (remote updates for react native)",
55
"main": "index.js",
66
"bin": {

src/bundle.ts

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -163,18 +163,20 @@ async function runReactNativeBundleCommand({
163163
bundleCommand = 'build';
164164
}
165165

166-
reactNativeBundleArgs.push(cliPath, bundleCommand);
166+
reactNativeBundleArgs.push(
167+
cliPath,
168+
bundleCommand,
169+
'--assets-dest',
170+
outputFolder,
171+
'--bundle-output',
172+
path.join(
173+
outputFolder,
174+
platform === 'harmony' ? 'harmony.bundle.js' : bundleName,
175+
),
176+
);
167177

168178
if (platform !== 'harmony') {
169-
reactNativeBundleArgs.push(
170-
'--platform',
171-
platform,
172-
'--assets-dest',
173-
outputFolder,
174-
'--bundle-output',
175-
path.join(outputFolder, bundleName),
176-
'--reset-cache',
177-
);
179+
reactNativeBundleArgs.push('--platform', platform, '--reset-cache');
178180
}
179181

180182
if (cli.taro) {
@@ -240,8 +242,6 @@ async function runReactNativeBundleCommand({
240242
fs.existsSync('ios/Pods/hermes-engine')
241243
) {
242244
hermesEnabled = true;
243-
} else if (platform === 'harmony') {
244-
await copyHarmonyBundle(outputFolder);
245245
}
246246
if (hermesEnabled) {
247247
await compileHermesByteCode(
@@ -257,66 +257,6 @@ async function runReactNativeBundleCommand({
257257
});
258258
}
259259

260-
async function copyHarmonyBundle(outputFolder: string) {
261-
const harmonyRawPath = 'harmony/entry/src/main/resources/rawfile';
262-
try {
263-
await fs.ensureDir(harmonyRawPath);
264-
try {
265-
await fs.access(harmonyRawPath, fs.constants.W_OK);
266-
} catch (error) {
267-
await fs.chmod(harmonyRawPath, 0o755);
268-
}
269-
await fs.remove(path.join(harmonyRawPath, 'update.json'));
270-
await fs.copy('update.json', path.join(harmonyRawPath, 'update.json'));
271-
await fs.ensureDir(outputFolder);
272-
273-
// Recursively copy files with special handling for assets directory
274-
async function copyFilesRecursively(
275-
srcDir: string,
276-
destDir: string,
277-
relativePath = '',
278-
) {
279-
const fullSrcPath = path.join(srcDir, relativePath);
280-
const items = await fs.readdir(fullSrcPath);
281-
282-
for (const item of items) {
283-
const itemRelativePath = path.join(relativePath, item);
284-
const itemSrcPath = path.join(srcDir, itemRelativePath);
285-
286-
// Skip update.json and meta.json at root level
287-
if (!relativePath && (item === 'update.json' || item === 'meta.json')) {
288-
continue;
289-
}
290-
291-
const stat = await fs.stat(itemSrcPath);
292-
293-
if (stat.isFile()) {
294-
// Special handling: remove 'assets/' prefix to move files up one level
295-
let itemDestPath = itemRelativePath;
296-
if (
297-
itemDestPath.startsWith('assets/') ||
298-
itemDestPath.startsWith('assets\\')
299-
) {
300-
itemDestPath = itemDestPath.replace(/^assets[\\/]/, '');
301-
}
302-
303-
const fullDestPath = path.join(destDir, itemDestPath);
304-
await fs.ensureDir(path.dirname(fullDestPath));
305-
await fs.copy(itemSrcPath, fullDestPath);
306-
} else if (stat.isDirectory()) {
307-
// Recursively process subdirectories
308-
await copyFilesRecursively(srcDir, destDir, itemRelativePath);
309-
}
310-
}
311-
}
312-
313-
await copyFilesRecursively(harmonyRawPath, outputFolder);
314-
} catch (error: any) {
315-
console.error(t('copyHarmonyBundleError', { error }));
316-
throw new Error(t('copyFileFailed', { error: error.message }));
317-
}
318-
}
319-
320260
function getHermesOSBin() {
321261
if (os.platform() === 'win32') return 'win64-bin';
322262
if (os.platform() === 'darwin') return 'osx-bin';

0 commit comments

Comments
 (0)