iconify / json-tools.js

Functions for manipulating Iconify JSON SVG collections (Node.js version)
MIT License
7 stars 2 forks source link

icons.rootDir is not a function #5

Open J-env opened 1 year ago

J-env commented 1 year ago
image
cyberalien commented 1 year ago

Sorry, ignore my previous reply. You have posted issue to wrong repository, this is for @iconify/json-tools package.

rootDir() doesn't exist in new version. Use locate():

const { locate } = require('@iconify/json');
return locate(name);
muety commented 1 year ago

Could someone have a look into fixing this, please? :)

cyberalien commented 1 year ago

There is nothing to fix. You are trying to use function that doesn't exist, but there is a different function. See example above.

muety commented 1 year ago

Sure, but I'm not using the non-existing function myself, but it's rather called inside findIconifyCollection(), so would require an update to the json-tools library.

cyberalien commented 1 year ago

Thanks! Now it makes sense.

This package has version 1 of @iconify/json as dependency, where that function exists. In version 2 it no longer exists, so with intended version it does work correctly.

This package is deprecated and no longer maintained, though I forgot to update readme file to mention it and to archive it.

I'll probably see if it can be updated to support both versions. If it works, I'll publish update. However, package will still be marked as deprecated.

muety commented 1 year ago

Alright, I see! As a quick workaround for people, who still want to keep using their scripts, I figured that you can also just replace collection.loadIconifyCollection(name) by collection.loadFromFile(locate(prefix)).