UNPKG

igniteui-angular

Version:

Ignite UI for Angular is a dependency-free Angular toolkit for building modern web apps

36 lines (35 loc) 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("../common/util"); const version = '6.0.2'; function default_1() { return (host, context) => { let globalStyleExt; const themeImport = '~igniteui-angular/core/styles/themes'; const newThemeImport = '~igniteui-angular/lib/core/styles/themes'; const config = util_1.getWorkspace(host); const projects = util_1.getProjects(config); context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`); if (config.schematics && config.schematics['@schematics/angular:component']) { // updated projects have global prefix rather than per-project: globalStyleExt = config.schematics['@schematics/angular:component'].styleext; } for (const proj of projects) { const dir = host.getDir(proj.sourceRoot); let ext = globalStyleExt || 'scss'; if (proj.schematics && proj.schematics['@schematics/angular:component']) { ext = proj.schematics['@schematics/angular:component'].styleext || ext; } dir.visit((path, entry) => { if (path.endsWith('.' + ext)) { let content = entry.content.toString(); if (content.indexOf(themeImport) !== -1) { content = content.replace(themeImport, newThemeImport); host.overwrite(path, content); } } }); } }; } exports.default = default_1;