From 4f935d2249c93443719c7e553e0509e1ab72b4d6 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 22 Feb 2024 12:32:52 +0100 Subject: [PATCH] Revert "Unify non-icon exports in svg/font indices (#693)" This reverts commit f1e39c3ab1d18a98acd8c3ca2ed7a24405ab989b. --- packages/react-icons/addRexportsToIndex.js | 12 ------------ packages/react-icons/convert-font.js | 11 +++++++++-- packages/react-icons/convert.js | 12 ++++++++++-- 3 files changed, 19 insertions(+), 16 deletions(-) delete mode 100644 packages/react-icons/addRexportsToIndex.js diff --git a/packages/react-icons/addRexportsToIndex.js b/packages/react-icons/addRexportsToIndex.js deleted file mode 100644 index 03f3aece58..0000000000 --- a/packages/react-icons/addRexportsToIndex.js +++ /dev/null @@ -1,12 +0,0 @@ -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 d409a5d01b..3e1c496cc7 100644 --- a/packages/react-icons/convert-font.js +++ b/packages/react-icons/convert-font.js @@ -12,7 +12,6 @@ const mkdirp = require('mkdirp'); const { promisify } = require('util'); const { option } = require("yargs"); const glob = promisify(require('glob')); -const addRexportsToIndex = require('./addRexportsToIndex'); // @ts-ignore const SRC_PATH = argv.source; @@ -70,7 +69,15 @@ 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, '..'); + 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 { 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\''); await fs.writeFile(indexPath, indexContents.join('\n')); diff --git a/packages/react-icons/convert.js b/packages/react-icons/convert.js index 361755ef9e..20c7852510 100644 --- a/packages/react-icons/convert.js +++ b/packages/react-icons/convert.js @@ -5,7 +5,6 @@ const fs = require("fs"); const path = require("path"); const argv = require("yargs").boolean("selector").default("selector", false).argv; const _ = require("lodash"); -const addRexportsToIndex = require('./addRexportsToIndex'); const SRC_PATH = argv.source; const DEST_PATH = argv.dest; @@ -69,11 +68,20 @@ function processFiles(src, dest) { const indexPath = path.join(dest, 'index.tsx') // Finally add the interface definition and then write out the index. - 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 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\''); fs.writeFileSync(indexPath, indexContents.join('\n'), (err) => { if (err) throw err; }); + } /**