@@ -16,7 +16,7 @@ import os from 'os';
1616const properties = require ( 'properties' ) ;
1717import { addGitIgnore } from './utils/add-gitignore' ;
1818import { checkLockFiles } from './utils/check-lockfile' ;
19- import { tempDir } from './utils/constants' ;
19+ import { scriptName , tempDir } from './utils/constants' ;
2020import { depVersions } from './utils/dep-versions' ;
2121import { t } from './utils/i18n' ;
2222import { versionCommands } from './versions' ;
@@ -548,9 +548,7 @@ async function diffFromPPK(origin: string, next: string, output: string) {
548548 } ) ;
549549
550550 if ( ! originSource ) {
551- throw new Error (
552- 'Bundle file not found! Please use default bundle file name and path.' ,
553- ) ;
551+ throw new Error ( t ( 'bundleFileNotFound' ) ) ;
554552 }
555553
556554 const copies = { } ;
@@ -700,9 +698,7 @@ async function diffFromPackage(
700698 } ) ;
701699
702700 if ( ! originSource ) {
703- throw new Error (
704- 'Bundle file not found! Please use default bundle file name and path.' ,
705- ) ;
701+ throw new Error ( t ( 'bundleFileNotFound' ) ) ;
706702 }
707703
708704 const copies = { } ;
@@ -856,24 +852,21 @@ function diffArgsCheck(args: string[], options: any, diffFn: string) {
856852
857853 if ( diffFn . startsWith ( 'hdiff' ) ) {
858854 if ( ! hdiff ) {
859- console . error (
860- `This function needs "node-hdiffpatch".
861- Please run "npm i node-hdiffpatch" to install` ,
862- ) ;
855+ console . error ( t ( 'nodeHdiffpatchRequired' , { scriptName } ) ) ;
863856 process . exit ( 1 ) ;
864857 }
865858 diff = hdiff ;
866859 } else {
867860 if ( ! bsdiff ) {
868- console . error (
869- `This function needs "node-bsdiff".
870- Please run "npm i node-bsdiff" to install` ,
871- ) ;
861+ console . error ( t ( 'nodeBsdiffRequired' , { scriptName } ) ) ;
872862 process . exit ( 1 ) ;
873863 }
874864 diff = bsdiff ;
875865 }
876- const { output } = options ;
866+ const { output } = translateOptions ( {
867+ ...options ,
868+ tempDir,
869+ } ) ;
877870
878871 return {
879872 origin,
@@ -1004,14 +997,14 @@ export const bundleCommands = {
1004997 const { origin, next, realOutput } = diffArgsCheck ( args , options , 'diff' ) ;
1005998
1006999 await diffFromPPK ( origin , next , realOutput ) ;
1007- console . log ( ` ${ realOutput } generated.` ) ;
1000+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
10081001 } ,
10091002
10101003 async hdiff ( { args, options } ) {
10111004 const { origin, next, realOutput } = diffArgsCheck ( args , options , 'hdiff' ) ;
10121005
10131006 await diffFromPPK ( origin , next , realOutput ) ;
1014- console . log ( ` ${ realOutput } generated.` ) ;
1007+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
10151008 } ,
10161009
10171010 async diffFromApk ( { args, options } ) {
@@ -1027,7 +1020,7 @@ export const bundleCommands = {
10271020 realOutput ,
10281021 'assets/index.android.bundle' ,
10291022 ) ;
1030- console . log ( ` ${ realOutput } generated.` ) ;
1023+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
10311024 } ,
10321025
10331026 async hdiffFromApk ( { args, options } ) {
@@ -1043,7 +1036,7 @@ export const bundleCommands = {
10431036 realOutput ,
10441037 'assets/index.android.bundle' ,
10451038 ) ;
1046- console . log ( ` ${ realOutput } generated.` ) ;
1039+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
10471040 } ,
10481041
10491042 async diffFromApp ( { args, options } ) {
@@ -1058,7 +1051,7 @@ export const bundleCommands = {
10581051 realOutput ,
10591052 'resources/rawfile/bundle.harmony.js' ,
10601053 ) ;
1061- console . log ( ` ${ realOutput } generated.` ) ;
1054+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
10621055 } ,
10631056
10641057 async hdiffFromApp ( { args, options } ) {
@@ -1073,7 +1066,7 @@ export const bundleCommands = {
10731066 realOutput ,
10741067 'resources/rawfile/bundle.harmony.js' ,
10751068 ) ;
1076- console . log ( ` ${ realOutput } generated.` ) ;
1069+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
10771070 } ,
10781071
10791072 async diffFromIpa ( { args, options } ) {
@@ -1088,7 +1081,7 @@ export const bundleCommands = {
10881081 return m ?. [ 1 ] ;
10891082 } ) ;
10901083
1091- console . log ( ` ${ realOutput } generated.` ) ;
1084+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
10921085 } ,
10931086
10941087 async hdiffFromIpa ( { args, options } ) {
@@ -1103,6 +1096,6 @@ export const bundleCommands = {
11031096 return m ?. [ 1 ] ;
11041097 } ) ;
11051098
1106- console . log ( ` ${ realOutput } generated.` ) ;
1099+ console . log ( t ( 'diffPackageGenerated' , { output : realOutput } ) ) ;
11071100 } ,
11081101} ;
0 commit comments