@@ -12,11 +12,11 @@ export class ReplexicaOutputProcessor {
1212 private constructor (
1313 private readonly relativeFilePath : string ,
1414 private readonly options : ReplexicaConfig ,
15- ) { }
15+ ) { }
1616
1717 private _outDir = path . join ( process . cwd ( ) , `node_modules/@replexica/translations` ) ;
1818 private _debugDir = path . join ( process . cwd ( ) , '.debug/replexica' ) ;
19-
19+
2020 public saveBuildData ( data : ReplexicaCompilerData ) {
2121 const filePath = path . join ( this . _outDir , '.replexica.json' ) ;
2222 const existingData : ReplexicaData = this . _loadObject < ReplexicaData > ( filePath ) || this . _createEmptyData ( ) ;
@@ -44,19 +44,23 @@ export class ReplexicaOutputProcessor {
4444 public saveClientSourceLocaleData ( data : ReplexicaCompilerData ) {
4545 const fileName = `${ this . options . locale . source } .client.json` ;
4646 this . _saveSourceLocaleData (
47- data ,
48- fileName ,
47+ data ,
48+ fileName ,
4949 ( fileData ) => fileData . context . isClient ,
5050 ) ;
5151 }
5252
5353 public saveStubLocaleData ( ) {
5454 for ( const targetLocale of this . options . locale . targets ) {
5555 const fullLocaleDataFilePath = path . join ( this . _outDir , `${ targetLocale } .json` ) ;
56- fs . writeFileSync ( fullLocaleDataFilePath , '{}' , 'utf-8' ) ;
56+ if ( ! fs . existsSync ( fullLocaleDataFilePath ) ) {
57+ fs . writeFileSync ( fullLocaleDataFilePath , '{}' , 'utf-8' ) ;
58+ }
5759
5860 const clientLocaleDataFilePath = path . join ( this . _outDir , `${ targetLocale } .client.json` ) ;
59- fs . writeFileSync ( clientLocaleDataFilePath , '{}' , 'utf-8' ) ;
61+ if ( ! fs . existsSync ( clientLocaleDataFilePath ) ) {
62+ fs . writeFileSync ( clientLocaleDataFilePath , '{}' , 'utf-8' ) ;
63+ }
6064 }
6165 }
6266
0 commit comments