feat(compiler-cli): add an outFile option to ng-xi18n

Fixes #11416
Closes #14508
Closes #14657
This commit is contained in:
Marc Laval
2017-02-15 18:50:03 +01:00
committed by Igor Minar
parent 234f05996c
commit 39f56fafdd
7 changed files with 18 additions and 9 deletions

View File

@ -27,7 +27,7 @@ export class Extractor {
public host: ts.CompilerHost, private ngCompilerHost: CompilerHost,
private program: ts.Program) {}
extract(formatName: string): Promise<void> {
extract(formatName: string, outFile: string|null): Promise<void> {
// Checks the format and returns the extension
const ext = this.getExtension(formatName);
@ -35,7 +35,8 @@ export class Extractor {
return promiseBundle.then(bundle => {
const content = this.serialize(bundle, ext);
const dstPath = path.join(this.options.genDir, `messages.${ext}`);
const dstFile = outFile || `messages.${ext}`;
const dstPath = path.join(this.options.genDir, dstFile);
this.host.writeFile(dstPath, content, false);
});
}