Skip to content

Commit 9a2e35d

Browse files
authored
refactor: use typescript 2.1 for the CLI project itself. (angular#4890)
And use extends for its tsconfigs. Nothing of this changes whats published in npm.
1 parent 2abbce2 commit 9a2e35d

File tree

9 files changed

+29
-116
lines changed

9 files changed

+29
-116
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
"stylus": "^0.54.5",
9898
"stylus-loader": "^2.4.0",
9999
"temp": "0.8.3",
100-
"typescript": "~2.0.3",
100+
"typescript": "~2.1.0",
101101
"url-loader": "^0.5.7",
102102
"walk-sync": "^0.3.1",
103103
"webpack": "~2.2.0",

packages/@angular/cli/tsconfig.json

+3-27
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,13 @@
11
{
2+
"extends": "../../../tsconfig.json",
3+
24
"compilerOptions": {
3-
"declaration": true,
4-
"emitDecoratorMetadata": true,
5-
"experimentalDecorators": true,
6-
"mapRoot": "",
7-
"module": "commonjs",
8-
"moduleResolution": "node",
9-
"noEmitOnError": true,
10-
"noImplicitAny": true,
11-
"noUnusedParameters": true,
12-
"noUnusedLocals": true,
135
"outDir": "../../../dist/@angular/cli",
146
"rootDir": ".",
15-
"sourceMap": true,
16-
"sourceRoot": "/",
17-
"target": "es6",
18-
"lib": [
19-
"es2016"
20-
],
21-
"skipLibCheck": true,
22-
"typeRoots": [
23-
"../../../node_modules/@types"
24-
],
257
"baseUrl": "",
268
"paths": {
279
"@ngtools/json-schema": [ "../../../dist/@ngtools/json-schema/src" ],
2810
"@ngtools/webpack": [ "../../../dist/@ngtools/webpack/src" ]
2911
}
30-
},
31-
"include": [
32-
"**/*"
33-
],
34-
"exclude": [
35-
"blueprints/*/files/**/*"
36-
]
12+
}
3713
}
+3-26
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
11
{
2+
"extends": "../../../tsconfig.json",
3+
24
"compilerOptions": {
3-
"declaration": true,
4-
"experimentalDecorators": true,
5-
"mapRoot": "",
6-
"module": "commonjs",
7-
"moduleResolution": "node",
8-
"noEmitOnError": true,
9-
"noImplicitAny": true,
10-
"noUnusedParameters": true,
11-
"noUnusedLocals": true,
125
"outDir": "../../../dist/@ngtools/json-schema",
136
"rootDir": ".",
14-
"lib": [
15-
"es2016",
16-
"dom"
17-
],
18-
"target": "es6",
19-
"sourceMap": true,
20-
"sourceRoot": "/",
21-
"baseUrl": "./",
22-
"paths": {
23-
},
24-
"typeRoots": [
25-
"../../node_modules/@types"
26-
],
27-
"types": [
28-
"jasmine",
29-
"node"
30-
]
7+
"baseUrl": ""
318
}
329
}

packages/@ngtools/logger/src/console-logger-stack.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('ConsoleLoggerStack', () => {
1717
})
1818
.then(() => done(), (err: any) => done.fail(err));
1919

20-
console.debug('hello');
20+
(console as any).debug('hello');
2121
console.log('world');
2222
ConsoleLoggerStack.end();
2323
});

packages/@ngtools/logger/src/console-logger-stack.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ let originalConsoleError: (message?: any, ...optionalParams: any[]) => void;
99

