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

Implement bun publish #1976

Closed
gaurishhs opened this issue Feb 3, 2023 · 17 comments · Fixed by #14215
Closed

Implement bun publish #1976

gaurishhs opened this issue Feb 3, 2023 · 17 comments · Fixed by #14215
Assignees
Labels
bun install Something that relates to the npm-compatible client enhancement New feature or request tracking An umbrella issue for tracking big features

Comments

@gaurishhs
Copy link
Contributor

What is the problem this feature would solve?

Publishing to NPM Registry.

What is the feature you are proposing to solve the problem?

A publish command which makes use of already logged in information through npm's cli

What alternatives have you considered?

No response

@gaurishhs gaurishhs added the enhancement New feature or request label Feb 3, 2023
@Electroid Electroid added the bun install Something that relates to the npm-compatible client label Feb 3, 2023
@Electroid Electroid changed the title Publish Command Command to publish to npm registry Feb 3, 2023
@Hebilicious
Copy link

Would be neat to also support bun publish -r for monorepos, similar to pnpm.

@joaopaulomoraes
Copy link

Some workaround?

@nyxb
Copy link

nyxb commented Sep 25, 2023

Since I would like to use only bun without installing node at all. I would also like to have a way to publish my packages

@talentlessguy
Copy link

I'm converting some of the tinyhttp stuff to use with Bun and it's the only thing preventing it right now

@morlay
Copy link

morlay commented Oct 17, 2023

Here is a simple implement without publish hooks (just work)

https://github.com/innoai-tech/nodekit/tree/main/nodedevpkg/bunpublish (published https://github.com/orgs/innoai-tech/packages/npm/package/bunpublish)

reuse install.registry.token, but may publish.registry.token in future

@morlay
Copy link

morlay commented Oct 18, 2023

split as single package https://github.com/morlay/bunpublish

@vveisard
Copy link
Contributor

If/ when this gets implemented, it would be awesome if publishConfig respected main like Yarn does.

My use case is changing the main property from ./src/index.ts during development to ./out/index.js at publish time. This way I can use internal packages in development, but also publish them as external packages.

@morlay
Copy link

morlay commented Oct 20, 2023

@vveisard may consider to use export condition instead.

"exports": {
    "bun": "./src/index.ts",
    "import": "./out/index.js"
}

Realword example: https://github.com/innoai-tech/nodekit/blob/main/nodepkg/config/package.json#L21-L43
which support nodejs too.

@FHU-yezi
Copy link

Any update for this?

@jedisct1
Copy link

Any update for this?

Here's where discussions and updates relevant to that issue are posted: #1976

@svi3c
Copy link

svi3c commented Apr 27, 2024

Running into this because the simple workaround to use npm for publishing does not easily work with bun workspaces.
If the publish command is not implemented, it would be nice to be able to reference packages in a workspace without the workspace: prefix, such that npm can process it.

@lishaduck
Copy link

Since I would like to use only bun without installing node at all. I would also like to have a way to publish my packages

You can run bun install -g npm to get npm without node, but npm (should) need node. You can run bunx --bun npm to run npm with bun. Both work on my machine, though I have both node and bun so it's hard to tell if they're working as intended.

@eliot-akira
Copy link
Contributor

eliot-akira commented Aug 20, 2024

Using bunx --bun npm is a great idea to run npm without Node.js. That should enable publishing npm packages entirely with Bun, solving these related issues.

When I first ran bunx --bun npm, it was running an existing installation of npm from Node.js. Specifying npm@latest downloaded it to /tmp and ran with Bun for sure.

So it should be possible to publish to npm registry with the following command. The --bun option seems to be unnecessary. I tried with --dry-run option and it looks like it works.

bunx npm@latest publish

@Jarred-Sumner Jarred-Sumner changed the title Command to publish to npm registry Implement bun publish Aug 27, 2024
@Jarred-Sumner Jarred-Sumner added the tracking An umbrella issue for tracking big features label Aug 27, 2024
@Jarred-Sumner
Copy link
Collaborator

@dylan-conway is working on it this week

@MunMunMiao
Copy link

MunMunMiao commented Aug 28, 2024

Hope that I can replace workspace:* when it's published.

@aryzing
Copy link

aryzing commented Sep 2, 2024

Great to hear that an implementation is underway. Would be great if the publish command could be made to work off of CLI arguments & env vars without needing any config files like .npmrc (which is currently necessary when using auth tokens).

Currently, when using a bun-only workflow, an .npmrc is still needed just for the auth token. Would be great to rely on the CLI alone.

@Jarred-Sumner
Copy link
Collaborator

bun publish will ship as part of the Bun v1.1.30 release, thanks to @dylan-conway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bun install Something that relates to the npm-compatible client enhancement New feature or request tracking An umbrella issue for tracking big features
Projects
None yet
Development

Successfully merging a pull request may close this issue.