## Description - Add `appsmith-icons` package. Icons are automatically imported from Figma, optimized, and then React components are created based on them. Please read the [README](https://github.com/appsmithorg/appsmith/pull/32927/files#diff-163e187687a9784dfda13faf90276b1137ba6e85db21bd550c6a3ba486178e5e) for more information. - Replace Icons for Anvil widgets. ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/8847468194> > Commit: a2036daedef0a08b7c973e04ac11a224fb40c9c1 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8847468194&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No
40 lines
984 B
TypeScript
40 lines
984 B
TypeScript
import fs from "fs-extra";
|
|
|
|
const createImportListString = (name: string, dir: string) => {
|
|
return `export { ${name} } from "./components/${dir}/${name}";
|
|
`;
|
|
};
|
|
|
|
async function generateIndex() {
|
|
await appendExports("Thumbnails");
|
|
await appendExports("Icons");
|
|
|
|
// eslint-disable-next-line no-console
|
|
console.error(
|
|
"\x1b[32mIndex.ts file generation completed successfully!\x1b[0m",
|
|
);
|
|
}
|
|
|
|
async function appendExports(dir: string) {
|
|
await fs.readdir(`./src/components/${dir}/`, async (err, files) => {
|
|
if (err) {
|
|
// eslint-disable-next-line no-console
|
|
return console.error(err);
|
|
}
|
|
|
|
let importList = ``;
|
|
|
|
files.forEach((file) => {
|
|
const name = file.replace(".tsx", "");
|
|
importList += createImportListString(name, dir);
|
|
});
|
|
|
|
await fs.appendFile(`./src/index.ts`, importList, "utf8", function (err) {
|
|
// eslint-disable-next-line no-console
|
|
if (err) return console.error(err);
|
|
});
|
|
});
|
|
}
|
|
|
|
generateIndex();
|