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

Importmap generator command #589

Open
unflxw opened this issue Feb 8, 2023 · 1 comment
Open

Importmap generator command #589

unflxw opened this issue Feb 8, 2023 · 1 comment

Comments

@unflxw
Copy link
Contributor

unflxw commented Feb 8, 2023

In the import maps documentation, we recommend that customers use the JSPM.io import map generator. This is not ideal, both because we're relying on linking a third-party online playground that may change without warning for a crucial step of the installation process, but also because the generator requires you to manually enter the libraries, and outputs a whole HTML page, from which users would usually copy specific subsets. I think this may get users confused.

A way we could address this is by having a command in @appsignal/cli that generates the importmap. This would be fairly straight-forward to do, as JSPM publishes a library for import map generation, which is what drives their online playground.

I'm thinking something like:

npx @appsignal/cli importmap

would generate the importmap for @appsignal/javascript alone, with additional desired packages passed as arguments:

npx @appsignal/cli importmap @appsignal/angular @appsignal/preact

would generate the combined importmap for @appsignal/javascript, @appsignal/angular and @appsignal/preact.

Alternatively, we might want to contribute this to @jspm/generator upstream, so users can do:

npx @jspm/generator importmap @appsignal/javascript @appsignal/angular @appsignal/preact

This may not be what they have in mind for their library though.

Either way, the idea would be to have more precise and reliable instructions, something less error-prone than "add these package names to the online generator (where?) and copy the import map (what's that?) and the ES module shims (???) to your application (where?)"

@tombruijn
Copy link
Member

@unflxw can you create an issue about adding a CLI to the npm package to accomplish this?

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

No branches or pull requests

2 participants