1
1
import 'reflect-metadata' ;
2
2
import * as ts from 'typescript' ;
3
- import * as tsc from '@angular/tsc-wrapped' ;
4
3
import { argv } from 'yargs' ;
5
4
import { join } from 'path' ;
6
5
import { writeFileSync , readFileSync } from 'fs' ;
7
- import { CodeGenerator } from '@angular/compiler-cli' ;
6
+ import { CodeGenerator , AngularCompilerOptions , NgcCliOptions , main } from '@angular/compiler-cli' ;
8
7
9
8
import Config from '../../config' ;
10
9
11
10
function codegen (
12
- ngOptions : tsc . AngularCompilerOptions , cliOptions : tsc . NgcCliOptions , program : ts . Program ,
13
- host : ts . CompilerHost ) {
14
- return CodeGenerator . create ( ngOptions , cliOptions , program , host ) . codegen ( { transitiveModules : true } ) ;
11
+ ngOptions : AngularCompilerOptions , cliOptions : NgcCliOptions , program : ts . Program ,
12
+ host : ts . CompilerHost ) {
13
+ return CodeGenerator . create ( ngOptions , cliOptions , program , host ) . codegen ( { transitiveModules : true } ) ;
15
14
}
16
15
17
16
const modifyFile = ( path : string , mod : any = ( f : string ) => f ) => {
@@ -30,14 +29,14 @@ export = (done: any) => {
30
29
const args = argv ;
31
30
32
31
// If a translation, tell the compiler
33
- if ( args . lang ) {
32
+ if ( args . lang ) {
34
33
args [ 'i18nFile' ] = `./src/client/assets/locale/messages.${ args . lang } .xlf` ;
35
34
args [ 'locale' ] = args . lang ;
36
35
args [ 'i18nFormat' ] = 'xlf' ;
37
36
}
38
37
39
- const cliOptions = new tsc . NgcCliOptions ( args ) ;
40
- tsc . main ( Config . TMP_DIR , cliOptions , codegen )
38
+ const cliOptions = new NgcCliOptions ( args ) ;
39
+ main ( Config . TMP_DIR , cliOptions , codegen )
41
40
. then ( done )
42
41
. catch ( e => {
43
42
console . error ( e . stack ) ;
0 commit comments