Small refactor
This commit is contained in:
		| @@ -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[] = [ | const parsers: ParserInterface[] = [ | ||||||
| 	new PipeParser(), | 	new PipeParser(), | ||||||
| 	new DirectiveParser(), | 	new DirectiveParser(), | ||||||
| @@ -56,11 +60,6 @@ try { | |||||||
|  |  | ||||||
| 	let collection: TranslationCollection = extracted; | 	let collection: TranslationCollection = extracted; | ||||||
|  |  | ||||||
| 	let compiler = new JsonCompiler(); |  | ||||||
| 	if (options.format === 'pot') { |  | ||||||
| 		compiler = new PoCompiler(); |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	if (!options.replace && fs.existsSync(outputPath)) { | 	if (!options.replace && fs.existsSync(outputPath)) { | ||||||
| 		const existing: TranslationCollection = compiler.parse(fs.readFileSync(outputPath, 'utf-8')); | 		const existing: TranslationCollection = compiler.parse(fs.readFileSync(outputPath, 'utf-8')); | ||||||
| 		if (existing.count() > 0) { | 		if (existing.count() > 0) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user