Skip to content

Commit e1a27d7

Browse files
committed
fix(build): correctly compile source files against typings
It looks like previously we were grabbing typings from outside of the tmp/ directory. If this ever worked, it worked only by accident.
1 parent fcf76e0 commit e1a27d7

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

lib/broccoli/angular2-app.js

+24-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ function Angular2App(defaults, options, additionalPaths) {
1818
}
1919

2020
Angular2App.prototype.toTree = function() {
21-
var sourceTree = 'src';
21+
var sourceDir = 'src';
22+
23+
var sourceTree = new Funnel('src', {
24+
destDir: 'src'
25+
});
26+
27+
var typingsTree = new Funnel('typings', {
28+
include: ['browser.d.ts', 'browser/**'],
29+
destDir: 'typings'
30+
});
31+
2232
var vendorNpmFiles = [
2333
'systemjs/dist/system-polyfills.js',
2434
'systemjs/dist/system.src.js',
@@ -31,28 +41,36 @@ Angular2App.prototype.toTree = function() {
3141
'angular2/bundles/upgrade.dev.js'
3242
];
3343

44+
45+
3446
if (this.options && this.options.vendorNpmFiles) {
3547
vendorNpmFiles = vendorNpmFiles.concat(this.options.vendorNpmFiles);
3648
}
3749

3850
var tsConfigCompilerOptions = JSON.parse(fs.readFileSync('src/tsconfig.json', 'utf-8')).compilerOptions;
51+
// TODO(i): kill rootFilePaths in broccoli-typescript and use tsconfig.json#files instead
52+
tsConfigCompilerOptions.rootFilePaths = JSON.parse(fs.readFileSync('src/tsconfig.json', 'utf-8')).files;
53+
3954
tsConfigCompilerOptions.rootFilePaths = ['typings.d.ts'].concat(this.additionalPaths)
4055
.map(function(name) {
41-
return path.join(process.cwd(), sourceTree, name)
56+
return path.join(process.cwd(), sourceDir, name)
4257
});
4358

44-
var tsTree = compileWithTypescript(sourceTree, tsConfigCompilerOptions);
45-
var tsSrcTree = new Funnel(sourceTree, {
59+
var srcAndTypingsTree = mergeTrees([sourceDir, typingsTree]);
60+
61+
var tsTree = compileWithTypescript(srcAndTypingsTree, tsConfigCompilerOptions);
62+
63+
var tsSrcTree = new Funnel(sourceDir, {
4664
include: ['**/*.ts'],
4765
allowEmpty: true
4866
});
4967

50-
var jsTree = new Funnel(sourceTree, {
68+
var jsTree = new Funnel(sourceDir, {
5169
include: ['**/*.js'],
5270
allowEmpty: true
5371
});
5472

55-
var assetTree = new Funnel(sourceTree, {
73+
var assetTree = new Funnel(sourceDir, {
5674
include: ['**/*.*'],
5775
exclude: ['**/*.ts', '**/*.js'],
5876
allowEmpty: true

0 commit comments

Comments
 (0)