build.mjs 696 B

123456789101112131415161718192021222324252627
  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 createVueComponent from '../createVueComponent';
  9. export default createVueComponent('${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-vue',
  17. componentTemplate,
  18. indexItemTemplate,
  19. aliasTemplate,
  20. extension: 'ts',
  21. indexFile: 'icons/index.ts',
  22. })