Skip to content
Merged
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
14 changes: 7 additions & 7 deletions packages/raystack/scripts/create-icons.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const fs = require("fs/promises");
const path = require("path");
const fs = require('fs/promises');
const path = require('path');

const ICON_FOLDER = path.join(__dirname, "..", "v1", "icons");
const ICON_ASSETS = path.join(ICON_FOLDER, "assets");
const ICON_FOLDER = path.join(__dirname, '..', 'icons');
const ICON_ASSETS = path.join(ICON_FOLDER, 'assets');

const FILE_INITIAL_CONTENT = `// This file is automatically generated by "npm run build:icons"
// Do not edit this file manually
`;

const getIconName = (filename) => {
const getIconName = filename => {
// Remove .svg extension
const nameWithoutExt = path.basename(filename, '.svg');

Expand All @@ -28,9 +28,9 @@ async function createIcons() {
const iconName = getIconName(icon);
return `${acc}\nexport { ReactComponent as ${iconName} } from "./assets/${icon}";`;
}, FILE_INITIAL_CONTENT);
await fs.writeFile(path.join(ICON_FOLDER, "index.tsx"), indexContent);
await fs.writeFile(path.join(ICON_FOLDER, 'index.tsx'), indexContent);
} catch (error) {
console.error("Error creating icons:", error);
console.error('Error creating icons:', error);
}
}

Expand Down