iconify / icon-sets

150+ open source icon sets. Icons are validated, cleaned up, optimised, ready to render as SVG. Updated automatically 3 times a week.
https://icon-sets.iconify.design/
647 stars 63 forks source link

feat: add esm support #17

Closed userquin closed 3 years ago

userquin commented 3 years ago

I have included types declared on iconify types.

cyberalien commented 3 years ago

Right. I'll move that type to @iconify/types because it can be used by multiple packages.

userquin commented 3 years ago

do you donwload and test the vite example?

cyberalien commented 3 years ago

Yes. It works well. As far as I can tell, the only thing needed for it is addition of this type to @iconify/types:

declare type IconSetInfo = {
    info: IconifyInfo;
    icons: IconifyJSON;
    metadata: IconifyMetaData;
    chars: IconifyChars;
};

Is that correct?

userquin commented 3 years ago

I mix this PR with my another branch on the issue #15, sorry.

So, do you want the code on this PR or the code on this branch https://github.com/userquin/collections-json/tree/feat/esm-support-icon-set?

If you want the code on my branch, revert this PR, I'll close it, then I'll make a new PR from the other branch...

cyberalien commented 3 years ago

Added that type to @iconify/types as IconifyJSONPackageExports.

Yes, this stuff belongs to that issue, so can continue there.

And yes, that branch with workspaces looks promising. I think it would be a good idea to use it.

userquin commented 3 years ago

do you want a PR to have it here?

EDIT: I can update the version for @iconify/types and remove the @iconify/internal-types package (copying the function on its index.ts module to json and icon-set-resolver packages).

cyberalien commented 3 years ago

Yes.

For next branch I'll be changing formatting. Current @antfu/eslint-config is not usable with Prettier. More specifically:

userquin commented 3 years ago

@cyberalien ok, I'll make a PR later, I'm busy right now, later you can change what you want.

EDIT: The new PR will have conflicts since the base is now this PR.

About prettier ask about it to Anthony.

userquin commented 3 years ago

Added that type to @iconify/types as IconifyJSONPackageExports.

Yes, this stuff belongs to that issue, so can continue there.

And yes, that branch with workspaces looks promising. I think it would be a good idea to use it.

Have you release that new version? On the repo I cannot see IconifyJSONPackageExports type.

OK I can see it, it is on next branch, and published on npm.

cyberalien commented 3 years ago

Don't worry about conflicts, just base it on last commit before my changes or overwrite stuff. I'll redo formatting changes later.

userquin commented 3 years ago

Don't worry about conflicts, just base it on last commit before my changes or overwrite stuff. I'll redo formatting changes later.

You have it merged

cyberalien commented 3 years ago

A small update on code I've posted above. If you are using code to convert legacy icon set info to proper type, that function is now part of Utils package to get rid of code duplication:

import { convertIconSetInfo } from '@iconify/utils/lib/icon-set/convert-info';
userquin commented 3 years ago

@cyberalien that code should be used on the PR opened, we'll use it to generate the test before you publish it.