diff --git a/addon/ng2/blueprints/ng2/files/src/tsconfig.json b/addon/ng2/blueprints/ng2/files/src/tsconfig.json deleted file mode 120000 index 4ec6ff6afff9..000000000000 --- a/addon/ng2/blueprints/ng2/files/src/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -../tsconfig.json \ No newline at end of file diff --git a/addon/ng2/blueprints/ng2/files/src/tsconfig.json b/addon/ng2/blueprints/ng2/files/src/tsconfig.json new file mode 100644 index 000000000000..87d7f339fd9a --- /dev/null +++ b/addon/ng2/blueprints/ng2/files/src/tsconfig.json @@ -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" + } +} diff --git a/addon/ng2/blueprints/ng2/files/src/typings.d.ts b/addon/ng2/blueprints/ng2/files/src/typings.d.ts new file mode 100644 index 000000000000..beb6cefcecec --- /dev/null +++ b/addon/ng2/blueprints/ng2/files/src/typings.d.ts @@ -0,0 +1 @@ +/// diff --git a/addon/ng2/blueprints/ng2/files/tsconfig.json b/addon/ng2/blueprints/ng2/files/tsconfig.json deleted file mode 100644 index b697ea88669b..000000000000 --- a/addon/ng2/blueprints/ng2/files/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "declaration": false, - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "mapRoot": "", - "module": "system", - "moduleResolution": "node", - "noEmitOnError": true, - "noImplicitAny": false, - "outDir": "../dist/", - "rootDir": ".", - "sourceMap": true, - "sourceRoot": "/", - "target": "es5" - }, - "exclude": [ - "e2e/", - "node_modules/", - "typings/main", - "typings/main.d.ts" - ] -} diff --git a/lib/broccoli/angular2-app.js b/lib/broccoli/angular2-app.js index f51810160e68..cd9a5a172fe2 100644 --- a/lib/broccoli/angular2-app.js +++ b/lib/broccoli/angular2-app.js @@ -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() { @@ -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, {