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

Runtime agnostic CLI capabilities #122

Open
maarteNNNN opened this issue Feb 28, 2025 · 1 comment
Open

Runtime agnostic CLI capabilities #122

maarteNNNN opened this issue Feb 28, 2025 · 1 comment

Comments

@maarteNNNN
Copy link

Problem

When attempting to use JSR packages with CLI functionality across different JavaScript runtimes (Deno, Node.js, Bun), there are inconsistencies in how command-line arguments are passed and processed.

For example, with the @skedia/literal-sql package:

  • In Deno, this works as expected:

    deno run --allow-read jsr:@skedia/literal-sql/cli --query "SELECT * FROM users" --where "active = true"

    Correct me if I'm wrong but I presume this is referring to the cli export in jsr.json.

  • In Node.js and Bun, there isn't a way to use the library directly from the terminal, e.g.

    npx jsr @skedia/literal-sql/cli --query "SELECT * FROM users" --where "active = true"

Expected Behavior

CLI packages published on JSR should work consistently across JavaScript runtimes.

# Deno
deno run --allow-read jsr:@package/name/cli [arguments]

# Node.js
npx jsr @package/name/cli [arguments]

# Bun
bunx jsr @package/name/cli [arguments]

Suggested Solutions

Although currently not supported by default, is JSR willing to add CLI capabilities like NPM does?

  1. Add an execution command to the JSR CLI tool, such as:
    # For Node.js
    npx jsr bin @package/name/cli [arguments]
    
    # For Bun
    bunx jsr bin @package/name/cli [arguments]

Impact

Improving cross-runtime CLI capabilities would significantly enhance the developer experience and increase adoption of JSR packages, especially for tools intended to be used from the command line.

@marvinhagemeister
Copy link
Collaborator

Although currently not supported by default, is JSR willing to add CLI capabilities like NPM does?

Yes.

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

2 participants