Skip to content

Commit f0e6a69

Browse files
alan-agius4dgp1130
authored andcommittedApr 13, 2020
feat(@schematics/angular): update karma to 5.0.0
Related to: #17435
1 parent da7fbc6 commit f0e6a69

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed
 

‎packages/schematics/angular/migrations/migration-collection.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@
6363
"rename-browserslist-config": {
6464
"version": "10.0.0-beta.0",
6565
"factory": "./update-10/rename-browserslist-config",
66-
"description": "Renaming Browserslist configurations to '.browserslistrc'."
66+
"description": "Update Browserslist configurations to '.browserslistrc'."
67+
},
68+
"update-workspace-dependencies": {
69+
"version": "10.0.0-beta.1",
70+
"factory": "./update-10/update-dependencies",
71+
"description": "Workspace dependencies updates."
6772
}
6873
}
6974
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
import { Rule } from '@angular-devkit/schematics';
9+
import {
10+
addPackageJsonDependency,
11+
getPackageJsonDependency,
12+
} from '../../utility/dependencies';
13+
import { latestVersions } from '../../utility/latest-versions';
14+
15+
export default function (): Rule {
16+
return (host, context) => {
17+
const dependenciesToUpdate: Record<string, string> = {
18+
'karma': '~5.0.0',
19+
'ng-packagr': latestVersions.ngPackagr,
20+
};
21+
22+
for (const [name, version] of Object.entries(dependenciesToUpdate)) {
23+
const current = getPackageJsonDependency(host, name);
24+
if (!current || current.version === version) {
25+
continue;
26+
}
27+
28+
addPackageJsonDependency(host, {
29+
type: current.type,
30+
name,
31+
version,
32+
overwrite: true,
33+
});
34+
}
35+
36+
// Check for @angular-devkit/schematics and @angular-devkit/core
37+
for (const name of ['@angular-devkit/schematics', '@angular-devkit/core']) {
38+
const current = getPackageJsonDependency(host, name);
39+
if (current) {
40+
context.logger.info(
41+
`Package "${name}" found in the workspace package.json. ` +
42+
'This package typically does not need to be installed manually. ' +
43+
'If it is not being used by project code, it can be removed from the package.json.',
44+
);
45+
}
46+
}
47+
};
48+
}

‎packages/schematics/angular/workspace/files/package.json.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"codelyzer": "^5.1.2",
3434
"jasmine-core": "~3.5.0",
3535
"jasmine-spec-reporter": "~5.0.0",
36-
"karma": "~4.4.1",
36+
"karma": "~5.0.0",
3737
"karma-chrome-launcher": "~3.1.0",
3838
"karma-coverage-istanbul-reporter": "~2.1.0",
3939
"karma-jasmine": "~3.0.1",

0 commit comments

Comments
 (0)
Please sign in to comment.