@@ -12,11 +12,11 @@ export class ReplexicaOutputProcessor {
12
12
private constructor (
13
13
private readonly relativeFilePath : string ,
14
14
private readonly options : ReplexicaConfig ,
15
- ) { }
15
+ ) { }
16
16
17
17
private _outDir = path . join ( process . cwd ( ) , `node_modules/@replexica/translations` ) ;
18
18
private _debugDir = path . join ( process . cwd ( ) , '.debug/replexica' ) ;
19
-
19
+
20
20
public saveBuildData ( data : ReplexicaCompilerData ) {
21
21
const filePath = path . join ( this . _outDir , '.replexica.json' ) ;
22
22
const existingData : ReplexicaData = this . _loadObject < ReplexicaData > ( filePath ) || this . _createEmptyData ( ) ;
@@ -44,19 +44,23 @@ export class ReplexicaOutputProcessor {
44
44
public saveClientSourceLocaleData ( data : ReplexicaCompilerData ) {
45
45
const fileName = `${ this . options . locale . source } .client.json` ;
46
46
this . _saveSourceLocaleData (
47
- data ,
48
- fileName ,
47
+ data ,
48
+ fileName ,
49
49
( fileData ) => fileData . context . isClient ,
50
50
) ;
51
51
}
52
52
53
53
public saveStubLocaleData ( ) {
54
54
for ( const targetLocale of this . options . locale . targets ) {
55
55
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
+ }
57
59
58
60
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
+ }
60
64
}
61
65
}
62
66
0 commit comments