appsignal-javascript
appsignal-javascript copied to clipboard
Importmap generator command
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?)"
@unflxw can you create an issue about adding a CLI to the npm package to accomplish this?