1010
function _push(logger: Logger) {
1111
if (globalConsoleStack.length == 0) {
12-
originalConsoleDebug = console.debug;
12+
originalConsoleDebug = (console as any).debug; // Some environment (node) don't have debug.
1313
originalConsoleLog = console.log;
1414
originalConsoleWarn = console.warn;
1515
originalConsoleError = console.error;
1616

17-
console.debug = (msg: string, ...args: any[]) => {
17+
(console as any).debug = (msg: string, ...args: any[]) => {
1818
globalConsoleStack[globalConsoleStack.length - 1].debug(msg, { args });
1919
};
2020
console.log = (msg: string, ...args: any[]) => {
@@ -39,7 +39,7 @@ function _pop() {
3939
console.log = originalConsoleLog;
4040
console.warn = originalConsoleWarn;
4141
console.error = originalConsoleError;
42-
console.debug = originalConsoleDebug;
42+
(console as any).debug = originalConsoleDebug; // Some environment (node) don't have debug.
4343
globalConsoleStack = null;
4444
}
4545
}
+3-24
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,9 @@
11
{
2+
"extends": "../../../tsconfig.json",
3+
24
"compilerOptions": {
3-
"declaration": true,
4-
"experimentalDecorators": true,
5-
"mapRoot": "",
6-
"module": "commonjs",
7-
"moduleResolution": "node",
8-
"noEmitOnError": true,
9-
"noImplicitAny": true,
10-
"noUnusedParameters": true,
11-
"noUnusedLocals": true,
125
"outDir": "../../../dist/@ngtools/logger",
136
"rootDir": ".",
14-
"lib": [
15-
"es2016",
16-
"dom"
17-
],
18-
"target": "es6",
19-
"sourceMap": true,
20-
"sourceRoot": "/",
21-
"baseUrl": ".",
22-
"typeRoots": [
23-
"../../node_modules/@types"
24-
],
25-
"types": [
26-
"jasmine",
27-
"node"
28-
]
7+
"baseUrl": ""
298
}
309
}

packages/@ngtools/webpack/src/lazy_routes.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ export function findLazyRoutes(filePath: string,
4747
.map((routePath: string) => {
4848
const moduleName = routePath.split('#')[0];
4949
const resolvedModuleName: ts.ResolvedModuleWithFailedLookupLocations = moduleName[0] == '.'
50-
? { resolvedModule: { resolvedFileName: join(dirname(filePath), moduleName) + '.ts' },
51-
failedLookupLocations: [] }
50+
? ({
51+
resolvedModule: { resolvedFileName: join(dirname(filePath), moduleName) + '.ts' }
52+
} as any)
5253
: ts.resolveModuleName(moduleName, filePath, program.getCompilerOptions(), host);
5354
if (resolvedModuleName.resolvedModule
5455
&& resolvedModuleName.resolvedModule.resolvedFileName
+3-26
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,9 @@
11
{
2+
"extends": "../../../tsconfig.json",
3+
24
"compilerOptions": {
3-
"declaration": true,
4-
"experimentalDecorators": true,
5-
"mapRoot": "",
6-
"module": "commonjs",
7-
"moduleResolution": "node",
8-
"noEmitOnError": true,
9-
"noImplicitAny": true,
10-
"noUnusedParameters": true,
11-
"noUnusedLocals": true,
125
"outDir": "../../../dist/@ngtools/webpack",
136
"rootDir": ".",
14-
"lib": [
15-
"es2016",
16-
"dom"
17-
],
18-
"target": "es6",
19-
"sourceMap": true,
20-
"sourceRoot": "/",
21-
"baseUrl": "./",
22-
"paths": {
23-
},
24-
"typeRoots": [
25-
"../../node_modules/@types"
26-
],
27-
"types": [
28-
"jasmine",
29-
"node"
30-
]
7+
"baseUrl": ""
318
}
329
}

tsconfig.json

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"compilerOptions": {
3+
"declaration": true,
4+
"emitDecoratorMetadata": true,
35
"experimentalDecorators": true,
46
"mapRoot": "",
57
"module": "commonjs",
@@ -10,12 +12,14 @@
1012
"noUnusedLocals": true,
1113
"outDir": "./dist",
1214
"rootDir": ".",
15+
"skipLibCheck": true,
1316
"sourceMap": true,
1417
"sourceRoot": "",
15-
"inlineSourceMap": true,
1618
"target": "es6",
1719
"lib": [
18-
"es2016"
20+
"es2015",
21+
"es2016",
22+
"es2017"
1923
],
2024
"baseUrl": "",
2125
"typeRoots": [
@@ -26,10 +30,9 @@
2630
"node"
2731
],
2832
"paths": {
29-
"@angular/cli/*": [ "./packages/@angular/cli/*" ],
30-
"@ngtools/json-schema": [ "./packages/json-schema/src" ],
31-
"@ngtools/logger": [ "./packages/logger/src" ],
32-
"@ngtools/webpack": [ "./packages/webpack/src" ]
33+
"@ngtools/json-schema": [ "packages/@ngtools/json-schema/src" ],
34+
"@ngtools/logger": [ "./packages/@ngtools/logger/src" ],
35+
"@ngtools/webpack": [ "./packages/@ngtools/webpack/src" ]
3336
}
3437
},
3538
"exclude": [

0 commit comments

Comments
 (0)