@nrwl/schematics
Version:
33 lines (30 loc) • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const workspace_1 = require("@nrwl/workspace");
const literals_1 = require("@angular-devkit/core/src/utils/literals");
function displayInformation(host, context) {
context.logger.info(literals_1.stripIndents `Prettier has been updated to 1.15.1 which has support for formatting html!
Formatting of your code might change as you are working on each file.
Optional: You may want to run "npm run format" as part of this update to reformat all files in your workspace.
You can also opt out of formatting in files by adding them to the .prettierignore file in the root of your workspace.`);
}
function createPrettierIgnore(host, context) {
if (!host.exists('.prettierignore')) {
host.create('.prettierignore', '# Add files here to ignore them from prettier formatting\n');
}
}
function default_1() {
return schematics_1.chain([
workspace_1.updateJsonInTree('package.json', json => {
json.scripts = json.scripts || {};
json.devDependencies = json.devDependencies || {};
json.scripts = Object.assign({}, json.scripts, { affected: './node_modules/.bin/nx affected' });
json.devDependencies = Object.assign({}, json.devDependencies, { prettier: '1.15.2' });
return json;
}),
createPrettierIgnore,
displayInformation
]);
}
exports.default = default_1;