Deno JSR API package + CLI entrypoint "best-practices"
Hey 
I have a package that is both a CLI and provides a JS API.
Previously with
But I'm not sure of the best way to do it with JSR. Should there be multiple entrypoints? It's a small library
It feels like the usage be something like this (single
I see a few options:
1. Have the
2. Have multiple entrypoints, but the imports won't be "pretty" (eg.
3. Separate the CLI into a separate package
What do you think?
Thanks!
I have a package that is both a CLI and provides a JS API.
Previously with
deno.land/x, the JS API entrypoint would be in mod.ts and the CLI entrypoint in main.ts; something like:But I'm not sure of the best way to do it with JSR. Should there be multiple entrypoints? It's a small library
It feels like the usage be something like this (single
mod.ts entrypoint):I see a few options:
1. Have the
mod.ts entrypoint exports both the JS API and the CLI (under import.meta.main)2. Have multiple entrypoints, but the imports won't be "pretty" (eg.
jsr:@scope/myThing/cli.ts)3. Separate the CLI into a separate package
3. seems a bit overkill, but 1. doesn't feel too right eitherWhat do you think?
Thanks!
