@devchristian1337/dev-icons
Version:
A library to serve development-related icons
202 lines (190 loc) • 3.58 kB
JavaScript
const fs = require("fs");
const path = require("path");
// Configuration for icons
const icons = {
html: {
name: "HTML",
file: "html.svg",
},
css: {
name: "CSS",
file: "css.svg",
},
javascript: {
name: "JavaScript",
file: "javascript.svg",
},
tailwindcss: {
name: "Tailwind CSS",
file: "tailwindcss.svg",
},
react: {
name: "React",
file: "react.svg",
},
nodejs: {
name: "Node.js",
file: "nodejs.svg",
},
mongodb: {
name: "MongoDB",
file: "mongodb.svg",
},
mysql: {
name: "MySQL",
file: "mysql.svg",
},
postgresql: {
name: "PostgreSQL",
file: "postgresql.svg",
},
git: {
name: "Git",
file: "git.svg",
},
angularOld: {
name: "Angular (Old)",
file: "angularOld.svg",
},
angular: {
name: "Angular (New)",
file: "angularNew.svg",
},
vue: {
name: "Vue",
file: "vuejs.svg",
},
bootstrapOld: {
name: "Bootstrap (Old)",
file: "bootstrapOld.svg",
},
bootstrapNew: {
name: "Bootstrap (New)",
file: "bootstrapNew.svg",
},
csharp: {
name: "C#",
file: "c-sharp.svg",
},
electron: {
name: "Electron",
file: "electron.svg",
},
nextjs2: {
name: "Next.js 2",
file: "nextjs2.svg",
},
nextjs: {
name: "Next.js",
file: "nextjs.svg",
},
github: {
name: "GitHub",
file: "github.svg",
},
copilot: {
name: "Copilot",
file: "copilot.svg",
},
typescript: {
name: "TypeScript",
file: "typescript.svg",
},
docker: {
name: "Docker",
file: "docker.svg",
},
dart: {
name: "Dart",
file: "dart.svg",
},
python: {
name: "Python",
file: "python.svg",
},
flutter: {
name: "Flutter",
file: "flutter.svg",
},
django: {
name: "Django",
file: "django.svg",
},
figma: {
name: "Figma",
file: "figma.svg",
},
java: {
name: "Java",
file: "java.svg",
},
php: {
name: "PHP",
file: "php.svg",
},
ruby: {
name: "Ruby",
file: "ruby.svg",
},
swift: {
name: "Swift",
file: "swift.svg",
},
kotlin: {
name: "Kotlin",
file: "kotlin.svg",
},
aws: {
name: "AWS",
file: "aws.svg",
},
azure: {
name: "Azure",
file: "azure.svg",
},
firebase: {
name: "Firebase",
file: "firebase.svg",
},
json: {
name: "JSON",
file: "json.svg",
},
graphql: {
name: "GraphQL",
file: "graphql.svg",
},
gitlab: {
name: "GitLab",
file: "gitlab.svg",
},
linux: {
name: "Linux",
file: "linux.svg",
},
cypress: {
name: "Cypress",
file: "cypress.svg",
},
};
// Function to read SVG file
function readSvgFile(filename) {
const filePath = path.join(__dirname, "../src/assets/svg", filename);
return fs.readFileSync(filePath, "utf8");
}
// Generate the icons.json file
function generateIconsJson() {
const result = {};
for (const [key, config] of Object.entries(icons)) {
result[key] = {
name: config.name,
icon: config.url || readSvgFile(config.file),
};
}
const jsonContent = JSON.stringify(result, null, 2);
const outputPath = path.join(__dirname, "../src/data/icons.json");
fs.writeFileSync(outputPath, jsonContent);
console.log("icons.json has been generated successfully!");
}
// Run the generator
generateIconsJson();