@@ -214,17 +214,13 @@ async function runReactNativeBundleCommand({
214
214
215
215
reactNativeBundleProcess . on ( 'close' , async ( exitCode ) => {
216
216
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 } ) ) ) ;
222
218
} else {
223
219
let hermesEnabled : boolean | undefined = false ;
224
220
225
221
if ( disableHermes ) {
226
222
hermesEnabled = false ;
227
- console . log ( 'Hermes disabled' ) ;
223
+ console . log ( t ( 'hermesDisabled' ) ) ;
228
224
} else if ( platform === 'android' ) {
229
225
const gradlePropeties = await new Promise < {
230
226
hermesEnabled ?: boolean ;
@@ -283,8 +279,8 @@ async function copyHarmonyBundle(outputFolder: string) {
283
279
await fs . ensureDir ( outputFolder ) ;
284
280
await fs . copy ( harmonyRawPath , outputFolder ) ;
285
281
} 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 } ) ) ;
288
284
}
289
285
}
290
286
@@ -355,7 +351,7 @@ async function compileHermesByteCode(
355
351
) ;
356
352
args . push ( '-output-source-map' ) ;
357
353
}
358
- console . log ( `Running hermesc: ${ hermesCommand } ${ args . join ( ' ' ) } ` ) ;
354
+ console . log ( t ( 'runningHermesc' , { command : hermesCommand , args : args . join ( ' ' ) } ) ) ;
359
355
spawnSync ( hermesCommand , args , {
360
356
stdio : 'ignore' ,
361
357
} ) ;
@@ -365,7 +361,7 @@ async function compileHermesByteCode(
365
361
if ( ! fs . existsSync ( composerPath ) ) {
366
362
return ;
367
363
}
368
- console . log ( 'Composing source map' ) ;
364
+ console . log ( t ( 'composingSourceMap' ) ) ;
369
365
spawnSync (
370
366
'node' ,
371
367
[
@@ -400,16 +396,14 @@ async function copyDebugidForSentry(
400
396
} ,
401
397
) ;
402
398
} catch ( error ) {
403
- console . error (
404
- '无法找到 Sentry copy-debugid.js 脚本文件,请确保已正确安装 @sentry/react-native' ,
405
- ) ;
399
+ console . error ( t ( 'sentryCliNotFound' ) ) ;
406
400
return ;
407
401
}
408
402
409
403
if ( ! fs . existsSync ( copyDebugidPath ) ) {
410
404
return ;
411
405
}
412
- console . log ( 'Copying debugid' ) ;
406
+ console . log ( t ( 'copyingDebugId' ) ) ;
413
407
spawnSync (
414
408
'node' ,
415
409
[
@@ -453,9 +447,9 @@ async function uploadSourcemapForSentry(
453
447
stdio : 'inherit' ,
454
448
} ,
455
449
) ;
456
- console . log ( `Sentry release created for version: ${ version } ` ) ;
450
+ console . log ( t ( 'sentryReleaseCreated' , { version } ) ) ;
457
451
458
- console . log ( 'Uploading sourcemap' ) ;
452
+ console . log ( t ( 'uploadingSourcemap' ) ) ;
459
453
spawnSync (
460
454
'node' ,
461
455
[
@@ -479,7 +473,7 @@ async function uploadSourcemapForSentry(
479
473
const ignorePackingFileNames = [ '.' , '..' , 'index.bundlejs.map' ] ;
480
474
const ignorePackingExtensions = [ 'DS_Store' , 'txt.map' ] ;
481
475
async function pack ( dir : string , output : string ) {
482
- console . log ( 'Packing' ) ;
476
+ console . log ( t ( 'packing' ) ) ;
483
477
fs . ensureDirSync ( path . dirname ( output ) ) ;
484
478
await new Promise < void > ( ( resolve , reject ) => {
485
479
const zipfile = new ZipFile ( ) ;
@@ -516,7 +510,7 @@ async function pack(dir: string, output: string) {
516
510
} ) ;
517
511
zipfile . end ( ) ;
518
512
} ) ;
519
- console . log ( t ( 'ppkPackageGenerated ' , { output } ) ) ;
513
+ console . log ( t ( 'fileGenerated ' , { file : output } ) ) ;
520
514
}
521
515
522
516
export function readEntire ( entry : string , zipFile : ZipFile ) {
@@ -671,7 +665,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
671
665
672
666
for ( const k in originEntries ) {
673
667
if ( ! newEntries [ k ] ) {
674
- console . log ( `Delete ${ k } ` ) ;
668
+ console . log ( t ( 'deleteFile' , { file : k } ) ) ;
675
669
deletes [ k ] = 1 ;
676
670
}
677
671
}
@@ -844,7 +838,7 @@ export async function enumZipEntries(
844
838
await result ;
845
839
}
846
840
} catch ( error ) {
847
- console . error ( '处理文件时出错: ', error ) ;
841
+ console . error ( t ( 'processingError ', { error } ) ) ;
848
842
}
849
843
850
844
zipfile . readEntry ( ) ;
@@ -860,7 +854,7 @@ function diffArgsCheck(args, options, diffFn) {
860
854
const [ origin , next ] = args ;
861
855
862
856
if ( ! origin || ! next ) {
863
- console . error ( `Usage: pushy ${ diffFn } <origin> <next>` ) ;
857
+ console . error ( t ( 'usageDiff' , { command : diffFn } ) ) ;
864
858
process . exit ( 1 ) ;
865
859
}
866
860
@@ -927,7 +921,7 @@ export const commands = {
927
921
const realOutput = output . replace ( / \$ \{ t i m e \} / g, `${ Date . now ( ) } ` ) ;
928
922
929
923
if ( ! platform ) {
930
- throw new Error ( 'Platform must be specified.' ) ;
924
+ throw new Error ( t ( 'platformRequired' ) ) ;
931
925
}
932
926
933
927
console . log ( `Bundling with react-native: ${ depVersions [ 'react-native' ] } ` ) ;
@@ -972,14 +966,14 @@ export const commands = {
972
966
async diff ( { args, options } ) {
973
967
const { origin, next, realOutput } = diffArgsCheck ( args , options , 'diff' ) ;
974
968
975
- await diffFromPPK ( origin , next , realOutput , 'index.bundlejs' ) ;
969
+ await diffFromPPK ( origin , next , realOutput ) ;
976
970
console . log ( `${ realOutput } generated.` ) ;
977
971
} ,
978
972
979
973
async hdiff ( { args, options } ) {
980
974
const { origin, next, realOutput } = diffArgsCheck ( args , options , 'hdiff' ) ;
981
975
982
- await diffFromPPK ( origin , next , realOutput , 'index.bundlejs' ) ;
976
+ await diffFromPPK ( origin , next , realOutput ) ;
983
977
console . log ( `${ realOutput } generated.` ) ;
984
978
} ,
985
979
0 commit comments