File tree Expand file tree Collapse file tree 14 files changed +171
-90
lines changed
docs/documentation/stories Expand file tree Collapse file tree 14 files changed +171
-90
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,18 @@ npm install d3 --save
9
9
npm install @types/d3 --save-dev
10
10
```
11
11
12
+ Then open ` src/tsconfig.app.json ` and add it to the ` types ` array:
13
+
14
+ ```
15
+ "types":[
16
+ "d3"
17
+ ]
18
+ ```
19
+
20
+ If the library you added typings for is only to be used on your e2e tests,
21
+ instead use ` e2e/tsconfig.e2e.json ` .
22
+ The same goes for unit tests and ` src/tsconfig.spec.json ` .
23
+
12
24
If the library doesn't have typings available at ` @types/ ` , you can still use it by
13
25
manually adding typings for it:
14
26
Original file line number Diff line number Diff line change
1
+ {<% if (ng4) { %>
2
+ "extends" : " <%= relativeRootPath %>/tsconfig.json" ,
3
+ "compilerOptions" : {
4
+ "lib" : [
5
+ " es2016" ,
6
+ " dom"
7
+ ],<% } else { %>
8
+ "compilerOptions" : {
9
+ "sourceMap" : true ,
10
+ "declaration" : false ,
11
+ "moduleResolution" : " node" ,
12
+ "emitDecoratorMetadata" : true ,
13
+ "experimentalDecorators" : true ,
14
+ "lib" : [
15
+ " es2016" ,
16
+ " dom"
17
+ ],<% } %>
18
+ "outDir" : " <%= relativeRootPath %>/out-tsc/app" ,
19
+ "target" : " es5" ,
20
+ "module" : " es2015" ,
21
+ "baseUrl" : " " ,
22
+ "types" : []
23
+ },
24
+ "exclude" : [
25
+ " test.ts" ,
26
+ " **/*.spec.ts"
27
+ ]
28
+ }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ {<% if (ng4) { %>
2
+ "extends" : " <%= relativeRootPath %>/tsconfig.json" ,
3
+ "compilerOptions" : {<% } else { %>
4
+ "compilerOptions" : {
5
+ "sourceMap" : true ,
6
+ "declaration" : false ,
7
+ "moduleResolution" : " node" ,
8
+ "emitDecoratorMetadata" : true ,
9
+ "experimentalDecorators" : true ,
10
+ "lib" : [
11
+ " es2016"
12
+ ],<% } %>
13
+ "outDir" : " <%= relativeRootPath %>/out-tsc/spec" ,
14
+ "module" : " commonjs" ,
15
+ "target" : " es6" ,
16
+ "baseUrl" : " " ,
17
+ "types" : [
18
+ " jasmine" ,
19
+ " node"
20
+ ]
21
+ },
22
+ "files" : [
23
+ " test.ts"
24
+ ],
25
+ "include" : [
26
+ " **/*.spec.ts"
27
+ ]
28
+ }
Original file line number Diff line number Diff line change 15
15
"main" : " main.ts" ,
16
16
"polyfills" : " polyfills.ts" ,
17
17
"test" : " test.ts" ,
18
- "tsconfig" : " tsconfig.json" ,
18
+ "tsconfig" : " tsconfig.app.json" ,
19
+ "testTsconfig" : " tsconfig.spec.json" ,
19
20
"prefix" : " <%= prefix %>" ,
20
21
"styles" : [
21
22
" styles.<%= styleExt %>"
35
36
},
36
37
"lint" : [
37
38
{
38
- "files" : " <%= sourceDir %>/**/*.ts" ,
39
- "project" : " <%= sourceDir %>/tsconfig.json"
39
+ "project" : " <%= sourceDir %>/tsconfig.app.json"
40
40
},
41
41
{
42
- "files" : " e2e/**/*.ts" ,
43
- "project" : " e2e/tsconfig.json"
42
+ "project" : " <%= sourceDir %>/tsconfig.spec.json"
43
+ },
44
+ {
45
+ "project" : " e2e/tsconfig.e2e.json"
44
46
}
45
47
],
46
48
"test" : {
Original file line number Diff line number Diff line change 1
- {
2
- "compileOnSave" : false ,
1
+ {<% if (ng4) { %>
2
+ "extends" : " ../tsconfig.json" ,
3
+ "compilerOptions" : {<% } else { %>
3
4
"compilerOptions" : {
5
+ "sourceMap" : true ,
4
6
"declaration" : false ,
7
+ "moduleResolution" : " node" ,
5
8
"emitDecoratorMetadata" : true ,
6
9
"experimentalDecorators" : true ,
7
10
"lib" : [
8
11
" es2016"
9
- ],
10
- "module" : " commonjs" ,
11
- "moduleResolution" : " node" ,
12
+ ],<% } %>
12
13
"outDir" : " ../dist/out-tsc-e2e" ,
13
- "sourceMap " : true ,
14
+ "module " : " commonjs " ,
14
15
"target" : " es6" ,
15
- "typeRoots" : [
16
- " ../node_modules/@types"
16
+ "types" :[
17
+ " jasmine" ,
18
+ " node"
17
19
]
18
20
}
19
21
}
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ exports.config = {
22
22
} ,
23
23
beforeLaunch : function ( ) {
24
24
require ( 'ts-node' ) . register ( {
25
- project : 'e2e'
25
+ project : 'e2e/tsconfig.e2e.json '
26
26
} ) ;
27
27
} ,
28
28
onPrepare ( ) {
Original file line number Diff line number Diff line change
1
+ {
2
+ "compileOnSave" : false ,
3
+ "compilerOptions" : {
4
+ "outDir" : " ./dist/out-tsc" ,
5
+ "sourceMap" : true ,
6
+ "declaration" : false ,
7
+ "moduleResolution" : " node" ,
8
+ "emitDecoratorMetadata" : true ,
9
+ "experimentalDecorators" : true ,
10
+ "lib" : [
11
+ " es2016"
12
+ ]
13
+ }
14
+ }
Original file line number Diff line number Diff line change 94
94
},
95
95
"tsconfig" : {
96
96
"type" : " string" ,
97
- "default" : " tsconfig.json" ,
97
+ "default" : " tsconfig.app. json" ,
98
98
"description" : " The name of the TypeScript configuration file."
99
99
},
100
+ "testTsconfig" : {
101
+ "type" : " string" ,
102
+ "description" : " The name of the TypeScript configuration file for unit tests."
103
+ },
100
104
"prefix" : {
101
105
"type" : " string" ,
102
106
"description" : " The prefix to apply to generated selectors."
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ export class NgCliWebpackConfig {
106
106
107
107
public addAppConfigDefaults ( appConfig : any ) {
108
108
const appConfigDefaults : any = {
109
+ testTsconfig : appConfig . tsconfig ,
109
110
scripts : [ ] ,
110
111
styles : [ ]
111
112
} ;
You can’t perform that action at this time.
0 commit comments