Skip to content

fix(): Typings now at the correct place. #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion addon/ng2/blueprints/ng2/files/src/tsconfig.json

This file was deleted.

17 changes: 17 additions & 0 deletions addon/ng2/blueprints/ng2/files/src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"mapRoot": "",
"module": "system",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitAny": false,
"outDir": "../dist/",
"rootDir": ".",
"sourceMap": true,
"sourceRoot": "/",
"target": "es5"
}
}
1 change: 1 addition & 0 deletions addon/ng2/blueprints/ng2/files/src/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference path="../typings/browser.d.ts" />
23 changes: 0 additions & 23 deletions addon/ng2/blueprints/ng2/files/tsconfig.json

This file was deleted.

27 changes: 7 additions & 20 deletions lib/broccoli/angular2-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ var Concat = require('broccoli-concat');
var configReplace = require('./broccoli-config-replace');
var compileWithTypescript = require('./broccoli-typescript').default;
var fs = require('fs');
var glob = require('glob');
var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var Project = require('ember-cli/lib/models/project');

module.exports = Angular2App;

function Angular2App(defaults, options) {
function Angular2App(defaults, options, additionalPaths) {
this._initProject();
this._notifyAddonIncluded();
this.options = options;
this.additionalPaths = additionalPaths || [];
}

Angular2App.prototype.toTree = function() {
Expand All @@ -34,24 +34,11 @@ Angular2App.prototype.toTree = function() {
vendorNpmFiles = vendorNpmFiles.concat(this.options.vendorNpmFiles);
}

var tsConfig = JSON.parse(fs.readFileSync('tsconfig.json', 'utf-8'));
var tsConfigCompilerOptions = tsConfig.compilerOptions;

// `rootFilesPath` is used by the broccoli-typescript to add files to the compilation.
// It is _not_ part of the `tsconfig.json` spec, so it won't be found in
// tsConfigCompilerOptions. This adds the typings manually to the compilation step.
// We pass in all files except those that matches excluded paths.
var exclude = tsConfig.exclude || [];
var files = glob.sync('**/*.ts');
tsConfigCompilerOptions.rootFilePaths = files
.filter(function(x) {
// Remove those who start with paths in the tsconfig exclude list.
return !exclude.some(function(y) { return x.startsWith(y); });
})
.map((function(x) {
// Map them around the current working directory.
return path.join(process.cwd(), x);
}));
var tsConfigCompilerOptions = JSON.parse(fs.readFileSync('src/tsconfig.json', 'utf-8')).compilerOptions;
tsConfigCompilerOptions.rootFilePaths = ['typings.d.ts'].concat(this.additionalPaths)
.map(function(name) {
return path.join(process.cwd(), sourceTree, name)
});

var tsTree = compileWithTypescript(sourceTree, tsConfigCompilerOptions);
var tsSrcTree = new Funnel(sourceTree, {
Expand Down