Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import { LWC_MAPPINGS_CSV, LWC_TO_SLDS_FILENAME } from "../constants.js";
import { parseCSVFile } from "../parsers/csv-parser.js";
import { LWCMappingsProcessor, LWCMappingsProcessorResults } from "../processors/index.js";
import { writeData } from "../services/file-service.js";
import { SupportedFileFormat } from "../types.js";
/**
* This function parses lwc-to-slds-mappings.csv file downloaded from
* the Qip doc https://salesforce.quip.com/QshGATYpSU0Y#temp:C:EDd14c1043dd4b648d9b2a3f2f20
* to generate a mapping of lwc tokens to slds tokens.
* @param outputDir - Custom output directory for generated files. Defaults to current working directory
*/
export async function generateLwcToSldsMap(outputDir: string = process.cwd(), format: SupportedFileFormat = 'json' ) {
const processor = new LWCMappingsProcessor();
await parseCSVFile<LWCMappingsProcessorResults>(LWC_MAPPINGS_CSV, processor);
await processor.loadUpdatedMappings();
const mappings = processor.getResults();
await writeData(LWC_TO_SLDS_FILENAME, mappings, outputDir, format);
} |