Skip to content

Commit 8c42b49

Browse files
committed
Include *all* directories included via include as well.
1 parent 59ab4fd commit 8c42b49

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)