UNPKG

igniteui-angular

Version:

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

42 lines (41 loc) 2.29 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const UpdateChanges_1 = require("../common/UpdateChanges"); const version = '15.0.11'; exports.default = () => (host, context) => __awaiter(void 0, void 0, void 0, function* () { context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`); const update = new UpdateChanges_1.UpdateChanges(__dirname, host, context); update.applyChanges(); const updateTypographyAndScrollbar = (content) => { const typography = /igx-typography/g, scrollbar = /igx-scrollbar/g; return content .replace(typography, 'ig-typography') .replace(scrollbar, 'ig-scrollbar'); }; const indexPath = '/src/index.html'; if (host.exists(indexPath)) { host.overwrite(indexPath, updateTypographyAndScrollbar(host.read(indexPath).toString())); } update.templateFiles.forEach(path => host.overwrite(path, updateTypographyAndScrollbar(host.read(path).toString()))); const graysVar = /\$grays:\s*(.+)(\r\n|\r|\n|,)/, graysString = /'grays'/g, graysTarget = `'gray'`; update.sassFiles.forEach(path => { let content = host.read(path).toString(); const matches = content.matchAll(new RegExp(graysVar, 'g')); for (const match of matches) { content = content.replace(graysVar, `$gray: ${match[1]}${match[2]}`); } if (graysString.test(content)) { content = content.replace(graysString, graysTarget); } host.overwrite(path, updateTypographyAndScrollbar(content)); }); });