@@ -3,17 +3,17 @@ var Concat = require('broccoli-concat');
3
3
var configReplace = require ( './broccoli-config-replace' ) ;
4
4
var compileWithTypescript = require ( './broccoli-typescript' ) . default ;
5
5
var fs = require ( 'fs' ) ;
6
- var glob = require ( 'glob' ) ;
7
6
var Funnel = require ( 'broccoli-funnel' ) ;
8
7
var mergeTrees = require ( 'broccoli-merge-trees' ) ;
9
8
var Project = require ( 'ember-cli/lib/models/project' ) ;
10
9
11
10
module . exports = Angular2App ;
12
11
13
- function Angular2App ( defaults , options ) {
12
+ function Angular2App ( defaults , options , additionalPaths ) {
14
13
this . _initProject ( ) ;
15
14
this . _notifyAddonIncluded ( ) ;
16
15
this . options = options ;
16
+ this . additionalPaths = additionalPaths || [ ] ;
17
17
}
18
18
19
19
Angular2App . prototype . toTree = function ( ) {
@@ -34,24 +34,11 @@ Angular2App.prototype.toTree = function() {
34
34
vendorNpmFiles = vendorNpmFiles . concat ( this . options . vendorNpmFiles ) ;
35
35
}
36
36
37
- var tsConfig = JSON . parse ( fs . readFileSync ( 'tsconfig.json' , 'utf-8' ) ) ;
38
- var tsConfigCompilerOptions = tsConfig . compilerOptions ;
39
-
40
- // `rootFilesPath` is used by the broccoli-typescript to add files to the compilation.
41
- // It is _not_ part of the `tsconfig.json` spec, so it won't be found in
42
- // tsConfigCompilerOptions. This adds the typings manually to the compilation step.
43
- // We pass in all files except those that matches excluded paths.
44
- var exclude = tsConfig . exclude || [ ] ;
45
- var files = glob . sync ( '**/*.ts' ) ;
46
- tsConfigCompilerOptions . rootFilePaths = files
47
- . filter ( function ( x ) {
48
- // Remove those who start with paths in the tsconfig exclude list.
49
- return ! exclude . some ( function ( y ) { return x . startsWith ( y ) ; } ) ;
50
- } )
51
- . map ( ( function ( x ) {
52
- // Map them around the current working directory.
53
- return path . join ( process . cwd ( ) , x ) ;
54
- } ) ) ;
37
+ var tsConfigCompilerOptions = JSON . parse ( fs . readFileSync ( 'src/tsconfig.json' , 'utf-8' ) ) . compilerOptions ;
38
+ tsConfigCompilerOptions . rootFilePaths = [ 'typings.d.ts' ] . concat ( this . additionalPaths )
39
+ . map ( function ( name ) {
40
+ return path . join ( process . cwd ( ) , sourceTree , name )
41
+ } ) ;
55
42
56
43
var tsTree = compileWithTypescript ( sourceTree , tsConfigCompilerOptions ) ;
57
44
var tsSrcTree = new Funnel ( sourceTree , {
0 commit comments