@@ -55,17 +55,23 @@ module.exports = {
5555 } ,
5656
5757 treeForApp ( tree ) {
58- const typesDirPath = path . resolve ( this . app . project . root , 'types' ) ;
59- const typesDirExists = fs . existsSync ( typesDirPath ) ;
60- const trees = [ tree ] . concat ( typesDirExists ? funnel ( typesDirPath , { destDir : 'types' } ) : [ ] ) ;
58+ const { include } = JSON . parse (
59+ fs . readFileSync ( path . resolve ( this . app . project . root , 'tsconfig.json' ) , { encoding : 'utf8' } )
60+ ) ;
61+
62+ const includes = [ 'types' ]
63+ . concat ( include ? include : [ ] )
64+ . reduce ( ( unique , entry ) => ( unique . indexOf ( entry ) === - 1 ? unique . concat ( entry ) : unique ) , [ ] )
65+ . map ( p => path . resolve ( this . app . project . root , p ) )
66+ . filter ( fs . existsSync ) ;
67+
68+ const additionalTrees = includes . map ( p => funnel ( p , { destDir : p } ) ) ;
6169
6270 if ( ! this . _isRunningServeTS ( ) ) {
63- return mergeTrees ( trees ) ;
71+ return mergeTrees ( [ tree , ... additionalTrees ] ) ;
6472 }
6573
66- const roots = [ '.' , ...( typesDirExists ? [ typesDirPath ] : [ ] ) , ...this . _inRepoAddons ( ) ] . map (
67- root => path . join ( root , 'app' )
68- ) ;
74+ const roots = [ '.' , ...includes , ...this . _inRepoAddons ( ) ] . map ( root => path . join ( root , 'app' ) ) ;
6975
7076 // funnel will fail if the directory doesn't exist
7177 roots . forEach ( root => {
0 commit comments