-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@angular/cli): use separate tsconfigs
This PR adds tsconfigs for each separate application: - `src/tsconfig.app.json`: configuration for the Angular app. - `src/tsconfig.spec.json`: configuration for the unit tests. Defaults to the Angular app config. - `e2e/tsconfig.e2e.json`: configuration for the e2e tests. There is an additional root-level `tsconfig.json` that is used for editor integration. For Angular version 4 projects, these tsconfigs will use inheritance since it's available with TypeScript 2.1. This is not a breaking change. Existing projects should not be affected.
- Loading branch information
1 parent
1e30159
commit 69e6c71
Showing
14 changed files
with
171 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/@angular/cli/blueprints/ng2/files/__path__/tsconfig.app.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{<% if (ng4) { %> | ||
"extends": "<%= relativeRootPath %>/tsconfig.json", | ||
"compilerOptions": { | ||
"lib": [ | ||
"es2016", | ||
"dom" | ||
],<% } else { %> | ||
"compilerOptions": { | ||
"sourceMap": true, | ||
"declaration": false, | ||
"moduleResolution": "node", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"lib": [ | ||
"es2016", | ||
"dom" | ||
],<% } %> | ||
"outDir": "<%= relativeRootPath %>/out-tsc/app", | ||
"target": "es5", | ||
"module": "es2015", | ||
"baseUrl": "", | ||
"types": [] | ||
}, | ||
"exclude": [ | ||
"test.ts", | ||
"**/*.spec.ts" | ||
] | ||
} |
21 changes: 0 additions & 21 deletions
21
packages/@angular/cli/blueprints/ng2/files/__path__/tsconfig.json
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
packages/@angular/cli/blueprints/ng2/files/__path__/tsconfig.spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{<% if (ng4) { %> | ||
"extends": "<%= relativeRootPath %>/tsconfig.json", | ||
"compilerOptions": {<% } else { %> | ||
"compilerOptions": { | ||
"sourceMap": true, | ||
"declaration": false, | ||
"moduleResolution": "node", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"lib": [ | ||
"es2016" | ||
],<% } %> | ||
"outDir": "<%= relativeRootPath %>/out-tsc/spec", | ||
"module": "commonjs", | ||
"target": "es6", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
filipesilva
Author
Contributor
|
||
"baseUrl": "", | ||
"types": [ | ||
"jasmine", | ||
"node" | ||
] | ||
}, | ||
"files": [ | ||
"test.ts" | ||
], | ||
"include": [ | ||
"**/*.spec.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
...li/blueprints/ng2/files/e2e/tsconfig.json → ...lueprints/ng2/files/e2e/tsconfig.e2e.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
{ | ||
"compileOnSave": false, | ||
{<% if (ng4) { %> | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": {<% } else { %> | ||
"compilerOptions": { | ||
"sourceMap": true, | ||
"declaration": false, | ||
"moduleResolution": "node", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"lib": [ | ||
"es2016" | ||
], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
],<% } %> | ||
"outDir": "../dist/out-tsc-e2e", | ||
"sourceMap": true, | ||
"module": "commonjs", | ||
"target": "es6", | ||
"typeRoots": [ | ||
"../node_modules/@types" | ||
"types":[ | ||
"jasmine", | ||
"node" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"compileOnSave": false, | ||
"compilerOptions": { | ||
"outDir": "./dist/out-tsc", | ||
"sourceMap": true, | ||
"declaration": false, | ||
"moduleResolution": "node", | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"lib": [ | ||
"es2016" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ng } from '../../../utils/process'; | ||
import { writeFile, moveFile } from '../../../utils/fs'; | ||
import { updateJsonFile } from '../../../utils/project'; | ||
import { getGlobalVariable } from '../../../utils/env'; | ||
|
||
export default function () { | ||
// Disable parts of it in webpack tests. | ||
const ejected = getGlobalVariable('argv').eject; | ||
|
||
// Check if **/*.spec.ts files are excluded by default. | ||
return Promise.resolve() | ||
// This import would cause aot to fail. | ||
.then(() => writeFile('src/another.component.spec.ts', ` | ||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; | ||
`)) | ||
.then(() => ng('build', '--aot')) | ||
// Verify backwards compatibility with old project using the shared tsconfig. | ||
.then(() => moveFile('src/tsconfig.app.json', 'src/tsconfig.json')) | ||
.then(() => updateJsonFile('.angular-cli.json', configJson => { | ||
const app = configJson['apps'][0]; | ||
app.tsconfig = 'tsconfig.json'; | ||
delete app['testTsconfig']; | ||
})) | ||
.then(() => updateJsonFile('src/tsconfig.json', tsconfigJson => { | ||
delete tsconfigJson['exclude']; | ||
})) | ||
.then(() => ng('build', '--aot')) | ||
.then(() => !ejected && ng('test', '--single-run')); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Why es6 here? it breaks e.g. phantomJS