diff --git a/.changeset/six-parents-know.md b/.changeset/six-parents-know.md new file mode 100644 index 0000000..d7bb3e6 --- /dev/null +++ b/.changeset/six-parents-know.md @@ -0,0 +1,5 @@ +--- +"astro-icon": patch +--- + +Fixes an issue that caused installed `@iconify-json/*` packages to not be detected in production environments diff --git a/packages/core/package.json b/packages/core/package.json index 2cb02ed..b999239 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -49,8 +49,7 @@ "dependencies": { "@iconify/tools": "^3.0.1", "@iconify/types": "^2.0.0", - "@iconify/utils": "^2.1.5", - "@skarab/detect-package-manager": "^1.0.0" + "@iconify/utils": "^2.1.5" }, "devDependencies": { "@types/node": "^18.18.0", diff --git a/packages/core/src/loaders/loadIconifyCollections.ts b/packages/core/src/loaders/loadIconifyCollections.ts index ccb7ee7..f6e5627 100644 --- a/packages/core/src/loaders/loadIconifyCollections.ts +++ b/packages/core/src/loaders/loadIconifyCollections.ts @@ -6,10 +6,8 @@ import type { import type { AutoInstall } from "../../typings/iconify"; import { readFile } from "node:fs/promises"; -import { detectAgent } from "@skarab/detect-package-manager"; import { getIcons } from "@iconify/utils"; import { loadCollectionFromFS } from "@iconify/utils/lib/loader/fs"; -import { fileURLToPath } from "node:url"; import { promisify } from "node:util"; import { exec } from "node:child_process"; @@ -89,29 +87,13 @@ export async function loadCollection( async function detectInstalledCollections(root: URL) { try { - const agent = await detectAgent(fileURLToPath(root)); let packages: string[] = []; - if (!agent) { - const text = await readFile(new URL("./package.json", root), { - encoding: "utf8", - }); - const { dependencies = {}, devDependencies = {} } = JSON.parse(text); - packages.push(...Object.keys(dependencies)); - packages.push(...Object.keys(devDependencies)); - } else { - const { stdout: text } = await execa(`${agent.name} list --json`); - const data = JSON.parse(text); - if (Array.isArray(data)) { - for (const { dependencies = {}, devDependencies = {} } of data) { - packages.push(...Object.keys(dependencies)); - packages.push(...Object.keys(devDependencies)); - } - } else { - const { dependencies = {}, devDependencies = {} } = data; - packages.push(...Object.keys(dependencies)); - packages.push(...Object.keys(devDependencies)); - } - } + const text = await readFile(new URL("./package.json", root), { + encoding: "utf8", + }); + const { dependencies = {}, devDependencies = {} } = JSON.parse(text); + packages.push(...Object.keys(dependencies)); + packages.push(...Object.keys(devDependencies)); const collections = packages .filter((name) => name.startsWith("@iconify-json/")) .map((name) => name.replace("@iconify-json/", "")); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8c13e6f..774bdc0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -51,9 +51,6 @@ importers: "@iconify/utils": specifier: ^2.1.5 version: 2.1.13 - "@skarab/detect-package-manager": - specifier: ^1.0.0 - version: 1.0.0 devDependencies: "@types/node": specifier: ^18.18.0 @@ -1614,14 +1611,6 @@ packages: requiresBuild: true optional: true - /@skarab/detect-package-manager@1.0.0: - resolution: - { - integrity: sha512-CuU1x6LgkJIF+H8FCnKijx6DbWVP1Y7kqPk88LSxNe0ulbe3BZ37qd3AaX3t5vnFZESLFMcjQd2dlPhdvWNSdQ==, - } - engines: { node: ">=14", pnpm: ">=7" } - dev: false - /@trysound/sax@0.2.0: resolution: {