Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions tools/tasks/seed/compile.ahead.prod.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import 'reflect-metadata';
import * as ts from 'typescript';
import * as tsc from '@angular/tsc-wrapped';
import { argv } from 'yargs';
import { join } from 'path';
import { writeFileSync, readFileSync } from 'fs';
import { CodeGenerator } from '@angular/compiler-cli';
import { CodeGenerator, AngularCompilerOptions, NgcCliOptions, main } from '@angular/compiler-cli';

import Config from '../../config';

function codegen(
ngOptions: tsc.AngularCompilerOptions, cliOptions: tsc.NgcCliOptions, program: ts.Program,
host: ts.CompilerHost) {
return CodeGenerator.create(ngOptions, cliOptions, program, host).codegen({transitiveModules: true});
ngOptions: AngularCompilerOptions, cliOptions: NgcCliOptions, program: ts.Program,
host: ts.CompilerHost) {
return CodeGenerator.create(ngOptions, cliOptions, program, host).codegen({ transitiveModules: true });
}

const modifyFile = (path: string, mod: any = (f: string) => f) => {
Expand All @@ -30,14 +29,14 @@ export = (done: any) => {
const args = argv;

// If a translation, tell the compiler
if(args.lang) {
if (args.lang) {
args['i18nFile'] = `./src/client/assets/locale/messages.${args.lang}.xlf`;
args['locale'] = args.lang;
args['i18nFormat'] = 'xlf';
}

const cliOptions = new tsc.NgcCliOptions(args);
tsc.main(Config.TMP_DIR, cliOptions, codegen)
const cliOptions = new NgcCliOptions(args);
main(Config.TMP_DIR, cliOptions, codegen)
.then(done)
.catch(e => {
console.error(e.stack);
Expand Down