fix(misc): add formatting to all migrations
This commit is contained in:
parent
5f0886add9
commit
09c4654ae9
@ -64,5 +64,5 @@ function updateNgrx(updateDeps: TaskId[]) {
|
|||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
const { rule: updateCLIRule, tasks } = updateCLI();
|
const { rule: updateCLIRule, tasks } = updateCLI();
|
||||||
return chain([updateCLIRule, updateNgrx(tasks)]);
|
return chain([updateCLIRule, updateNgrx(tasks), formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,5 +66,10 @@ function updateNgrx(updateDeps: TaskId[]) {
|
|||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
const { rule: updateCLIRule, tasks } = updateCLI();
|
const { rule: updateCLIRule, tasks } = updateCLI();
|
||||||
return chain([updateAngular, updateCLIRule, updateNgrx(tasks)]);
|
return chain([
|
||||||
|
updateAngular,
|
||||||
|
updateCLIRule,
|
||||||
|
updateNgrx(tasks),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +1,29 @@
|
|||||||
import { updateJsonInTree } from '@nrwl/workspace';
|
import { formatFiles, updateJsonInTree } from '@nrwl/workspace';
|
||||||
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
||||||
|
import { chain } from '@angular-devkit/schematics';
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return updateJsonInTree('package.json', (json, context) => {
|
return chain([
|
||||||
json.scripts = json.scripts || {};
|
updateJsonInTree('package.json', (json, context) => {
|
||||||
if (json.scripts.postinstall) {
|
json.scripts = json.scripts || {};
|
||||||
context.logger.warn(
|
if (json.scripts.postinstall) {
|
||||||
stripIndents`
|
context.logger.warn(
|
||||||
|
stripIndents`
|
||||||
---------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------
|
||||||
Angular Ivy requires you to run ngcc after every npm install.
|
Angular Ivy requires you to run ngcc after every npm install.
|
||||||
The easiest way to accomplish this is to update your postinstall script to invoke ngcc.
|
The easiest way to accomplish this is to update your postinstall script to invoke ngcc.
|
||||||
---------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
context.logger.info(
|
context.logger.info(
|
||||||
stripIndents`A "postinstall" script has been added to package.json to run ngcc.`
|
stripIndents`A "postinstall" script has been added to package.json to run ngcc.`
|
||||||
);
|
);
|
||||||
json.scripts.postinstall =
|
json.scripts.postinstall =
|
||||||
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points';
|
'ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points';
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
});
|
}),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { chain, SchematicContext } from '@angular-devkit/schematics';
|
import { chain, SchematicContext } from '@angular-devkit/schematics';
|
||||||
import { addUpdateTask } from '@nrwl/workspace';
|
import { addUpdateTask, formatFiles } from '@nrwl/workspace';
|
||||||
import { RunSchematicTask } from '@angular-devkit/schematics/tasks';
|
import { RunSchematicTask } from '@angular-devkit/schematics/tasks';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
@ -14,7 +14,8 @@ export default function() {
|
|||||||
);
|
);
|
||||||
return chain([
|
return chain([
|
||||||
addUpdateTask('@angular/core', '9.0.0', [postInstallTask]),
|
addUpdateTask('@angular/core', '9.0.0', [postInstallTask]),
|
||||||
addUpdateTask('@angular/cli', '9.0.1', [postInstallTask])
|
addUpdateTask('@angular/cli', '9.0.1', [postInstallTask]),
|
||||||
|
formatFiles()
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import {
|
|||||||
SchematicContext,
|
SchematicContext,
|
||||||
Tree
|
Tree
|
||||||
} from '@angular-devkit/schematics';
|
} from '@angular-devkit/schematics';
|
||||||
import { updateJsonInTree } from '@nrwl/workspace';
|
import { formatFiles, updateJsonInTree } from '@nrwl/workspace';
|
||||||
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
||||||
|
|
||||||
function displayInformation(host: Tree, context: SchematicContext) {
|
function displayInformation(host: Tree, context: SchematicContext) {
|
||||||
@ -28,6 +28,7 @@ export default function(): Rule {
|
|||||||
|
|
||||||
return json;
|
return json;
|
||||||
}),
|
}),
|
||||||
displayInformation
|
displayInformation,
|
||||||
|
formatFiles()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
|
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
import { chain } from '@angular-devkit/schematics';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return updatePackagesInPackageJson(
|
return chain([
|
||||||
join(__dirname, '../../../migrations.json'),
|
updatePackagesInPackageJson(
|
||||||
'8.10.0'
|
join(__dirname, '../../../migrations.json'),
|
||||||
);
|
'8.10.0'
|
||||||
|
),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
|
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
import { chain } from '@angular-devkit/schematics';
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
return updatePackagesInPackageJson(
|
return chain([
|
||||||
join(__dirname, '../../../migrations.json'),
|
updatePackagesInPackageJson(
|
||||||
'8.12.0'
|
join(__dirname, '../../../migrations.json'),
|
||||||
);
|
'8.12.0'
|
||||||
|
),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updateWorkspace } from '@nrwl/workspace/src/utils/workspace';
|
import { updateWorkspace } from '@nrwl/workspace/src/utils/workspace';
|
||||||
|
import { formatFiles } from '@nrwl/workspace';
|
||||||
|
|
||||||
const convertToArray = updateWorkspace(workspace => {
|
const convertToArray = updateWorkspace(workspace => {
|
||||||
workspace.projects.forEach(project => {
|
workspace.projects.forEach(project => {
|
||||||
@ -16,5 +17,5 @@ const convertToArray = updateWorkspace(workspace => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function(): Rule {
|
export default function(): Rule {
|
||||||
return convertToArray;
|
return chain([convertToArray, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updatePackagesInPackageJson(
|
return chain([
|
||||||
path.join(__dirname, '../../../', 'migrations.json'),
|
updatePackagesInPackageJson(
|
||||||
'8.7.0'
|
path.join(__dirname, '../../../', 'migrations.json'),
|
||||||
);
|
'8.7.0'
|
||||||
|
),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updatePackagesInPackageJson(
|
return chain([
|
||||||
path.join(__dirname, '../../../', 'migrations.json'),
|
updatePackagesInPackageJson(
|
||||||
'8.10.0'
|
path.join(__dirname, '../../../', 'migrations.json'),
|
||||||
);
|
'8.10.0'
|
||||||
|
),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,10 @@ describe('create-next-config-9.2.0', () => {
|
|||||||
|
|
||||||
// Creates config for Next apps
|
// Creates config for Next apps
|
||||||
const content = tree.read('apps/demo1/next.config.js').toString();
|
const content = tree.read('apps/demo1/next.config.js').toString();
|
||||||
expect(content).toContain('withStylus(withLess(withSass(withCSS({');
|
expect(content).toContain('withStylus(');
|
||||||
|
expect(content).toContain('withLess(');
|
||||||
|
expect(content).toContain('withSass(');
|
||||||
|
expect(content).toContain('withCSS(');
|
||||||
|
|
||||||
// Doesn't create config for non-Next apps
|
// Doesn't create config for non-Next apps
|
||||||
expect(tree.exists('apps/demo2/next.config.js')).toBe(false);
|
expect(tree.exists('apps/demo2/next.config.js')).toBe(false);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Rule, Tree } from '@angular-devkit/schematics';
|
import { chain, Rule, Tree } from '@angular-devkit/schematics';
|
||||||
import { readWorkspace } from '@nrwl/workspace';
|
import { formatFiles, readWorkspace } from '@nrwl/workspace';
|
||||||
import { CONFIG_FILE } from 'next/dist/next-server/lib/constants';
|
import { CONFIG_FILE } from 'next/dist/next-server/lib/constants';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
@ -23,22 +23,25 @@ module.exports = withStylus(withLess(withSass(withCSS({
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return (host: Tree) => {
|
return chain([
|
||||||
const workspaceJson = readWorkspace(host);
|
(host: Tree) => {
|
||||||
const nextProjects = Object.keys(workspaceJson.projects)
|
const workspaceJson = readWorkspace(host);
|
||||||
.map(name => {
|
const nextProjects = Object.keys(workspaceJson.projects)
|
||||||
const p = workspaceJson.projects[name];
|
.map(name => {
|
||||||
const buildBuilder =
|
const p = workspaceJson.projects[name];
|
||||||
p.architect && p.architect.build && p.architect.build.builder;
|
const buildBuilder =
|
||||||
return buildBuilder === '@nrwl/next:build' ? p : null;
|
p.architect && p.architect.build && p.architect.build.builder;
|
||||||
})
|
return buildBuilder === '@nrwl/next:build' ? p : null;
|
||||||
.filter(Boolean);
|
})
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
nextProjects.forEach(p => {
|
nextProjects.forEach(p => {
|
||||||
const configPath = join(p.root, CONFIG_FILE);
|
const configPath = join(p.root, CONFIG_FILE);
|
||||||
if (!host.exists(configPath)) {
|
if (!host.exists(configPath)) {
|
||||||
host.create(configPath, defaultConfig);
|
host.create(configPath, defaultConfig);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
},
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,26 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updateWorkspaceInTree } from '@nrwl/workspace';
|
import { formatFiles, updateWorkspaceInTree } from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updateWorkspaceInTree(workspaceJson => {
|
return chain([
|
||||||
Object.entries<any>(workspaceJson.projects).forEach(
|
updateWorkspaceInTree(workspaceJson => {
|
||||||
([projectName, project]) => {
|
Object.entries<any>(workspaceJson.projects).forEach(
|
||||||
Object.entries<any>(project.architect).forEach(
|
([projectName, project]) => {
|
||||||
([targetName, targetConfig]) => {
|
Object.entries<any>(project.architect).forEach(
|
||||||
if (targetConfig.builder === '@nrwl/node:build') {
|
([targetName, targetConfig]) => {
|
||||||
const architect =
|
if (targetConfig.builder === '@nrwl/node:build') {
|
||||||
workspaceJson.projects[projectName].architect[targetName];
|
const architect =
|
||||||
if (architect && architect.options) {
|
workspaceJson.projects[projectName].architect[targetName];
|
||||||
architect.options.buildLibsFromSource = true;
|
if (architect && architect.options) {
|
||||||
|
architect.options.buildLibsFromSource = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
}
|
||||||
}
|
);
|
||||||
);
|
return workspaceJson;
|
||||||
return workspaceJson;
|
}),
|
||||||
});
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import {
|
|||||||
Tree
|
Tree
|
||||||
} from '@angular-devkit/schematics';
|
} from '@angular-devkit/schematics';
|
||||||
import {
|
import {
|
||||||
|
formatFiles,
|
||||||
offsetFromRoot,
|
offsetFromRoot,
|
||||||
readWorkspace,
|
readWorkspace,
|
||||||
updateJsonInTree,
|
updateJsonInTree,
|
||||||
@ -45,8 +46,8 @@ function displayInformation(host: Tree, context: SchematicContext) {
|
|||||||
|
|
||||||
function addCustomTypings(host: Tree) {
|
function addCustomTypings(host: Tree) {
|
||||||
const workspace = readWorkspace(host);
|
const workspace = readWorkspace(host);
|
||||||
return chain(
|
return chain([
|
||||||
Object.keys(workspace.projects).map(k => {
|
...Object.keys(workspace.projects).map(k => {
|
||||||
const p = workspace.projects[k];
|
const p = workspace.projects[k];
|
||||||
if (p.projectType !== 'application') {
|
if (p.projectType !== 'application') {
|
||||||
return noop();
|
return noop();
|
||||||
@ -68,8 +69,9 @@ function addCustomTypings(host: Tree) {
|
|||||||
} else {
|
} else {
|
||||||
return noop();
|
return noop();
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
);
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateBuilderWebpackOption(json) {
|
function updateBuilderWebpackOption(json) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { chain, noop, Rule, Tree } from '@angular-devkit/schematics';
|
import { chain, noop, Rule, Tree } from '@angular-devkit/schematics';
|
||||||
import { readWorkspace, updateJsonInTree } from '@nrwl/workspace';
|
import { formatFiles, readWorkspace, updateJsonInTree } from '@nrwl/workspace';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
const ignore = require('ignore');
|
const ignore = require('ignore');
|
||||||
@ -7,8 +7,8 @@ const ignore = require('ignore');
|
|||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return (host: Tree) => {
|
return (host: Tree) => {
|
||||||
const workspace = readWorkspace(host);
|
const workspace = readWorkspace(host);
|
||||||
return chain(
|
return chain([
|
||||||
Object.keys(workspace.projects).map(k => {
|
...Object.keys(workspace.projects).map(k => {
|
||||||
const p = workspace.projects[k];
|
const p = workspace.projects[k];
|
||||||
if (p.projectType !== 'application') {
|
if (p.projectType !== 'application') {
|
||||||
return noop();
|
return noop();
|
||||||
@ -23,8 +23,9 @@ export default function update(): Rule {
|
|||||||
} else {
|
} else {
|
||||||
return noop();
|
return noop();
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
);
|
formatFiles()
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,17 @@
|
|||||||
import { chain, Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { addDepsToPackageJson, updateWorkspaceInTree } from '@nrwl/workspace';
|
import {
|
||||||
|
addDepsToPackageJson,
|
||||||
|
formatFiles,
|
||||||
|
updateWorkspaceInTree
|
||||||
|
} from '@nrwl/workspace';
|
||||||
|
|
||||||
const ignore = require('ignore');
|
const ignore = require('ignore');
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return chain([
|
return chain([
|
||||||
updateWorkspaceInTree(updateBuilderWebpackOption),
|
updateWorkspaceInTree(updateBuilderWebpackOption),
|
||||||
addDepsToPackageJson({}, { '@babel/preset-react': '7.8.3' })
|
addDepsToPackageJson({}, { '@babel/preset-react': '7.8.3' }),
|
||||||
|
formatFiles()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updatePackagesInPackageJson(
|
return chain([
|
||||||
path.join(__dirname, '../../../', 'migrations.json'),
|
updatePackagesInPackageJson(
|
||||||
'8.12.0'
|
path.join(__dirname, '../../../', 'migrations.json'),
|
||||||
);
|
'8.12.0'
|
||||||
|
),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,27 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updateWorkspaceInTree } from '@nrwl/workspace';
|
import { formatFiles, updateWorkspaceInTree } from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updateWorkspaceInTree(config => {
|
return chain([
|
||||||
const a = [];
|
updateWorkspaceInTree(config => {
|
||||||
const b = [];
|
const a = [];
|
||||||
Object.keys(config.schematics).forEach(name => {
|
const b = [];
|
||||||
if (name === '@nrwl/react' && config.schematics[name].application) {
|
Object.keys(config.schematics).forEach(name => {
|
||||||
a.push(config.schematics[name]);
|
if (name === '@nrwl/react' && config.schematics[name].application) {
|
||||||
}
|
a.push(config.schematics[name]);
|
||||||
if (name === '@nrwl/react:application') {
|
}
|
||||||
b.push(config.schematics[name]);
|
if (name === '@nrwl/react:application') {
|
||||||
}
|
b.push(config.schematics[name]);
|
||||||
});
|
}
|
||||||
a.forEach(x => {
|
});
|
||||||
delete x.application.babel;
|
a.forEach(x => {
|
||||||
});
|
delete x.application.babel;
|
||||||
b.forEach(x => {
|
});
|
||||||
delete x.babel;
|
b.forEach(x => {
|
||||||
});
|
delete x.babel;
|
||||||
return config;
|
});
|
||||||
});
|
return config;
|
||||||
|
}),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,11 @@ import {
|
|||||||
SchematicContext,
|
SchematicContext,
|
||||||
Tree
|
Tree
|
||||||
} from '@angular-devkit/schematics';
|
} from '@angular-devkit/schematics';
|
||||||
import { readJsonInTree, updatePackagesInPackageJson } from '@nrwl/workspace';
|
import {
|
||||||
|
formatFiles,
|
||||||
|
readJsonInTree,
|
||||||
|
updatePackagesInPackageJson
|
||||||
|
} from '@nrwl/workspace';
|
||||||
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
@ -14,7 +18,8 @@ export default function update(): Rule {
|
|||||||
updatePackagesInPackageJson(
|
updatePackagesInPackageJson(
|
||||||
path.join(__dirname, '../../../', 'migrations.json'),
|
path.join(__dirname, '../../../', 'migrations.json'),
|
||||||
'8.7.0'
|
'8.7.0'
|
||||||
)
|
),
|
||||||
|
formatFiles()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import {
|
|||||||
Tree
|
Tree
|
||||||
} from '@angular-devkit/schematics';
|
} from '@angular-devkit/schematics';
|
||||||
import {
|
import {
|
||||||
|
formatFiles,
|
||||||
insert,
|
insert,
|
||||||
readJsonInTree,
|
readJsonInTree,
|
||||||
updateJsonInTree,
|
updateJsonInTree,
|
||||||
@ -28,7 +29,8 @@ export default function update(): Rule {
|
|||||||
updatePackagesInPackageJson(
|
updatePackagesInPackageJson(
|
||||||
path.join(__dirname, '../../../', 'migrations.json'),
|
path.join(__dirname, '../../../', 'migrations.json'),
|
||||||
'8.9.0'
|
'8.9.0'
|
||||||
)
|
),
|
||||||
|
formatFiles()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,8 @@ import {
|
|||||||
updateWorkspaceInTree,
|
updateWorkspaceInTree,
|
||||||
readWorkspaceJson,
|
readWorkspaceJson,
|
||||||
readWorkspace,
|
readWorkspace,
|
||||||
updateJsonInTree
|
updateJsonInTree,
|
||||||
|
formatFiles
|
||||||
} from '@nrwl/workspace';
|
} from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
@ -56,6 +57,7 @@ export default function update(): Rule {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
return chain(tsconfigUpdateRules);
|
return chain(tsconfigUpdateRules);
|
||||||
}
|
},
|
||||||
|
formatFiles()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { chain } from '@angular-devkit/schematics';
|
import { chain } from '@angular-devkit/schematics';
|
||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
const updatePackages = updatePackagesInPackageJson(
|
const updatePackages = updatePackagesInPackageJson(
|
||||||
@ -8,5 +8,5 @@ const updatePackages = updatePackagesInPackageJson(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return chain([updatePackages]);
|
return chain([updatePackages, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { chain } from '@angular-devkit/schematics';
|
import { chain } from '@angular-devkit/schematics';
|
||||||
import { addCacheableOperation } from '../../schematics/init/init';
|
import { addCacheableOperation } from '../../schematics/init/init';
|
||||||
|
import { formatFiles } from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return chain([addCacheableOperation]);
|
return chain([addCacheableOperation, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,24 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updateWorkspaceInTree } from '@nrwl/workspace';
|
import { formatFiles, updateWorkspaceInTree } from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updateWorkspaceInTree(config => {
|
return chain([
|
||||||
const filteredProjects = [];
|
updateWorkspaceInTree(config => {
|
||||||
Object.keys(config.projects).forEach(name => {
|
const filteredProjects = [];
|
||||||
if (
|
Object.keys(config.projects).forEach(name => {
|
||||||
config.projects[name].architect &&
|
if (
|
||||||
config.projects[name].architect.build &&
|
config.projects[name].architect &&
|
||||||
config.projects[name].architect.build.builder === '@nrwl/web:build'
|
config.projects[name].architect.build &&
|
||||||
) {
|
config.projects[name].architect.build.builder === '@nrwl/web:build'
|
||||||
filteredProjects.push(config.projects[name]);
|
) {
|
||||||
}
|
filteredProjects.push(config.projects[name]);
|
||||||
});
|
}
|
||||||
filteredProjects.forEach(p => {
|
});
|
||||||
delete p.architect.build.options.differentialLoading;
|
filteredProjects.forEach(p => {
|
||||||
});
|
delete p.architect.build.options.differentialLoading;
|
||||||
return config;
|
});
|
||||||
});
|
return config;
|
||||||
|
}),
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,24 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updateWorkspaceInTree } from '@nrwl/workspace';
|
import { formatFiles, updateWorkspaceInTree } from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updateWorkspaceInTree(workspaceJson => {
|
return chain([
|
||||||
Object.entries<any>(workspaceJson.projects).forEach(
|
updateWorkspaceInTree(workspaceJson => {
|
||||||
([projectName, project]) => {
|
Object.entries<any>(workspaceJson.projects).forEach(
|
||||||
Object.entries<any>(project.architect).forEach(
|
([projectName, project]) => {
|
||||||
([targetName, targetConfig]) => {
|
Object.entries<any>(project.architect).forEach(
|
||||||
if (targetConfig.builder === '@nrwl/web:bundle') {
|
([targetName, targetConfig]) => {
|
||||||
workspaceJson.projects[projectName].architect[
|
if (targetConfig.builder === '@nrwl/web:bundle') {
|
||||||
targetName
|
workspaceJson.projects[projectName].architect[
|
||||||
].builder = '@nrwl/web:package';
|
targetName
|
||||||
|
].builder = '@nrwl/web:package';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
}
|
||||||
}
|
);
|
||||||
);
|
return workspaceJson;
|
||||||
return workspaceJson;
|
}),
|
||||||
});
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,26 @@
|
|||||||
import { Rule } from '@angular-devkit/schematics';
|
import { chain, Rule } from '@angular-devkit/schematics';
|
||||||
import { updateWorkspaceInTree } from '@nrwl/workspace';
|
import { formatFiles, updateWorkspaceInTree } from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function update(): Rule {
|
export default function update(): Rule {
|
||||||
return updateWorkspaceInTree(workspaceJson => {
|
return chain([
|
||||||
Object.entries<any>(workspaceJson.projects).forEach(
|
updateWorkspaceInTree(workspaceJson => {
|
||||||
([projectName, project]) => {
|
Object.entries<any>(workspaceJson.projects).forEach(
|
||||||
Object.entries<any>(project.architect).forEach(
|
([projectName, project]) => {
|
||||||
([targetName, targetConfig]) => {
|
Object.entries<any>(project.architect).forEach(
|
||||||
if (targetConfig.builder === '@nrwl/web:build') {
|
([targetName, targetConfig]) => {
|
||||||
const architect =
|
if (targetConfig.builder === '@nrwl/web:build') {
|
||||||
workspaceJson.projects[projectName].architect[targetName];
|
const architect =
|
||||||
if (architect && architect.options) {
|
workspaceJson.projects[projectName].architect[targetName];
|
||||||
architect.options.buildLibsFromSource = true;
|
if (architect && architect.options) {
|
||||||
|
architect.options.buildLibsFromSource = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
}
|
||||||
}
|
);
|
||||||
);
|
return workspaceJson;
|
||||||
return workspaceJson;
|
}),
|
||||||
});
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import { stripIndents } from '@angular-devkit/core/src/utils/literals';
|
|||||||
|
|
||||||
import { updateJsonInTree } from '../../utils/ast-utils';
|
import { updateJsonInTree } from '../../utils/ast-utils';
|
||||||
import { getWorkspace } from '../../utils/workspace';
|
import { getWorkspace } from '../../utils/workspace';
|
||||||
|
import { formatFiles } from '@nrwl/workspace';
|
||||||
|
|
||||||
async function fixTslints(host: Tree) {
|
async function fixTslints(host: Tree) {
|
||||||
const workspace = await getWorkspace(host);
|
const workspace = await getWorkspace(host);
|
||||||
@ -33,6 +34,8 @@ async function fixTslints(host: Tree) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
rules.push(formatFiles());
|
||||||
|
|
||||||
return chain(rules);
|
return chain(rules);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,6 @@ export default function(): Rule {
|
|||||||
path.join(__dirname, '../../..', 'migrations.json'),
|
path.join(__dirname, '../../..', 'migrations.json'),
|
||||||
'8120'
|
'8120'
|
||||||
),
|
),
|
||||||
// addInstall,
|
|
||||||
formatFiles()
|
formatFiles()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
import { updateWorkspace } from '../../utils/workspace';
|
import { updateWorkspace } from '../../utils/workspace';
|
||||||
import { join, JsonArray, normalize } from '@angular-devkit/core';
|
import { join, JsonArray, normalize } from '@angular-devkit/core';
|
||||||
|
import { formatFiles } from '@nrwl/workspace';
|
||||||
|
import { chain } from '@angular-devkit/schematics';
|
||||||
|
|
||||||
const addExcludes = updateWorkspace(workspace => {
|
const addExcludes = updateWorkspace(workspace => {
|
||||||
workspace.projects.forEach(project => {
|
workspace.projects.forEach(project => {
|
||||||
@ -21,5 +23,5 @@ const addExcludes = updateWorkspace(workspace => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return addExcludes;
|
return chain([addExcludes, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
import { updateJsonInTree } from '../../utils/ast-utils';
|
import { updateJsonInTree } from '../../utils/ast-utils';
|
||||||
|
import { formatFiles } from '@nrwl/workspace';
|
||||||
|
import { chain } from '@angular-devkit/schematics';
|
||||||
|
|
||||||
const updateLint = updateJsonInTree('package.json', json => {
|
const updateLint = updateJsonInTree('package.json', json => {
|
||||||
if (
|
if (
|
||||||
@ -15,5 +17,5 @@ const updateLint = updateJsonInTree('package.json', json => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return updateLint;
|
return chain([updateLint, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { updateJsonInTree } from '@nrwl/workspace';
|
import { formatFiles, updateJsonInTree } from '@nrwl/workspace';
|
||||||
import { chain, SchematicContext } from '@angular-devkit/schematics';
|
import { chain, SchematicContext } from '@angular-devkit/schematics';
|
||||||
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
import { NodePackageInstallTask } from '@angular-devkit/schematics/tasks';
|
||||||
|
|
||||||
@ -16,5 +16,5 @@ const addInstall = (_: any, context: SchematicContext) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return chain([updateCypress, addInstall]);
|
return chain([updateCypress, addInstall, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
import { updateJsonInTree } from '../../utils/ast-utils';
|
import { updateJsonInTree } from '../../utils/ast-utils';
|
||||||
|
import { chain } from '@angular-devkit/schematics';
|
||||||
|
import { formatFiles } from '@nrwl/workspace';
|
||||||
|
|
||||||
const addNxScript = updateJsonInTree('package.json', json => {
|
const addNxScript = updateJsonInTree('package.json', json => {
|
||||||
if (json.scripts && !json.scripts.nx) {
|
if (json.scripts && !json.scripts.nx) {
|
||||||
@ -8,5 +10,5 @@ const addNxScript = updateJsonInTree('package.json', json => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return addNxScript;
|
return chain([addNxScript, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,32 +1,36 @@
|
|||||||
import { Tree, SchematicContext } from '@angular-devkit/schematics';
|
import { Tree, SchematicContext, chain } from '@angular-devkit/schematics';
|
||||||
import { readWorkspace, readJsonInTree } from '../../utils/ast-utils';
|
import { readWorkspace, readJsonInTree } from '../../utils/ast-utils';
|
||||||
|
import { formatFiles } from '@nrwl/workspace';
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return (host: Tree) => {
|
return chain([
|
||||||
const config = readWorkspace(host);
|
(host: Tree) => {
|
||||||
|
const config = readWorkspace(host);
|
||||||
|
|
||||||
const configsToUpdate = [];
|
const configsToUpdate = [];
|
||||||
Object.keys(config.projects).forEach(name => {
|
Object.keys(config.projects).forEach(name => {
|
||||||
const project = config.projects[name];
|
const project = config.projects[name];
|
||||||
if (
|
if (
|
||||||
project.projectType === 'library' &&
|
project.projectType === 'library' &&
|
||||||
project.architect &&
|
project.architect &&
|
||||||
project.architect.test &&
|
project.architect.test &&
|
||||||
project.architect.test.builder === '@nrwl/jest:jest' &&
|
project.architect.test.builder === '@nrwl/jest:jest' &&
|
||||||
project.architect.test.options &&
|
project.architect.test.options &&
|
||||||
project.architect.test.options.setupFile ===
|
project.architect.test.options.setupFile ===
|
||||||
project.sourceRoot + '/test-setup.ts'
|
project.sourceRoot + '/test-setup.ts'
|
||||||
) {
|
) {
|
||||||
configsToUpdate.push(project.root + '/tsconfig.lib.json');
|
configsToUpdate.push(project.root + '/tsconfig.lib.json');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
configsToUpdate.forEach(config => {
|
configsToUpdate.forEach(config => {
|
||||||
const tsconfig = readJsonInTree(host, config);
|
const tsconfig = readJsonInTree(host, config);
|
||||||
if (tsconfig.exclude && tsconfig.exclude[0] === 'src/test.ts') {
|
if (tsconfig.exclude && tsconfig.exclude[0] === 'src/test.ts') {
|
||||||
tsconfig.exclude[0] = 'src/test-setup.ts';
|
tsconfig.exclude[0] = 'src/test-setup.ts';
|
||||||
host.overwrite(config, JSON.stringify(tsconfig));
|
host.overwrite(config, JSON.stringify(tsconfig));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
},
|
||||||
|
formatFiles()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { chain } from '@angular-devkit/schematics';
|
import { chain } from '@angular-devkit/schematics';
|
||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
const updatePackages = updatePackagesInPackageJson(
|
const updatePackages = updatePackagesInPackageJson(
|
||||||
@ -8,5 +8,5 @@ const updatePackages = updatePackagesInPackageJson(
|
|||||||
);
|
);
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return chain([updatePackages]);
|
return chain([updatePackages, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { chain } from '@angular-devkit/schematics';
|
import { chain } from '@angular-devkit/schematics';
|
||||||
import { updatePackagesInPackageJson } from '@nrwl/workspace';
|
import { formatFiles, updatePackagesInPackageJson } from '@nrwl/workspace';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
|
|
||||||
const updatePackages = updatePackagesInPackageJson(
|
const updatePackages = updatePackagesInPackageJson(
|
||||||
@ -7,5 +7,5 @@ const updatePackages = updatePackagesInPackageJson(
|
|||||||
'9.1.0'
|
'9.1.0'
|
||||||
);
|
);
|
||||||
export default function() {
|
export default function() {
|
||||||
return chain([updatePackages]);
|
return chain([updatePackages, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { SchematicContext, Tree } from '@angular-devkit/schematics';
|
import { chain, SchematicContext, Tree } from '@angular-devkit/schematics';
|
||||||
import { readWorkspace, updateJsonInTree } from '@nrwl/workspace';
|
import { formatFiles, readWorkspace, updateJsonInTree } from '@nrwl/workspace';
|
||||||
|
|
||||||
function updateLintConfigurations(host: Tree, context: SchematicContext) {
|
function updateLintConfigurations(host: Tree, context: SchematicContext) {
|
||||||
const workspaceJson = readWorkspace(host);
|
const workspaceJson = readWorkspace(host);
|
||||||
@ -52,5 +52,5 @@ function updateJson(visitor, path, host, context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return updateLintConfigurations;
|
return chain([updateLintConfigurations, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { chain } from '@angular-devkit/schematics';
|
import { chain } from '@angular-devkit/schematics';
|
||||||
import { updateJsonInTree } from '@nrwl/workspace';
|
import { formatFiles, updateJsonInTree } from '@nrwl/workspace';
|
||||||
|
|
||||||
const addCacheableOperations = updateJsonInTree('nx.json', nxJson => {
|
const addCacheableOperations = updateJsonInTree('nx.json', nxJson => {
|
||||||
nxJson.tasksRunnerOptions = nxJson.tasksRunnerOptions || {};
|
nxJson.tasksRunnerOptions = nxJson.tasksRunnerOptions || {};
|
||||||
@ -47,5 +47,5 @@ const addCacheableOperations = updateJsonInTree('nx.json', nxJson => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function() {
|
export default function() {
|
||||||
return chain([addCacheableOperations]);
|
return chain([addCacheableOperations, formatFiles()]);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user