Closed quarkus closed 3 years ago
This is not as easy as I thought...
All the known CDNs only serve from the normal npm registry and don't have a mechanism to change the registry. Since we are hosting our packages on the https://npm.pkg.github.com/ registry we currently cannot simply use those tools.
I have requested feedback for unpkg and jsdelivr:
https://github.com/mjackson/unpkg/issues/277 https://github.com/jsdelivr/jsdelivr/issues/18261
another option could be to host unpkg ourselfs (https://github.com/mjackson/unpkg/pull/216) - but I'd rather not..
A solution that we could use for the time being is manually generating the /dist folder locally and pushing it up. If the /dist folder was inside the git repository we could fetch the files via jsDelivr like so: https://cdn.jsdelivr.net/gh/webtides/element-js@0.3.0/src/
But I'm pretty sure that this would be quite error-prone...
As mentioned in the comment above, I have a "solution" in https://github.com/webtides/element-js/compare/feature/dist-bundle
The GitHub action will run the "npm run build" script and push it back to the main branch. With this in place we would be able to read the /dist bundles via https://cdn.jsdelivr.net/gh/webtides/element-js@v0.4.0-2/dist/
The only problem with this is that we will only be able to read from @latest and not from specific tags. This is because the action will always run after the tagged commit...
But it would work in theory! See: https://codepen.io/eddyloewen/full/abZdNaj
The GitHub action will run the "npm run build" script and push it back to the main branch. With this in place we would be able to read the /dist bundles via https://cdn.jsdelivr.net/gh/webtides/element-js@v0.4.0-2/dist/
If you go this way, I recommend tagging sources as v0.4.0-source
on the main branch and then pushing dist
to a separate branch, and tagging that as v0.4.0
.
If you go this way, I recommend tagging sources as
v0.4.0-source
on the main branch and then pushingdist
to a separate branch, and tagging that asv0.4.0
.
Yeah! That is a good idea 👍 But I think I would then prefer to not use the GitHub package registry and instead use the NPM registry.
But I think I would then prefer to not use the GitHub package registry and instead use the NPM registry.
Yes, that sounds better.
I would like to be able to use element-js via cdn (unpkg i.E.) for rapid prototyping.