UNPKG

@nstudio/angular

Version:

Angular Plugin for xplat

56 lines (55 loc) 2.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = default_1; const schematics_1 = require("@angular-devkit/schematics"); const xplat_1 = require("@nstudio/xplat"); const xplat_utils_1 = require("@nstudio/xplat-utils"); const xplat_2 = require("../../utils/xplat"); const focus_1 = require("@nstudio/focus"); function default_1(options) { // console.log(`Generating xplat angular support for: ${options.platforms}`); const externalChains = xplat_2.XplatAngularHelpers.externalChains(options); return (0, schematics_1.chain)([ (0, xplat_utils_1.prerun)(options, true), // libs xplat_1.XplatHelpers.generateLib(options, 'core', 'xplat', 'node'), xplat_1.XplatHelpers.cleanupLib(options, 'core', 'xplat'), xplat_2.XplatAngularHelpers.addLibFiles(options, './', 'core'), xplat_1.XplatHelpers.generateLib(options, 'features', 'xplat', 'node'), xplat_1.XplatHelpers.cleanupLib(options, 'features', 'xplat'), xplat_2.XplatAngularHelpers.addLibFiles(options, './', 'features'), xplat_1.XplatHelpers.generateLib(options, 'scss', 'xplat', 'jsdom'), xplat_1.XplatHelpers.cleanupLib(options, 'scss', 'xplat'), xplat_2.XplatAngularHelpers.addLibFiles(options, './', 'scss'), xplat_1.XplatHelpers.generateLib(options, 'utils', 'xplat', 'node'), xplat_1.XplatHelpers.cleanupLib(options, 'utils', 'xplat'), xplat_2.XplatAngularHelpers.addLibFiles(options, './', 'utils'), // cross platform support (tree, context) => (0, schematics_1.chain)(externalChains), xplat_2.XplatAngularHelpers.updateRootDeps(options), // adjust root tsconfig (tree, context) => { return (0, xplat_1.updateTsConfig)(tree, (tsConfig) => { if (tsConfig) { if (!tsConfig.compilerOptions) { tsConfig.compilerOptions = {}; } if (!tsConfig.compilerOptions.paths[`@${(0, xplat_utils_1.getNpmScope)()}/xplat/environments`]) { tsConfig.compilerOptions.paths[`@${(0, xplat_utils_1.getNpmScope)()}/xplat/environments`] = [`libs/xplat/core/src/lib/environments/base/index.ts`]; } } }); }, // clean shared code script - don't believe need this anymore // (tree: Tree) => { // const scripts = {}; // scripts[ // `clean.shared` // ] = `cd libs/ && git clean -dfX && cd ../xplat/ && git clean -dfX`; // return updatePackageScripts(tree, scripts); // }, // update IDE settings focus_1.FocusHelpers.updateIDESettings(options), // addInstallTask(), ]); }