build.mjs 501 B

12345678910111213141516
  1. import { exec } from 'child_process'
  2. import { asyncForEach, readSvgs } from '../../.build/helpers.mjs'
  3. let svgFiles = readSvgs()
  4. await asyncForEach(svgFiles, async function(file, i) {
  5. const distPath = `./icons/${file.name}.png`
  6. process.stdout.write(`Building ${i}/${svgFiles.length}: ${file.name.padEnd(42)}\r`)
  7. await new Promise((resolve, reject) => {
  8. exec(`rsvg-convert -h 240 ${file.path} > ${distPath}`, (error, stdout, stderr) => {
  9. error ? reject() : resolve()
  10. })
  11. })
  12. })