fix(misc): fix @nrwl/nx-plugin migrations

This commit is contained in:
Victor Savkin 2021-02-06 14:27:37 -05:00
parent e55234f2eb
commit 285879c1e2
2 changed files with 12 additions and 11 deletions

View File

@ -1,10 +1,12 @@
import { Tree, readJson } from '@nrwl/devkit'; import { readJsonInTree } from '@nrwl/workspace';
export default function update(host: Tree) { export default function () {
const p = readJson(host, 'package.json'); return (host: any) => {
const p = readJsonInTree(host, 'package.json');
if (p['ng-update']) { if (p['ng-update']) {
p['nx-migrations'] = p['ng-update']; p['nx-migrations'] = p['ng-update'];
delete p['ng-update']; delete p['ng-update'];
} }
host.write('package.json', JSON.stringify(p, null, 2)); host.overwrite('package.json', JSON.stringify(p, null, 2));
};
} }

View File

@ -1,11 +1,10 @@
import { readJson } from '@nrwl/devkit';
import { basename } from 'path'; import { basename } from 'path';
import { visitNotIgnoredFiles } from '@nrwl/workspace'; import { visitNotIgnoredFiles, readJsonInTree } from '@nrwl/workspace';
export default function () { export default function () {
return visitNotIgnoredFiles((file, host) => { return visitNotIgnoredFiles((file, host) => {
if (basename(file) === 'schema.json') { if (basename(file) === 'schema.json') {
const p = readJson(host as any, file); const p = readJsonInTree(host as any, file);
if ( if (
p.$schema === 'https://json-schema.org/draft-07/schema' || p.$schema === 'https://json-schema.org/draft-07/schema' ||
p.$schema === 'http://json-schema.org/draft-07/schema' p.$schema === 'http://json-schema.org/draft-07/schema'