Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default async function generateZip(selections, colors, width, height, url, cliColors) {
const zip = new JSZip();
const preparedColors = prepareColors(colors, () => {});
zip.file('Instructions.md', instructions(selections, url));
zip.file('colors.js', colorsForCli(cliColors, url));
for (const [key, selected] of Object.entries(selections)) {
if (selected) {
const files = await Promise.all(templates[key].render(
preparedColors,
key in resolutionOptions
? { [resolutionOptions[key]]: `${width}x${height}` }
: {},
));
files.forEach(file => {
zip.folder(templates[key].folderName).file(file.name, file.contents);
});
}
}
return zip;