build.mjs 819 B

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