Skip to content

Commit

Permalink
fix(repo): add migration for cli dependency (nrwl#3820)
Browse files Browse the repository at this point in the history
Migration for 21bbd1e.
  • Loading branch information
bekos authored Sep 28, 2020
1 parent bfc2f6f commit 01d8c98
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/workspace/migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
"version": "10.1.0-beta.0",
"description": "Migrate .eslintrc files to use tsconfig with a wildcard",
"factory": "./src/migrations/update-10-1-0/migrate-eslintrc-tsconfig-wildcard"
},
"add-cli-dependency": {
"version": "10.3.0-beta.0",
"description": "Add @nrwl/cli as dependency",
"factory": "./src/migrations/update-10-3-0/add-cli-dependency"
}
},
"packageJsonUpdates": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Tree } from '@angular-devkit/schematics';
import { callRule, runMigration } from '../../utils/testing';
import { readJsonInTree, serializeJson } from '@nrwl/workspace';
import { nxVersion } from '../../../src/utils/versions';

describe('CLI dependency migration', () => {
let tree: Tree;

beforeEach(async () => {
tree = Tree.empty();
tree.create(
'package.json',
serializeJson({
devDependencies: {},
})
);
});

it.only('should add @nrwl/cli to package.json', async () => {
const result = await runMigration('add-cli-dependency', {}, tree);
const packageJson = readJsonInTree(result, 'package.json');
expect(packageJson.devDependencies['@nrwl/cli']).toEqual(nxVersion);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { chain, Rule } from '@angular-devkit/schematics';
import { formatFiles, addDepsToPackageJson } from '@nrwl/workspace';
import { nxVersion } from '../../../src/utils/versions';

export default function update(): Rule {
return chain([
addDepsToPackageJson({}, { '@nrwl/cli': nxVersion }),
formatFiles(),
]);
}

0 comments on commit 01d8c98

Please sign in to comment.