Skip to content

Commit

Permalink
Simple-icons package info
Browse files Browse the repository at this point in the history
  • Loading branch information
wyatt-herkamp committed Jan 12, 2024
1 parent ef95a2f commit 23766af
Show file tree
Hide file tree
Showing 6 changed files with 14,676 additions and 14,664 deletions.
2 changes: 1 addition & 1 deletion buildTools/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules
.vscode
test
test.components.json
test.simple-icons.json
4 changes: 2 additions & 2 deletions buildTools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"type": "module",
"version": "0.0.0",
"scripts": {
"dev": "deno run --allow-all src/main.ts --target test --component-json test.components.json",
"build": "deno run --allow-all src/main.ts --target ../src --component-json ../components.json",
"dev": "deno run --allow-all src/main.ts --target test --info-json test.simple-icons.json",
"build": "deno run --allow-all src/main.ts --target ../src --info-json ../simple-icons.json",
"format": "deno run -A npm:@biomejs/biome format src --write",
"lint": "deno run -A npm:@biomejs/biome lint src",
"check": "deno run -A npm:@biomejs/biome check --apply src"
Expand Down
22 changes: 15 additions & 7 deletions buildTools/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ await new Command()
.option("--simple-icons [simpleIcons:file]", "Path to simple-icons", {
default: "node_modules/simple-icons",
})
.option("--component-json [componentJson:file]", "Path to component.json", {
default: "component.json",
.option("--info-json [infoJson:file]", "Path to infoJson.json", {
default: "simple-icons.json",
})
.action(async ({ target, simpleIcons, componentJson }) => {
.action(async ({ target, simpleIcons, infoJson }) => {
const source = !simpleIcons
? "node_modules/simple-icons"
: (simpleIcons as string);
const finalTarget = !target ? "test" : (target as string);
const jsonOutput = !componentJson ? "component.json" : (componentJson as string);
const jsonOutput = !infoJson ? "simple-icons.json" : (infoJson as string);
await buildIcons(finalTarget, source, jsonOutput);
})
.parse(Deno.args);
Expand Down Expand Up @@ -85,11 +85,19 @@ async function buildIcons(targetFolder: string, sourceFolder: string, componentJ
components.push(component);
}
await buildIndex(components, targetFolder);

await Deno.writeTextFile(componentJson, JSON.stringify(components, null, 2));
const info: SimpleIconsInfoFile = {
builtOn: new Date(),
simpleIconsVersion: simpleIconsVersion,
components,
};
await Deno.writeTextFile(componentJson, JSON.stringify(info, null, 2));
console.log("Done");
}

interface SimpleIconsInfoFile{
builtOn: Date;
simpleIconsVersion: string;
components: Component[];
}
interface Component {
originalTitle: string;
componentName: string;
Expand Down
Loading

0 comments on commit 23766af

Please sign in to comment.