UNPKG

@nrwl/schematics

Version:

Extensible Dev Tools for Monorepos: Schematics

38 lines (37 loc) 1.44 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = require("fs"); const workspace_1 = require("@nrwl/workspace"); const literals_1 = require("@angular-devkit/core/src/utils/literals"); exports.default = { description: `Create nx.json before migrating to Angular CLI 6.`, run: () => { if (!fs_1.existsSync('.angular-cli.json') && fs_1.existsSync('angular.json')) { console.warn(literals_1.stripIndents ` You have already upgraded to Angular CLI 6. We will not be able to recover information about your project's tags for you. `); return; } const workspaceJson = workspace_1.readJsonFile('.angular-cli.json'); const projects = workspaceJson.apps.reduce((projects, app) => { if (app.name === '$workspaceRoot') { return projects; } const normalizedName = app.name.replace(new RegExp('/', 'g'), '-'); projects[normalizedName] = { tags: app.tags }; if (app.root.startsWith('apps/')) { projects[`${normalizedName}-e2e`] = { tags: [] }; } return projects; }, {}); fs_1.writeFileSync('nx.json', workspace_1.serializeJson({ npmScope: workspaceJson.project.npmScope, projects: projects })); } };