@@ -214,17 +214,13 @@ async function runReactNativeBundleCommand({
214214
215215 reactNativeBundleProcess . on ( 'close' , async ( exitCode ) => {
216216 if ( exitCode ) {
217- reject (
218- new Error (
219- `"react-native bundle" command exited with code ${ exitCode } .` ,
220- ) ,
221- ) ;
217+ reject ( new Error ( t ( 'bundleCommandError' , { code : exitCode } ) ) ) ;
222218 } else {
223219 let hermesEnabled : boolean | undefined = false ;
224220
225221 if ( disableHermes ) {
226222 hermesEnabled = false ;
227- console . log ( 'Hermes disabled' ) ;
223+ console . log ( t ( 'hermesDisabled' ) ) ;
228224 } else if ( platform === 'android' ) {
229225 const gradlePropeties = await new Promise < {
230226 hermesEnabled ?: boolean ;
@@ -283,8 +279,8 @@ async function copyHarmonyBundle(outputFolder: string) {
283279 await fs . ensureDir ( outputFolder ) ;
284280 await fs . copy ( harmonyRawPath , outputFolder ) ;
285281 } catch ( error : any ) {
286- console . error ( 'copyHarmonyBundle 错误: ', error ) ;
287- throw new Error ( `复制文件失败: ${ error . message } ` ) ;
282+ console . error ( t ( 'copyHarmonyBundleError ', { error } ) ) ;
283+ throw new Error ( t ( 'copyFileFailed' , { error : error . message } ) ) ;
288284 }
289285}
290286
@@ -355,7 +351,7 @@ async function compileHermesByteCode(
355351 ) ;
356352 args . push ( '-output-source-map' ) ;
357353 }
358- console . log ( `Running hermesc: ${ hermesCommand } ${ args . join ( ' ' ) } ` ) ;
354+ console . log ( t ( 'runningHermesc' , { command : hermesCommand , args : args . join ( ' ' ) } ) ) ;
359355 spawnSync ( hermesCommand , args , {
360356 stdio : 'ignore' ,
361357 } ) ;
@@ -365,7 +361,7 @@ async function compileHermesByteCode(
365361 if ( ! fs . existsSync ( composerPath ) ) {
366362 return ;
367363 }
368- console . log ( 'Composing source map' ) ;
364+ console . log ( t ( 'composingSourceMap' ) ) ;
369365 spawnSync (
370366 'node' ,
371367 [
@@ -400,16 +396,14 @@ async function copyDebugidForSentry(
400396 } ,
401397 ) ;
402398 } catch ( error ) {
403- console . error (
404- '无法找到 Sentry copy-debugid.js 脚本文件,请确保已正确安装 @sentry/react-native' ,
405- ) ;
399+ console . error ( t ( 'sentryCliNotFound' ) ) ;
406400 return ;
407401 }
408402
409403 if ( ! fs . existsSync ( copyDebugidPath ) ) {
410404 return ;
411405 }
412- console . log ( 'Copying debugid' ) ;
406+ console . log ( t ( 'copyingDebugId' ) ) ;
413407 spawnSync (
414408 'node' ,
415409 [
@@ -453,9 +447,9 @@ async function uploadSourcemapForSentry(
453447 stdio : 'inherit' ,
454448 } ,
455449 ) ;
456- console . log ( `Sentry release created for version: ${ version } ` ) ;
450+ console . log ( t ( 'sentryReleaseCreated' , { version } ) ) ;
457451
458- console . log ( 'Uploading sourcemap' ) ;
452+ console . log ( t ( 'uploadingSourcemap' ) ) ;
459453 spawnSync (
460454 'node' ,
461455 [
@@ -479,7 +473,7 @@ async function uploadSourcemapForSentry(
479473const ignorePackingFileNames = [ '.' , '..' , 'index.bundlejs.map' ] ;
480474const ignorePackingExtensions = [ 'DS_Store' , 'txt.map' ] ;
481475async function pack ( dir : string , output : string ) {
482- console . log ( 'Packing' ) ;
476+ console . log ( t ( 'packing' ) ) ;
483477 fs . ensureDirSync ( path . dirname ( output ) ) ;
484478 await new Promise < void > ( ( resolve , reject ) => {
485479 const zipfile = new ZipFile ( ) ;
@@ -516,7 +510,7 @@ async function pack(dir: string, output: string) {
516510 } ) ;
517511 zipfile . end ( ) ;
518512 } ) ;
519- console . log ( t ( 'ppkPackageGenerated ' , { output } ) ) ;
513+ console . log ( t ( 'fileGenerated ' , { file : output } ) ) ;
520514}
521515
522516export function readEntire ( entry : string , zipFile : ZipFile ) {
@@ -671,7 +665,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
671665
672666 for ( const k in originEntries ) {
673667 if ( ! newEntries [ k ] ) {
674- console . log ( `Delete ${ k } ` ) ;
668+ console . log ( t ( 'deleteFile' , { file : k } ) ) ;
675669 deletes [ k ] = 1 ;
676670 }
677671 }
@@ -844,7 +838,7 @@ export async function enumZipEntries(
844838 await result ;
845839 }
846840 } catch ( error ) {
847- console . error ( '处理文件时出错: ', error ) ;
841+ console . error ( t ( 'processingError ', { error } ) ) ;
848842 }
849843
850844 zipfile . readEntry ( ) ;
@@ -860,7 +854,7 @@ function diffArgsCheck(args, options, diffFn) {
860854 const [ origin , next ] = args ;
861855
862856 if ( ! origin || ! next ) {
863- console . error ( `Usage: pushy ${ diffFn } <origin> <next>` ) ;
857+ console . error ( t ( 'usageDiff' , { command : diffFn } ) ) ;
864858 process . exit ( 1 ) ;
865859 }
866860
@@ -927,7 +921,7 @@ export const commands = {
927921 const realOutput = output . replace ( / \$ \{ t i m e \} / g, `${ Date . now ( ) } ` ) ;
928922
929923 if ( ! platform ) {
930- throw new Error ( 'Platform must be specified.' ) ;
924+ throw new Error ( t ( 'platformRequired' ) ) ;
931925 }
932926
933927 console . log ( `Bundling with react-native: ${ depVersions [ 'react-native' ] } ` ) ;
@@ -972,14 +966,14 @@ export const commands = {
972966 async diff ( { args, options } ) {
973967 const { origin, next, realOutput } = diffArgsCheck ( args , options , 'diff' ) ;
974968
975- await diffFromPPK ( origin , next , realOutput , 'index.bundlejs' ) ;
969+ await diffFromPPK ( origin , next , realOutput ) ;
976970 console . log ( `${ realOutput } generated.` ) ;
977971 } ,
978972
979973 async hdiff ( { args, options } ) {
980974 const { origin, next, realOutput } = diffArgsCheck ( args , options , 'hdiff' ) ;
981975
982- await diffFromPPK ( origin , next , realOutput , 'index.bundlejs' ) ;
976+ await diffFromPPK ( origin , next , realOutput ) ;
983977 console . log ( `${ realOutput } generated.` ) ;
984978 } ,
985979
0 commit comments