web-component-analyzer icon indicating copy to clipboard operation
web-component-analyzer copied to clipboard

Add Web-Types generation support

Open jpradelle opened this issue 2 years ago • 13 comments

Add Web-Types transformer to generate web-types files.

Web-Types is a project to enable IDE auto-completion for web-components, currently implemented in IntelliJ and WebStorm: https://github.com/JetBrains/web-types

For example after generating web-types file with web-component-analyzer image

jpradelle avatar Jan 20 '22 15:01 jpradelle

@runem Thank you for your great work.

Quick question: Are you interested in adding support for web types or would your prefer if we maintain a fork?

marcobeierer avatar Jul 08 '22 12:07 marcobeierer

Currently a release of fork is available here https://www.npmjs.com/package/web-component-analyzer-webtypes I would rather have it merged in this branch :) I'm currently using and maintaining the fork

jpradelle avatar Jul 08 '22 15:07 jpradelle

@jpradelle Thank you for the info, good to know :+1:

marcobeierer avatar Jul 09 '22 01:07 marcobeierer

Would any of owners/contributors be able to review this awesome PR? @rictic @43081j @runem

minijus avatar Aug 11 '22 05:08 minijus

ill try have a read through it this weekend if i can, and get my head around it.

interesting that jetbrains chose to build their own schema rather than use custom elements manifest. maybe it didn't exist when they made it.

43081j avatar Aug 11 '22 08:08 43081j

@43081j Web-Types were in development much longer than the custom-elements-manifest and are more generic as they are not tied to a particular framework. Unfortunately we haven't made it in time before custom-elements-manifest was finished. Besides for Web Components, the format is used for Vue.js, Angular, HTMX and others. It also allows pattern processing, so works with for instance Fontawesome library.

It would be awesome if the PR is merged! I will then update documentation in the web-types GitHub repo on how to generate web-types for Web Components.

piotrtomiak avatar Aug 25 '22 10:08 piotrtomiak

@piotrtomiak Great suggestion, I'll have a look to integrate that. I'll also take @Atulin work which is great, but I want to preserve a way to configure parameter in command line too, I'll need to do some adaptation: I build webtypes during release process, it needs to be build it with the next version number that will be released at end of release process

jpradelle avatar Aug 26 '22 07:08 jpradelle

@piotrtomiak I made requested update taking inspiration from @atulin work, configuration of projects is cleaner this way :) For example: https://github.com/jpradelle/polymer-web-types/commit/4996ba7bc6f0b785637d3eaae96b3ba24976560f#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519

I did not read name or version from package.json, I took it from environment variable added by npm when you run a script from npm run, so if you don't run it from npm scripts package section this doesn't find name of version and it has to be provided via command line or package.json wca configuration. I think it does the job even if it's not perfect. I did that to avoid adding new dependencies to project. I would be happy if someone has a better way to suggest

jpradelle avatar Aug 26 '22 13:08 jpradelle

For clean support of PolymerJS web comopnents, please also consider merging this PR https://github.com/runem/web-component-analyzer/pull/238

jpradelle avatar Aug 26 '22 13:08 jpradelle

i haven't had time to try it myself but what i've read so far seems fine, makes sense.

it'd be really, really nice if you could add some tests though 👀

and ideally we need a review from @rictic if he gets some spare time

43081j avatar Aug 29 '22 10:08 43081j

I added several tests

jpradelle avatar Aug 30 '22 10:08 jpradelle

Any update on this PR? Would be lovely to have a review by code owners to get support for web-types merged and released.

minijus avatar Dec 05 '22 10:12 minijus

Sorry it took so long to reply here.

I can re-review it (and will) but I think we need Peter or someone else from the lit team to review/merge. I'll see if I can pair with someone from the team in the new year and get things moving

43081j avatar Dec 25 '22 09:12 43081j