Skip to content

Commit cc98946

Browse files
committed
Bug fixes (angular#622)
* chore: if no files in tsconfig, use empty array * chore: cleanup and check for file existence in the build. Fixes angular#620.
1 parent 4bb5e02 commit cc98946

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

lib/broccoli/angular2-app.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,17 @@ class Angular2App extends BroccoliPlugin {
6969
}
7070

7171
_buildInputTree() {
72-
return new BroccoliMergeTrees([
72+
const inputTreeArray = [
7373
new BroccoliFunnel(this._sourceDir, { destDir: this._sourceDir }),
7474
new BroccoliFunnel('typings', { destDir: 'typings' }),
75-
new BroccoliFunnel('public', { destDir: 'public' }),
7675
this._getConfigTree()
77-
], { overwrite: true });
76+
];
77+
78+
if (fs.existsSync('public')) {
79+
inputTreeArray.push(new BroccoliFunnel('public', { destDir: 'public' }));
80+
}
81+
82+
return new BroccoliMergeTrees(inputTreeArray, { overwrite: true });
7883
}
7984

8085
/**
@@ -121,13 +126,8 @@ class Angular2App extends BroccoliPlugin {
121126

122127
// Add the public folder in.
123128
buildTrees.push(new BroccoliFunnel(this._inputNode, {
124-
include: ['public/**/*'],
125-
getDestinationPath: (n) => {
126-
if (n.startsWith('public')) {
127-
return n.substr(6);
128-
}
129-
return n;
130-
},
129+
allowEmpty: true,
130+
srcDir: 'public',
131131
name: 'PublicFolderFunnel'
132132
}));
133133

@@ -327,20 +327,14 @@ class Angular2App extends BroccoliPlugin {
327327
*/
328328
_getAssetsTree() {
329329
return new BroccoliFunnel(this._inputNode, {
330-
include: [path.join(this._sourceDir, '**/*')],
330+
srcDir: this._sourceDir,
331331
exclude: [
332332
'**/*.ts',
333333
'**/*.scss',
334334
'**/*.sass',
335335
'**/*.less',
336336
'**/*.styl'
337337
],
338-
getDestinationPath: (n) => {
339-
if (n.startsWith(this._sourceDir)) {
340-
return n.substr(this._sourceDir.length);
341-
}
342-
return n;
343-
},
344338
allowEmpty: true
345339
});
346340
}

lib/broccoli/broccoli-typescript.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ class BroccoliTypeScriptCompiler extends Plugin {
122122
var tsConfigPath = path.join(this.inputPaths[0], this._tsConfigPath);
123123
var tsconfig = JSON.parse(fs.readFileSync(tsConfigPath, 'utf-8'));
124124

125-
tsconfig.files = tsconfig.files.map(name => path.join(path.dirname(this._tsConfigPath), name));
125+
tsconfig.files = (tsconfig.files || [])
126+
.map(name => path.join(path.dirname(this._tsConfigPath), name));
126127

127128
// Add all glob files to files. In some cases we don't want to specify
128129
let globFiles = this._options.additionalFiles;

0 commit comments

Comments
 (0)