build.mjs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 createSolidComponent from '../createSolidComponent';
  9. export default createSolidComponent('${name}', '${namePascal}', ${JSON.stringify(children)});`;
  10. const indexItemTemplate = ({
  11. name,
  12. namePascal
  13. }) => `export { default as ${namePascal} } from './icons/${namePascal}';`
  14. const typeDefinitionsTemplate = () => `/// <reference types="solid-js" />
  15. import { JSX } from 'solid-js'
  16. interface TablerIconsProps extends Partial<JSX.IntrinsicElements & JSX.SvgSVGAttributes<SVGSVGElement>> {
  17. key?: string | number;
  18. ref?: string | ((component: any) => any);
  19. color?: string
  20. size?: string | number
  21. strokeWidth?: string | number
  22. class?: string
  23. }
  24. // Generated icons`
  25. const indexTypeTemplate = ({
  26. namePascal
  27. }) => `export declare const ${namePascal}: (props: TablerIconsProps) => JSX.Element;`
  28. buildIcons({
  29. name: 'icons-solidjs',
  30. componentTemplate,
  31. indexItemTemplate,
  32. typeDefinitionsTemplate,
  33. indexTypeTemplate,
  34. key: false
  35. })