Skip to content

Commit

Permalink
fix: auto install to devDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 1, 2021
1 parent 08657d7 commit 3bd5566
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/core/loader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import createDebugger from 'debug'
import { isPackageExists } from 'local-pkg'
import { installPackage } from '@antfu/install-pkg'
import { sleep } from '@antfu/utils'
import { ResolvedOptions } from '../types'
import { searchForLegacyIcon } from './legacy'
import { loadCollection, ResolvedIconPath, searchForIcon } from './modern'
Expand Down Expand Up @@ -76,7 +77,8 @@ export async function getBuiltinIcon(collection: string, icon: string, options?:

if (!iconSet) {
if (options?.autoInstall && !legacyExists) {
await installPackage(`@iconify-json/${collection}`)
await installPackage(`@iconify-json/${collection}`, { dev: true })
await sleep(300)
iconSet = await loadCollection(collection)
}
}
Expand All @@ -95,7 +97,8 @@ export async function getBuiltinIcon(collection: string, icon: string, options?:

if (options?.iconSource === 'legacy') {
if (!legacyExists && options?.autoInstall) {
await installPackage('@iconify/json')
await installPackage('@iconify/json', { dev: true })
await sleep(300)
legacyExists = true
}
return await searchForLegacyIcon(collection, ids, options)
Expand Down

0 comments on commit 3bd5566

Please sign in to comment.