Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions generator/generate-svg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const generateIconsDefs = async (icon, weight) => {
).replace(RegExp(`${Case.capital(weight)}$`), '');

const tsCode = await transform(svgCode, options, {
componentName: componentNameMap[componentName] || componentName,
componentName,
});

return [...tsCode.matchAll(/<Path.*? \/>/g)]
Expand Down Expand Up @@ -90,6 +90,7 @@ const getIconList = () => {
'swap',
'list',
'test-tube',
'circle',
'',
].includes(file)
);
Expand Down Expand Up @@ -139,8 +140,6 @@ ${Object.entries(defs)

const generateMainIconFile = (icon) => {
const component = Case.pascal(icon);
// const componentFileName = fileNameMap[component] || component;
const componentName = componentNameMap[component] || component;
const componentCode = `import { type Icon, type IconProps } from 'phosphor-react-native'

import IconBase from "../lib/icon-base";
Expand All @@ -150,9 +149,9 @@ const I: Icon = ({...props }: IconProps) => (
<IconBase {...props} weights={weights} name="${icon}" />
)

/** @deprecated Use ${componentName}Icon */
export const ${componentName} = I
export { I as ${componentName}Icon }`;
/** @deprecated Use ${component}Icon */
export const ${componentNameMap[component] || component} = I
export { I as ${component}Icon }`;

const filePath = path.join(__dirname, '../src/icons', `${component}.tsx`);

Expand Down