Skip to content

Commit 28f87cb

Browse files
alan-agius4dgp1130
authored andcommittedMay 7, 2020
refactor(@angular/cli): remove deprecated typescriptMismatch
BREAKING CHANGE: Removed deprecated `typescriptMismatch` warning option. Users will be migrated off this option automatically. Users wishing to disable TypeScript version checks should use the Angular compiler option `disableTypeScriptVersionCheck`, see https://angular.io/guide/angular-compiler-options#disabletypescriptversioncheck for more information.
1 parent 017e932 commit 28f87cb

File tree

6 files changed

+43
-54
lines changed

6 files changed

+43
-54
lines changed
 

‎packages/angular/cli/commands/config-impl.ts

-16
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,6 @@ export class ConfigCommand extends Command<ConfigCommandSchema> {
243243
private get(config: experimental.workspace.WorkspaceSchema, options: ConfigCommandSchema) {
244244
let value;
245245
if (options.jsonPath) {
246-
if (options.jsonPath === 'cli.warnings.typescriptMismatch') {
247-
// NOTE: Remove this in 9.0.
248-
this.logger.warn('The "typescriptMismatch" warning has been removed in 8.0.');
249-
// Since there is no actual warning, this value is always false.
250-
this.logger.info('false');
251-
252-
return 0;
253-
}
254-
255246
value = getValueFromPath((config as {}) as JsonObject, options.jsonPath);
256247
} else {
257248
value = config;
@@ -275,13 +266,6 @@ export class ConfigCommand extends Command<ConfigCommandSchema> {
275266
throw new Error('Invalid Path.');
276267
}
277268

278-
if (options.jsonPath === 'cli.warnings.typescriptMismatch') {
279-
// NOTE: Remove this in 9.0.
280-
this.logger.warn('The "typescriptMismatch" warning has been removed in 8.0.');
281-
282-
return 0;
283-
}
284-
285269
if (
286270
options.global &&
287271
!options.jsonPath.startsWith('schematics.') &&

‎packages/angular/cli/lib/config/schema.json

-15
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@
5858
"versionMismatch": {
5959
"description": "Show a warning when the global version is newer than the local one.",
6060
"type": "boolean"
61-
},
62-
"typescriptMismatch": {
63-
"description": "Show a warning when the TypeScript version is incompatible.",
64-
"type": "boolean",
65-
"x-deprecated": true
6661
}
6762
}
6863
},
@@ -1783,16 +1778,6 @@
17831778
}
17841779
]
17851780
},
1786-
"vendorChunk": {
1787-
"type": "boolean",
1788-
"description": "Use a separate bundle containing only vendor libraries.",
1789-
"default": true
1790-
},
1791-
"commonChunk": {
1792-
"type": "boolean",
1793-
"description": "Use a separate bundle containing code used across multiple bundles.",
1794-
"default": true
1795-
},
17961781
"verbose": {
17971782
"type": "boolean",
17981783
"description": "Adds more details to output logging.",

‎packages/angular/cli/models/command-runner.ts

-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
strings,
1616
tags,
1717
} from '@angular-devkit/core';
18-
import * as debug from 'debug';
1918
import { readFileSync } from 'fs';
2019
import { join, resolve } from 'path';
2120
import { parseJsonSchemaToCommandDescription } from '../utilities/json-schema';
@@ -30,8 +29,6 @@ import { Command } from './command';
3029
import { CommandDescription, CommandWorkspace } from './interface';
3130
import * as parser from './parser';
3231

