gen-filenames.js 543 B

12345678910111213141516171819202122
  1. const fs = require('fs')
  2. const path = require('path')
  3. const gniPath = path.resolve(__dirname, '../filenames.auto.gni')
  4. const allDocs = fs.readdirSync(path.resolve(__dirname, '../docs/api'))
  5. .map(doc => `docs/api/${doc}`)
  6. .concat(
  7. fs.readdirSync(path.resolve(__dirname, '../docs/api/structures'))
  8. .map(doc => `docs/api/structures/${doc}`)
  9. )
  10. fs.writeFileSync(
  11. gniPath,
  12. `# THIS FILE IS AUTO-GENERATED, PLEASE DO NOT EDIT BY HAND
  13. auto_filenames = {
  14. api_docs = [
  15. ${allDocs.map(doc => ` "${doc}",`).join('\n')}
  16. ]
  17. }
  18. `
  19. )