UNPKG

@monstrs/mctl-migration

Version:

29 lines (28 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const node_1 = require("@angular-devkit/core/node"); const tools_1 = require("@angular-devkit/schematics/tools"); const core_1 = require("@angular-devkit/core"); const schematics_1 = require("@angular-devkit/schematics"); exports.createCollection = (root, collectionName) => { const fsHost = new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), core_1.normalize(root)); const workflow = new tools_1.NodeWorkflow(fsHost, { force: false, dryRun: true, packageManager: 'yarn', root: core_1.normalize(root), registry: new core_1.schema.CoreSchemaRegistry(schematics_1.formats.standardFormats), }); return workflow.engine.createCollection(collectionName); }; exports.expandCollection = (collectionName) => { const collection = exports.createCollection(process.cwd(), collectionName); const collections = [collection]; if (collection.baseDescriptions) { const baseCollections = collection.baseDescriptions .map(base => exports.expandCollection(base.name)) .flat(); return [...collections, ...baseCollections]; } return collections; };