Skip to content

Commit

Permalink
feat(@schematics/angular): update karma to 5.0.0
Browse files Browse the repository at this point in the history
Related to: #17435
  • Loading branch information
alan-agius4 authored and dgp1130 committed Apr 13, 2020
1 parent da7fbc6 commit f0e6a69
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@
"rename-browserslist-config": {
"version": "10.0.0-beta.0",
"factory": "./update-10/rename-browserslist-config",
"description": "Renaming Browserslist configurations to '.browserslistrc'."
"description": "Update Browserslist configurations to '.browserslistrc'."
},
"update-workspace-dependencies": {
"version": "10.0.0-beta.1",
"factory": "./update-10/update-dependencies",
"description": "Workspace dependencies updates."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Rule } from '@angular-devkit/schematics';
import {
addPackageJsonDependency,
getPackageJsonDependency,
} from '../../utility/dependencies';
import { latestVersions } from '../../utility/latest-versions';

export default function (): Rule {
return (host, context) => {
const dependenciesToUpdate: Record<string, string> = {
'karma': '~5.0.0',
'ng-packagr': latestVersions.ngPackagr,
};

for (const [name, version] of Object.entries(dependenciesToUpdate)) {
const current = getPackageJsonDependency(host, name);
if (!current || current.version === version) {
continue;
}

addPackageJsonDependency(host, {
type: current.type,
name,
version,
overwrite: true,
});
}

// Check for @angular-devkit/schematics and @angular-devkit/core
for (const name of ['@angular-devkit/schematics', '@angular-devkit/core']) {
const current = getPackageJsonDependency(host, name);
if (current) {
context.logger.info(
`Package "${name}" found in the workspace package.json. ` +
'This package typically does not need to be installed manually. ' +
'If it is not being used by project code, it can be removed from the package.json.',
);
}
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~4.4.1",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~3.0.1",
Expand Down

0 comments on commit f0e6a69

Please sign in to comment.