build.mjs 781 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/env node
  2. import { buildIcons } from '../../.build/build-icons.mjs'
  3. const componentTemplate = ({
  4. name,
  5. namePascal,
  6. children
  7. }) => `\
  8. import createPreactComponent from '../createPreactComponent';
  9. export default createPreactComponent('${name}', '${namePascal}', ${JSON.stringify(children)});`;
  10. const indexItemTemplate = ({
  11. name,
  12. namePascal
  13. }) => `export { default as ${namePascal} } from './${namePascal}';`
  14. const aliasTemplate = ({ fromPascal, toPascal }) => `export { default as Icon${fromPascal} } from './icons/Icon${toPascal}';\n`
  15. buildIcons({
  16. name: 'icons-preact',
  17. componentTemplate,
  18. indexItemTemplate,
  19. // typeDefinitionsTemplate,
  20. // indexTypeTemplate,
  21. aliasTemplate,
  22. pascalCase: true,
  23. indexFile: 'icons/index.ts',
  24. extension: 'ts'
  25. })