new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Bun · Package manager · all subjects

publish

12 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

bun publish basic usage

The `bun publish` command packs your package into a tarball, strips catalog and workspace protocols from the package.json (resolving versions if necessary), and publishes to the registry specified in your configuration files. Both bunfig.toml and .npmrc files are supported. Run with `bun publish` in the current working directory.

bun publish with tarball path

To pack and publish separately, run `bun pm pack` to create a tarball, then `bun publish` with the path to the output tarball file. For example: `bun publish ./package.tgz`.

bun publish lifecycle scripts behavior

The `bun publish` command does not run lifecycle scripts (prepublishOnly, prepack, prepare, postpack, publish, postpublish) if a tarball path is provided. Lifecycle scripts run only when `bun publish` packs the package itself.

bun publish --access flag

The `--access` flag sets the access level of the package being published, either `public` or `restricted`. Unscoped packages are always public, and publishing an unscoped package with `--access restricted` is an error. Example: `bun publish --access public`. The `--access` option can also be set in the `publishConfig` field of package.json.

bun publish --tag flag

The `--tag` flag sets the tag of the package version being published. The default tag is `latest`. The initial version of a package is always given the `latest` tag in addition to the specified tag. Example: `bun publish --tag alpha`. The `--tag` option can also be set in the `publishConfig` field of package.json.

bun publish --dry-run flag

The `--dry-run` flag runs the publish process without publishing the package, allowing you to verify what would be published. Example: `bun publish --dry-run`.

bun publish --tolerate-republish flag

The `--tolerate-republish` flag exits with code 0 instead of 1 if the package version already exists. This is useful in CI/CD where jobs may be re-run. Example: `bun publish --tolerate-republish`.

bun publish --gzip-level flag

The `--gzip-level` flag sets the gzip compression level used when packing the package, from 0 to 9 with a default of 9. This flag only applies to `bun publish` without a tarball path argument.

bun publish --auth-type flag

The `--auth-type` flag tells the npm registry which authentication method to use for 2FA. Valid values are `web` (the default) or `legacy`. When 2FA is enabled, `bun publish` prompts for a one-time password. Example: `bun publish --auth-type legacy`.

bun publish --otp flag

The `--otp` flag provides a one-time password directly to the CLI. If the password is valid, `bun publish` skips the extra one-time password prompt before publishing. Example: `bun publish --otp 123456`.

bun publish NPM_CONFIG_TOKEN environment variable

The `bun publish` command respects the `NPM_CONFIG_TOKEN` environment variable, which is useful when publishing from GitHub Actions or other automated workflows.

Workspace protocol version replacement on publish

When publishing, Bun replaces workspace: versions with the package's package.json version. 'workspace:*' becomes '1.0.1', 'workspace:^' becomes '^1.0.1', 'workspace:~' becomes '~1.0.1'. A specific version takes precedence: 'workspace:1.0.2' becomes '1.0.2' even if the current version is 1.0.1.

Give your agent this brain