Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a field for "elementVersion"? #47

Open
daattali opened this issue Feb 26, 2021 · 6 comments
Open

Add a field for "elementVersion"? #47

daattali opened this issue Feb 26, 2021 · 6 comments

Comments

@daattali
Copy link

I think it would be helpful to specify a version for the custom element. For example, if I add a few major properties/events to an element, I should be able to say that the element is now version 2.0.0

@justinfagnani
Copy link
Collaborator

The assumption so far is that this file is published with an NPM package and so the containing package version is the version for everything contained within.

Thinking about this a bit more, I think we should support cases where the manifest is not necessarily associated w/ a package.json (ie, if a bunch are bundled) and we should optionally support duplicating some of the package info, like name and version, in the Package interface.

@daattali
Copy link
Author

While many (most?) custom elements built today do seem to be available as npm packages, I do think it's important to stay npm-agnostic and not assume/require that an npm package is created alongside the custom element.

@hsablonniere
Copy link

hsablonniere commented Jun 21, 2021

I think we should support cases where the manifest is not necessarily associated w/ a package.json

I think so too. If we take the devtools addon @Matsuuu is working on, there is a need for some browser based tools to know about the custom elements that are running without having to know they came from npm. The CEM could be referenced in the source like we do with sourcemaps for such cases.

@thepassle
Copy link
Collaborator

I wonder what the usecases are where we can have access to a custom-elements.json, but not a package.json.

It might be a bit double, but I do think it could be useful to have a version and even something like a packageName on the Package doc, which could be used to create URLs for things like unpkg, e.g. https://unpkg.com/${packageName}@${version}?module

@Matsuuu
Copy link

Matsuuu commented Jun 22, 2021

Something that I've grown accustomed to from the Vim/NeoVim scene is that each plugin is named by the repo it resides in.

e.g.
Plugin Matsuuu/pinkmare can be found in https://github.com/Matsuuu/pinkmare

So to expand on the idea @thepassle proposed, it would be really nice to be able to link a web component to the github repo it resides in, and maybe other sites like npm.

As for the implementation. I'm going to assume that a big portion or people run a analysis tool on a project with a package.json, and the package.json format has a repository -field. We could take it straight from there. Other cases could be that it could be given through a configuration file or a command line argument, and then appended to the manifest.

This could allow tooling / plugin developers to link the component to a external repository with ease.


An example use case for this could be the Developer Tools I'm working on. As a lot of sites using web components ship packaged by some tool, the source can be transpiled, minified, etc. But a user inspecting said page with Web Component DevTools might be interested in "How they created this component".

As the user inspects the component, if the developers included the repository url in the manifest, there would appear a link to the github repository, if not even the exact file, for the user to follow and see the actual implementation.

This would also help people find the actual implementation source for typescript components, which are transpiled by default.

@justinfagnani
Copy link
Collaborator

I agree with @thepassle. I think we could consider optional packageVersion and packageName fields for the entire manifest, but I don't think we should version individual declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants