build.mjs 974 B

123456789101112131415161718192021222324252627282930313233343536373839
  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 './icons/${namePascal}';`
  14. const typeDefinitionsTemplate = () => `import { SVGAttributes, FunctionalComponent } from 'vue';
  15. declare module '@tabler/icons-vue'
  16. // Create interface extending SVGAttributes
  17. export interface SVGProps extends Partial<SVGAttributes> {
  18. size?: 24 | number
  19. }
  20. // Generated icons`
  21. const indexTypeTemplate = ({
  22. namePascal
  23. }) => `export declare const ${namePascal}: (props: SVGProps) => FunctionalComponent<SVGProps>;`
  24. buildIcons({
  25. name: 'icons-vue',
  26. componentTemplate,
  27. indexItemTemplate,
  28. typeDefinitionsTemplate,
  29. indexTypeTemplate
  30. })