Small refactor

This commit is contained in:
Kim Biesbjerg 2016-12-23 05:54:49 +01:00
parent 2a36aa7319
commit 94e6416c76

View File

@ -36,6 +36,10 @@ const outputPath: string = path.join(outputDir, outputFilename);
}
});
let compiler = new JsonCompiler();
if (options.format === 'pot') {
compiler = new PoCompiler();
}
const parsers: ParserInterface[] = [
new PipeParser(),
new DirectiveParser(),
@ -56,11 +60,6 @@ try {
let collection: TranslationCollection = extracted;
let compiler = new JsonCompiler();
if (options.format === 'pot') {
compiler = new PoCompiler();
}
if (!options.replace && fs.existsSync(outputPath)) {
const existing: TranslationCollection = compiler.parse(fs.readFileSync(outputPath, 'utf-8'));
if (existing.count() > 0) {