Skip to content

Commit 11272fa

Browse files
committed
feat(): add typings to the blueprints.
1 parent 10eb75c commit 11272fa

File tree

5 files changed

+36
-5
lines changed

5 files changed

+36
-5
lines changed

addon/ng2/blueprints/ng2/files/gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
/libpeerconnection.log
1919
npm-debug.log
2020
testem.log
21+
/typings/
2122

2223
# e2e
2324
/e2e/*.js
2425
/e2e/*.map
26+

addon/ng2/blueprints/ng2/files/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@
88
"playSound": false
99
}
1010
},
11+
"scripts": {
12+
"start": "ng server",
13+
"postinstall": "typings install --ambient"
14+
},
1115
"private": true,
1216
"dependencies": {
13-
"angular2": "2.0.0-beta.0",
17+
"angular2": "2.0.0-beta.3",
1418
"es6-promise": "^3.0.2",
1519
"es6-shim": "^0.33.3",
1620
"reflect-metadata": "0.1.2",
1721
"rxjs": "5.0.0-beta.0",
1822
"systemjs": "0.19.4",
19-
"zone.js": "0.5.10"
23+
"zone.js": "0.5.11"
2024
},
2125
"devDependencies": {
2226
"angular-cli": "0.0.*",
@@ -27,6 +31,7 @@
2731
"karma-chrome-launcher": "^0.2.1",
2832
"karma-jasmine": "^0.3.6",
2933
"protractor": "^3.0.0",
30-
"typescript": "^1.7.3"
34+
"typescript": "^1.7.3",
35+
"typings": "^0.6.6"
3136
}
3237
}

addon/ng2/blueprints/ng2/files/src/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
"moduleResolution": "node",
99
"noEmitOnError": true,
1010
"noImplicitAny": false,
11+
"outDir": "../dist/",
1112
"rootDir": ".",
1213
"sourceMap": true,
1314
"sourceRoot": "/",
1415
"target": "es5"
15-
}
16+
},
17+
"exclude": [
18+
"../typings/main.d.ts"
19+
]
1620
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"dependencies": {},
3+
"devDependencies": {
4+
},
5+
"ambientDevDependencies": {
6+
"jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#26c98c8a9530c44f8c801ccc3b2057e2101187ee"
7+
},
8+
"ambientDependencies": {
9+
}
10+
}

lib/broccoli/angular2-app.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var path = require('path');
12
var Concat = require('broccoli-concat');
23
var configReplace = require('./broccoli-config-replace');
34
var compileWithTypescript = require('./broccoli-typescript').default;
@@ -32,7 +33,16 @@ Angular2App.prototype.toTree = function() {
3233
vendorNpmFiles = vendorNpmFiles.concat(this.options.vendorNpmFiles);
3334
}
3435

35-
var tsConfigCompilerOptions = JSON.parse(fs.readFileSync('src/tsconfig.json', 'utf-8')).compilerOptions;
36+
var tsConfig = JSON.parse(fs.readFileSync('src/tsconfig.json', 'utf-8'));
37+
var tsConfigCompilerOptions = tsConfig.compilerOptions;
38+
39+
// `rootFilesPath` is used by the broccoli-typescript to add files to the compilation.
40+
// It is _not_ part of the `tsconfig.json` spec, so it won't be found in
41+
// tsConfigCompilerOptions. This adds the typings manually to the compilation step.
42+
tsConfigCompilerOptions.rootFilePaths = [
43+
path.join(process.cwd(), 'typings/browser.d.ts')
44+
];
45+
3646
var tsTree = compileWithTypescript(sourceTree, tsConfigCompilerOptions);
3747
var tsSrcTree = new Funnel(sourceTree, {
3848
include: ['**/*.ts'],

0 commit comments

Comments
 (0)