mirror of https://github.com/iconify/api.git
chore: fix full local package importer
This commit is contained in:
parent
a391ce96cf
commit
95423f118b
|
|
@ -3,7 +3,7 @@
|
|||
"description": "Iconify API",
|
||||
"author": "Vjacheslav Trushkin",
|
||||
"license": "MIT",
|
||||
"version": "3.1.0-beta.4",
|
||||
"version": "3.1.0-beta.5",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"tag": "next"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { createRequire } from 'node:module';
|
||||
import { dirname } from 'node:path';
|
||||
import { Importer } from '../../types/importers.js';
|
||||
import { createIconSetsPackageImporter } from '../../importers/full/json.js';
|
||||
|
|
@ -8,6 +9,11 @@ import { DirectoryDownloader } from '../../downloaders/directory.js';
|
|||
* Create importer for package
|
||||
*/
|
||||
export function createPackageIconSetImporter(packageName = '@iconify/json'): Importer {
|
||||
const dir = dirname(import.meta.resolve(`${packageName}/package.json`));
|
||||
// const dir = dirname(import.meta.resolve(`${packageName}/package.json`));
|
||||
|
||||
const req = createRequire(import.meta.url);
|
||||
const filename = req.resolve(`${packageName}/package.json`);
|
||||
const dir = dirname(filename);
|
||||
|
||||
return createIconSetsPackageImporter(new DirectoryDownloader<ImportedData>(dir), {});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ export async function initAPI(options: InitOptions = {}) {
|
|||
let importers = options.importers;
|
||||
if (!importers) {
|
||||
importers = await getImporters();
|
||||
}
|
||||
for (let i = 0; i < importers.length; i++) {
|
||||
await importers[i].init();
|
||||
}
|
||||
}
|
||||
|
||||
// Update
|
||||
setImporters(importers);
|
||||
|
|
|
|||
Loading…
Reference in New Issue