diff --git a/packages/react-icons/addRexportsToIndex.js b/packages/react-icons/addRexportsToIndex.js index 698463e88a..2a31d90c20 100644 --- a/packages/react-icons/addRexportsToIndex.js +++ b/packages/react-icons/addRexportsToIndex.js @@ -1,12 +1,12 @@ -module.exports = function addRexportsToIndex(indexContents) { - indexContents.push('export { FluentIconsProps } from \'./utils/FluentIconsProps.types\''); - indexContents.push('export { default as wrapIcon } from \'./utils/wrapIcon\''); - indexContents.push('export { default as bundleIcon } from \'./utils/bundleIcon\''); - indexContents.push('export { createFluentIcon } from \'./utils/createFluentIcon\''); - indexContents.push('export { createFluentFontIcon } from \'../utils/fonts/createFluentFontIcon\''); - indexContents.push('export type { FluentIcon } from \'./utils/createFluentIcon\''); - indexContents.push('export * from \'./utils/useIconState\''); - indexContents.push('export * from \'./utils/constants\''); - indexContents.push('export { IconDirectionContextProvider, useIconContext } from \'./contexts/index\''); - indexContents.push('export type { IconDirectionContextValue } from \'./contexts/index\''); +module.exports = function addRexportsToIndex(indexContents, rootPath = `.`) { + indexContents.push(`export { FluentIconsProps } from \'${rootPath}/utils/FluentIconsProps.types\'`); + indexContents.push(`export { default as wrapIcon } from \'${rootPath}/utils/wrapIcon\'`); + indexContents.push(`export { default as bundleIcon } from \'${rootPath}/utils/bundleIcon\'`); + indexContents.push(`export { createFluentIcon } from \'${rootPath}/utils/createFluentIcon\'`); + indexContents.push(`export { createFluentFontIcon } from \'${rootPath}./utils/fonts/createFluentFontIcon\'`); + indexContents.push(`export type { FluentIcon } from \'${rootPath}/utils/createFluentIcon\'`); + indexContents.push(`export * from \'${rootPath}/utils/useIconState\'`); + indexContents.push(`export * from \'${rootPath}/utils/constants\'`); + indexContents.push(`export { IconDirectionContextProvider, useIconContext } from \'${rootPath}/contexts/index\'`); + indexContents.push(`export type { IconDirectionContextValue } from \'${rootPath}/contexts/index\'`); } \ No newline at end of file diff --git a/packages/react-icons/convert-font.js b/packages/react-icons/convert-font.js index 1d2d26bd4f..d409a5d01b 100644 --- a/packages/react-icons/convert-font.js +++ b/packages/react-icons/convert-font.js @@ -70,7 +70,7 @@ async function processFiles(src, dest) { const indexPath = path.join(dest, 'index.tsx') // Finally add the interface definition and then write out the index. - addRexportsToIndex(indexContents); + addRexportsToIndex(indexContents, '..'); await fs.writeFile(indexPath, indexContents.join('\n'));