Skip to content

fix: add bin field to npm compat tarballs#284

Open
lucacasonato wants to merge 1 commit intomainfrom
npm_bin_field
Open

fix: add bin field to npm compat tarballs#284
lucacasonato wants to merge 1 commit intomainfrom
npm_bin_field

Conversation

@lucacasonato
Copy link
Copy Markdown
Contributor

Fixes #157

Still need to add tests.

Comment on lines +457 to +458
Unlike npm, JSR does not have a special field in the `jsr.json` / `deno.json` to
specify bin entrypoints. Instead, include the bin entrypoints in the `exports`
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might make it difficult to publish existing packages to JSR, unless https://github.com/nodejs/modules/issues/274

Copy link
Copy Markdown
Contributor Author

@lucacasonato lucacasonato Mar 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you say so? Your bin entrypoint does not have to be in the root entrypoint.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not exactly thrilled about having to resort to hacks, or rethink my package.json to match JSR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be fine with this if JSR transpiled import.meta.main to something Node can understand.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's should be resolved in newest node.js version !

Comment on lines +479 to +481
`bin` field is added to the `package.json` in the generated npm compatible
tarball. JSR will put all files specified in the `exports` in this field that
contain a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)#Examples). JSR
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs should specify what shebang should universal code use. I believe it should be a Node shebang, since Deno will ignore it.

@pawk3k
Copy link
Copy Markdown

pawk3k commented Jul 23, 2024

@wojpawlik @lucacasonato , do you need some help to push it forward ?

@vikingair
Copy link
Copy Markdown

Really sad progress here. Sadly then, I need to switch again to npm for my current package.

@KnorpelSenf
Copy link
Copy Markdown
Contributor

Still need to add tests.

@lucacasonato can this be accelerated if somebody contributes tests via a second PR that targets this branch?

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

Successfully merging this pull request may close these issues.

Add npx-like behavior

6 participants