Skip to content

Commit

Permalink
chore(deps): remove axios dev-dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
rektdeckard committed Mar 29, 2024
1 parent 344781e commit 036f857
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 72 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
},
"devDependencies": {
"@types/node": "^18",
"axios": "^1.2.2",
"chalk": "^4",
"commander": "^9.5.0",
"prettier": "^2.8.3",
Expand Down
64 changes: 0 additions & 64 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions scripts/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"use strict";

import fs from "node:fs/promises";
import axios from "axios";
import chalk from "chalk";
import { Command } from "commander";

Expand Down Expand Up @@ -36,11 +35,13 @@ const ICON_API_URL = "https://api.phosphoricons.com";
try {
await assertValidAssets();

const res = await axios.get<IconAPIResponse>(`${ICON_API_URL}?${params}`);
if (res.data) {
assertValidApiResponse(res.data);
const res = (await (
await fetch(`${ICON_API_URL}?${params}`)
).json()) as IconAPIResponse;
if (res) {
assertValidApiResponse(res);

res.data.icons.sort((a, b) => (a.name < b.name ? -1 : 1));
res.icons.sort((a, b) => (a.name < b.name ? -1 : 1));

let fileString = `\
import { IconEntry, IconCategory, FigmaCategory } from "./types";
Expand All @@ -50,7 +51,7 @@ export type PhosphorIcon = typeof icons[number]
export const icons = <const>[
`;

res.data.icons.forEach((icon) => {
res.icons.forEach((icon) => {
let categories = "[";
icon.search_categories?.forEach((c) => {
categories += `IconCategory.${c.toUpperCase()},`;
Expand Down Expand Up @@ -92,7 +93,7 @@ export const icons = <const>[
try {
await fs.writeFile(CATALOG_PATH, fileString);
console.info(
`${chalk.green(" DONE ")} ${res.data.icons.length} icons ingested`
`${chalk.green(" DONE ")} ${res.icons.length} icons ingested`
);
} catch (e) {
console.error(`${chalk.inverse.red(" FAIL ")} Could not write file`);
Expand Down

0 comments on commit 036f857

Please sign in to comment.