import-illustrations.js 387 B

12345678910111213141516171819
  1. #!/usr/bin/env node
  2. 'use strict'
  3. const fs = require('fs'),
  4. path = require('path'),
  5. glob = require('glob');
  6. const illustrations = glob
  7. .sync(path.join(__dirname, `../src/static/illustrations/light/*.png`))
  8. .map((file) => {
  9. return path.basename(file, '.png')
  10. })
  11. fs.writeFileSync(
  12. path.join(__dirname, `../src/pages/_data/illustrations.json`),
  13. JSON.stringify(illustrations)
  14. )