Skip to content

Runtime agnostic CLI capabilities #122

Open
@maarteNNNN

Description

@maarteNNNN

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions