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",
|
"description": "Iconify API",
|
||||||
"author": "Vjacheslav Trushkin",
|
"author": "Vjacheslav Trushkin",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "3.1.0-beta.4",
|
"version": "3.1.0-beta.5",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public",
|
"access": "public",
|
||||||
"tag": "next"
|
"tag": "next"
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { createRequire } from 'node:module';
|
||||||
import { dirname } from 'node:path';
|
import { dirname } from 'node:path';
|
||||||
import { Importer } from '../../types/importers.js';
|
import { Importer } from '../../types/importers.js';
|
||||||
import { createIconSetsPackageImporter } from '../../importers/full/json.js';
|
import { createIconSetsPackageImporter } from '../../importers/full/json.js';
|
||||||
|
|
@ -8,6 +9,11 @@ import { DirectoryDownloader } from '../../downloaders/directory.js';
|
||||||
* Create importer for package
|
* Create importer for package
|
||||||
*/
|
*/
|
||||||
export function createPackageIconSetImporter(packageName = '@iconify/json'): Importer {
|
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), {});
|
return createIconSetsPackageImporter(new DirectoryDownloader<ImportedData>(dir), {});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ export async function initAPI(options: InitOptions = {}) {
|
||||||
let importers = options.importers;
|
let importers = options.importers;
|
||||||
if (!importers) {
|
if (!importers) {
|
||||||
importers = await getImporters();
|
importers = await getImporters();
|
||||||
for (let i = 0; i < importers.length; i++) {
|
}
|
||||||
await importers[i].init();
|
for (let i = 0; i < importers.length; i++) {
|
||||||
}
|
await importers[i].init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue