@@ -6,10 +6,8 @@ import type {
6
6
import type { AutoInstall } from "../../typings/iconify" ;
7
7
8
8
import { readFile } from "node:fs/promises" ;
9
- import { detectAgent } from "@skarab/detect-package-manager" ;
10
9
import { getIcons } from "@iconify/utils" ;
11
10
import { loadCollectionFromFS } from "@iconify/utils/lib/loader/fs" ;
12
- import { fileURLToPath } from "node:url" ;
13
11
import { promisify } from "node:util" ;
14
12
import { exec } from "node:child_process" ;
15
13
@@ -89,29 +87,13 @@ export async function loadCollection(
89
87
90
88
async function detectInstalledCollections ( root : URL ) {
91
89
try {
92
- const agent = await detectAgent ( fileURLToPath ( root ) ) ;
93
90
let packages : string [ ] = [ ] ;
94
- if ( ! agent ) {
95
- const text = await readFile ( new URL ( "./package.json" , root ) , {
96
- encoding : "utf8" ,
97
- } ) ;
98
- const { dependencies = { } , devDependencies = { } } = JSON . parse ( text ) ;
99
- packages . push ( ...Object . keys ( dependencies ) ) ;
100
- packages . push ( ...Object . keys ( devDependencies ) ) ;
101
- } else {
102
- const { stdout : text } = await execa ( `${ agent . name } list --json` ) ;
103
- const data = JSON . parse ( text ) ;
104
- if ( Array . isArray ( data ) ) {
105
- for ( const { dependencies = { } , devDependencies = { } } of data ) {
106
- packages . push ( ...Object . keys ( dependencies ) ) ;
107
- packages . push ( ...Object . keys ( devDependencies ) ) ;
108
- }
109
- } else {
110
- const { dependencies = { } , devDependencies = { } } = data ;
111
- packages . push ( ...Object . keys ( dependencies ) ) ;
112
- packages . push ( ...Object . keys ( devDependencies ) ) ;
113
- }
114
- }
91
+ const text = await readFile ( new URL ( "./package.json" , root ) , {
92
+ encoding : "utf8" ,
93
+ } ) ;
94
+ const { dependencies = { } , devDependencies = { } } = JSON . parse ( text ) ;
95
+ packages . push ( ...Object . keys ( dependencies ) ) ;
96
+ packages . push ( ...Object . keys ( devDependencies ) ) ;
115
97
const collections = packages
116
98
. filter ( ( name ) => name . startsWith ( "@iconify-json/" ) )
117
99
. map ( ( name ) => name . replace ( "@iconify-json/" , "" ) ) ;
0 commit comments