33-
const analyticsDebug = debug('ng:analytics:commands');
34-
3532
// NOTE: Update commands.json if changing this. It's still deep imported in one CI validation
3633
const standardCommands = {
3734
'add': '../commands/add.json',

‎packages/schematics/angular/migrations/update-10/update-angular-config.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import { workspaces } from '@angular-devkit/core';
9+
import { JsonObject, JsonValue, isJsonObject, workspaces } from '@angular-devkit/core';
1010
import { Rule } from '@angular-devkit/schematics';
1111
import { updateWorkspace } from '../../utility/workspace';
1212
import { Builders, ProjectType } from '../../utility/workspace-models';
1313

1414
export default function (): Rule {
1515
return updateWorkspace(workspace => {
16+
// Remove deprecated CLI root level options
17+
removeDeprecatedCLIOptions(workspace.extensions);
18+
1619
for (const [, project] of workspace.projects) {
20+
// Project level
21+
removeDeprecatedCLIOptions(project.extensions);
22+
1723
if (project.extensions.projectType !== ProjectType.Application) {
1824
// Only interested in application projects since these changes only effects application builders
1925
continue;
@@ -104,3 +110,13 @@ function updateVendorSourceMap(options: TargetOptions): TargetOptions {
104110
vendorSourceMap: undefined,
105111
};
106112
}
113+
114+
function removeDeprecatedCLIOptions(extensions: Record<string, JsonValue | undefined>) {
115+
const cliOptions = extensions?.cli;
116+
if (cliOptions && isJsonObject(cliOptions) && isJsonObject(cliOptions.warnings)) {
117+
(cliOptions.warnings as Partial<JsonObject>) = {
118+
...cliOptions.warnings,
119+
typescriptMismatch: undefined,
120+
};
121+
}
122+
}

‎packages/schematics/angular/migrations/update-10/update-angular-config_spec.ts

+26
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,20 @@ function getBuildTarget(tree: UnitTestTree): BuilderTarget<Builders.Browser, Jso
1717
function createWorkSpaceConfig(tree: UnitTestTree) {
1818
const angularConfig: WorkspaceSchema = {
1919
version: 1,
20+
cli: {
21+
warnings: {
22+
versionMismatch: false,
23+
typescriptMismatch: true,
24+
},
25+
},
2026
projects: {
2127
app: {
28+
cli: {
29+
warnings: {
30+
versionMismatch: false,
31+
typescriptMismatch: true,
32+
},
33+
},
2234
root: '',
2335
sourceRoot: 'src',
2436
projectType: ProjectType.Application,
@@ -120,4 +132,18 @@ describe(`Migration to update 'angular.json'`, () => {
120132
styles: false,
121133
});
122134
});
135+
136+
it(`should remove root level 'typescriptMismatch'`, async () => {
137+
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
138+
const config = JSON.parse(newTree.readContent('/angular.json')).cli.warnings;
139+
expect(config.typescriptMismatch).toBeUndefined();
140+
expect(config.versionMismatch).toBeFalse();
141+
});
142+
143+
it(`should remove project level 'typescriptMismatch'`, async () => {
144+
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
145+
const config = JSON.parse(newTree.readContent('/angular.json')).projects.app.cli.warnings;
146+
expect(config.typescriptMismatch).toBeUndefined();
147+
expect(config.versionMismatch).toBeFalse();
148+
});
123149
});

‎packages/schematics/angular/utility/config.ts

-19
Original file line numberDiff line numberDiff line change
@@ -455,26 +455,7 @@ export interface CliConfig {
455455
* Allow people to disable console warnings.
456456
*/
457457
warnings?: {
458-
/**
459-
* Show a warning when the user enabled the --hmr option.
460-
*/
461-
hmrWarning?: boolean;
462-
/**
463-
* Show a warning when the node version is incompatible.
464-
*/
465-
nodeDeprecation?: boolean;
466-
/**
467-
* Show a warning when the user installed angular-cli.
468-
*/
469-
packageDeprecation?: boolean;
470-
/**
471-
* Show a warning when the global version is newer than the local one.
472-
*/
473458
versionMismatch?: boolean;
474-
/**
475-
* Show a warning when the TypeScript version is incompatible
476-
*/
477-
typescriptMismatch?: boolean;
478459
};
479460
}
480461

0 commit comments

Comments
 (0)
Please sign in to comment.