UNPKG

@tririga/tri-polymer-upgrade

Version:

A tool for converting TRIRIGA UX views from Polymer 1 to Polymer 3

28 lines (26 loc) 833 B
const slotMappings = require("../config/slot-mappings.json"); const fse = require("fs-extra"); const path = require("path"); function getAllSlotMappings() { return slotMappings; } module.exports.getAllSlotMappings = getAllSlotMappings; function saveSlotMapping(elementName, mappings) { let found = false; for (let i = 0; i < slotMappings.length && !found; i++) { const slotMapping = slotMappings[i]; if (slotMapping.elementName == elementName) { slotMapping.mappings = mappings; found = true; } } if (!found) { slotMappings.push({ elementName: elementName, mappings: mappings }); } let slotMappingsFilePath = path.resolve(__dirname, "../config/slot-mappings.json"); return fse.outputFile(slotMappingsFilePath, JSON.stringify(slotMappings, null, 4)); } module.exports.saveSlotMapping = saveSlotMapping;