@@ -5,16 +5,56 @@ const path = require('path');
55// Import the require hook. Enables us to require TS files natively.
66require ( 'ts-node/register' ) ;
77
8-
98const Angular2App = require ( 'angular-cli/lib/broccoli/angular2-app' ) ;
109const Funnel = require ( 'broccoli-funnel' ) ;
1110const MergeTree = require ( 'broccoli-merge-trees' ) ;
1211const autoPrefixerTree = require ( 'broccoli-autoprefixer' ) ;
1312
1413
1514module . exports = function ( defaults ) {
16- var angularAppTree = new Angular2App ( defaults , {
17- sourceDir : 'src/' ,
15+ // The Angular Application tree.
16+ const appTree = _buildAppTree ( defaults ) ;
17+
18+ // The CSS tree that is auto prefixed with browser support.
19+ const cssAutoprefixed = autoPrefixerTree ( new Funnel ( appTree , {
20+ include : [ '**/*.css' ]
21+ } ) ) ;
22+
23+ return new MergeTree ( [ appTree , cssAutoprefixed ] , { overwrite : true } ) ;
24+ } ;
25+
26+
27+ /**
28+ * Build the Broccoli Tree containing all the files used as the input to the Angular2App.
29+ */
30+ function _buildDemoAppInputTree ( ) {
31+ return new MergeTree ( [
32+ new Funnel ( 'typings' , {
33+ destDir : 'typings'
34+ } ) ,
35+ new Funnel ( 'src' , {
36+ include : [ 'components/**/*' , 'core/**/*' ] ,
37+ destDir : 'src/demo-app'
38+ } ) ,
39+ new Funnel ( 'src/demo-app' , {
40+ destDir : 'src/demo-app'
41+ } )
42+ ] ) ;
43+ }
44+
45+ /**
46+ * Build the Broccoli Tree that contains the Angular2 App. This picks between E2E, Example or Demo
47+ * app.
48+ * @param defaults The default objects from AngularCLI (deprecated).
49+ * @returns {Angular2App }
50+ */
51+ function _buildAppTree ( defaults ) {
52+ let inputNode = _buildDemoAppInputTree ( ) ;
53+
54+ return new Angular2App ( defaults , inputNode , {
55+ sourceDir : 'src/demo-app' ,
56+ tsCompiler : {
57+ } ,
1858 sassCompiler : {
1959 includePaths : [
2060 'src/core/style'
@@ -27,17 +67,7 @@ module.exports = function(defaults) {
2767 'es6-shim/es6-shim.js' ,
2868 'reflect-metadata/*.js' ,
2969 'rxjs/**/*.js' ,
30- '@angular/**/*.js' ,
70+ '@angular/**/*.js'
3171 ]
3272 } ) ;
33-
34- const cssAutoprefixed = autoPrefixerTree ( new Funnel ( angularAppTree , {
35- include : [ '**/*.css' ]
36- } ) ) ;
37-
38- return new MergeTree ( [
39- new Funnel ( 'src' , { include : [ '**/*.scss' ] } ) ,
40- angularAppTree ,
41- cssAutoprefixed ,
42- ] , { overwrite : true } ) ;
43- } ;
73+ }
0 commit comments