mirror of
https://github.com/iconify/iconify.git
synced 2024-12-12 13:47:49 +00:00
chore(utils): use autoInstall only for last cwd in node loader
This commit is contained in:
parent
c2a76b13ac
commit
5ff09d6936
@ -17,12 +17,12 @@ export const loadNodeIcon: UniversalIconLoader = async (
|
|||||||
|
|
||||||
const cwds = Array.isArray(options?.cwd) ? options.cwd : [options?.cwd];
|
const cwds = Array.isArray(options?.cwd) ? options.cwd : [options?.cwd];
|
||||||
|
|
||||||
for (const cwd of cwds) {
|
for (let i = 0; i < cwds.length; i++) {
|
||||||
const iconSet = await loadCollectionFromFS(
|
const iconSet = await loadCollectionFromFS(
|
||||||
collection,
|
collection,
|
||||||
options?.autoInstall,
|
i === cwds.length - 1 ? options?.autoInstall : false,
|
||||||
undefined,
|
undefined,
|
||||||
cwd
|
cwds[i]
|
||||||
);
|
);
|
||||||
if (iconSet) {
|
if (iconSet) {
|
||||||
result = await searchForIcon(
|
result = await searchForIcon(
|
||||||
@ -31,13 +31,13 @@ export const loadNodeIcon: UniversalIconLoader = async (
|
|||||||
getPossibleIconNames(icon),
|
getPossibleIconNames(icon),
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
if (result) break;
|
if (result) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result && options?.warn) {
|
if (options?.warn) {
|
||||||
warnOnce(`failed to load ${options.warn} icon`);
|
warnOnce(`failed to load ${options.warn} icon`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
};
|
||||||
|
@ -187,6 +187,8 @@ export type IconifyLoaderOptions = {
|
|||||||
*
|
*
|
||||||
* Only used on `node` environment.
|
* Only used on `node` environment.
|
||||||
*
|
*
|
||||||
|
* If value is an array and `autoInstall` is enabled, `autoInstall` will be used only for last entry.
|
||||||
|
*
|
||||||
* @default process.cwd()
|
* @default process.cwd()
|
||||||
*/
|
*/
|
||||||
cwd?: string | string[];
|
cwd?: string | string[];
|
||||||
|
Loading…
Reference in New Issue
Block a user