Skip to content

Commit

Permalink
breaking: remove react-icons/all module
Browse files Browse the repository at this point in the history
  • Loading branch information
kamijin-fanta committed Mar 28, 2023
1 parent 7967974 commit 686e260
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
15 changes: 2 additions & 13 deletions packages/react-icons/scripts/task_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from "path";
import { promises as fs } from "fs";
import camelcase from "camelcase";
import { icons } from "../src/icons";
import { iconRowTemplate, iconsEntryTemplate } from "./templates";
import { iconRowTemplate } from "./templates";
import { getIconFiles, convertIconData, rmDirRecursive } from "./logics";
import { svgo } from "./svgo";

Expand All @@ -22,13 +22,7 @@ export async function dirInit({ DIST, LIB, rootDir }) {
const write = (filePath, str) =>
fs.writeFile(path.resolve(DIST, ...filePath), str, "utf8").catch(ignore);

const initFiles = [
"index.d.ts",
"index.esm.js",
"index.js",
"all.js",
"all.d.ts",
];
const initFiles = ["index.d.ts", "index.esm.js", "index.js"];

for (const icon of icons) {
await fs.mkdir(path.resolve(DIST, icon.id)).catch(ignore);
Expand Down Expand Up @@ -64,11 +58,6 @@ export async function dirInit({ DIST, LIB, rootDir }) {
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function writeIconModule(icon, { DIST, LIB, rootDir }) {
const entryModule = iconsEntryTemplate(icon.id, "module");
await fs.appendFile(path.resolve(DIST, "all.js"), entryModule, "utf8");
const entryDts = iconsEntryTemplate(icon.id, "dts");
await fs.appendFile(path.resolve(DIST, "all.d.ts"), entryDts, "utf8");

const exists = new Set(); // for remove duplicate
for (const content of icon.contents) {
const files = await getIconFiles(content);
Expand Down
10 changes: 0 additions & 10 deletions packages/react-icons/scripts/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,3 @@ export function iconRowTemplate(
throw new Error(`Unknown type: ${type}`);
}
}
export function iconsEntryTemplate(iconId, type = "module"): string {
switch (type) {
case "module":
return `export * from './${iconId}';\n`;
case "dts":
return `export * from './${iconId}';\n`;
default:
throw Error(`Unknown type: ${type} iconId: ${iconId}`);
}
}

0 comments on commit 686e260

Please sign in to comment.