Skip to content

Commit

Permalink
fix(nx): use semver for version range comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonroberts authored and vsavkin committed Sep 11, 2019
1 parent d5b4453 commit 88512c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
updateJsonInTree
} from '@nrwl/workspace';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import { gt } from 'semver';

function updateCLI() {
const tasks: TaskId[] = [];
Expand All @@ -14,13 +15,7 @@ function updateCLI() {
json.devDependencies = json.devDependencies || {};
const cliVersion = json.devDependencies['@angular/cli'];

if (
cliVersion &&
(cliVersion > 8.1 ||
cliVersion.startsWith('8.1') ||
cliVersion.startsWith('~8.1') ||
cliVersion.startsWith('^8.1'))
) {
if (cliVersion && gt(cliVersion, '8.1.1')) {
return json;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
updateJsonInTree
} from '@nrwl/workspace';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import { gt } from 'semver';

const updateAngular = addUpdateTask('@angular/core', '8.2.4');

Expand All @@ -16,13 +17,7 @@ function updateCLI() {
json.devDependencies = json.devDependencies || {};
const cliVersion = json.devDependencies['@angular/cli'];

if (
cliVersion &&
(cliVersion > 8.3 ||
cliVersion.startsWith('8.3') ||
cliVersion.startsWith('~8.3') ||
cliVersion.startsWith('^8.3'))
) {
if (cliVersion && gt(cliVersion, '8.3.3')) {
return json;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { updateJsonInTree } from '@nrwl/workspace';
import { chain, SchematicContext } from '@angular-devkit/schematics';
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
import { gt } from 'semver';

const updateCLI = updateJsonInTree('package.json', json => {
json.devDependencies = json.devDependencies || {};
const cliVersion = json.devDependencies['@angular/cli'];

if (
cliVersion &&
(cliVersion > 8.1 ||
cliVersion.startsWith('8.1') ||
cliVersion.startsWith('~8.1') ||
cliVersion.startsWith('^8.1'))
) {
if (cliVersion && gt(cliVersion, '8.1.1')) {
return json;
}

Expand Down

0 comments on commit 88512c2

Please sign in to comment.