@@ -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 ( / ^ a s s e t s [ \\ / ] / , '' ) ;
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-
320260function getHermesOSBin ( ) {
321261 if ( os . platform ( ) === 'win32' ) return 'win64-bin' ;
322262 if ( os . platform ( ) === 'darwin' ) return 'osx-bin' ;
0 commit comments