UNPKG

@nstudio/schematics

Version:

Cross-platform (xplat) tools for Nx workspaces.

44 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("../../../utils"); function supportImports_NativeScript(helperChains, options) { return (tree, context) => { let pathRef = `xplat/nativescript/utils/@nativescript/*`; // update root tsconfig helperChains.push(utils_1.updateTsConfig(tree, (tsConfig) => { const updates = {}; updates[`@nativescript/*`] = [pathRef]; if (tsConfig) { if (!tsConfig.compilerOptions) { tsConfig.compilerOptions = {}; } tsConfig.compilerOptions.paths = Object.assign({}, (tsConfig.compilerOptions.paths || {}), updates); } })); // update all {N} app tsconfig's const appsDir = tree.getDir("apps"); const appFolders = appsDir.subdirs; pathRef = `../../${pathRef}`; // update {N} apps and configs for (const dir of appFolders) { // console.log(dir); if (dir.indexOf("nativescript-") === 0 || dir.indexOf("-nativescript") === 0) { const appDir = `${appsDir.path}/${dir}`; // console.log('appDir:', appDir); helperChains.push(utils_1.updateTsConfig(tree, (tsConfig) => { const updates = {}; updates[`@nativescript/*`] = [pathRef]; if (tsConfig) { if (!tsConfig.compilerOptions) { tsConfig.compilerOptions = {}; } tsConfig.compilerOptions.paths = Object.assign({}, (tsConfig.compilerOptions.paths || {}), updates); } }, null, `${appDir}/`)); } } }; } exports.supportImports_NativeScript = supportImports_NativeScript; //# sourceMappingURL=support.js.map