npm/pnpm/yarn
Publish packages to npm registry using Universal Release.
Detectionβ
Automatically detected when package.json exists.
Configurationβ
ecosystems:
npm:
enabled: true
registry: https://registry.npmjs.org
validation:
build: true
test: true
lint: true
prePublishScripts:
- bun audit
tag: latest
Credentialsβ
Store your npm token securely:
release secrets set NPM_TOKEN
Get your token from npmjs.com.
Publishingβ
# Publish with validation
release publish --ecosystem npm
# Dry run
release publish --ecosystem npm --dry-run
# Publish with specific tag
release publish --ecosystem npm --tag beta
Version Managementβ
# Show current version
release version
# Bump version
release version --bump patch
# Set specific version
release version --set 2.0.0
Validationβ
Universal Release validates:
- β
package.jsonexists and is valid - β
Build succeeds (
bun run build) - β
Tests pass (
bun test) - β
Linting passes (
bun run lint) - β No uncommitted changes
Rollbackβ
npm supports deprecation:
release rollback 1.2.3 --strategy deprecate
This runs npm deprecate package@1.2.3 "Rolled back due to issues".
Best Practicesβ
Use .npmignoreβ
# .npmignore
src/
tests/
*.test.ts
.github/
Configure package.jsonβ
{
"files": ["dist"],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "bun build src/index.ts --outdir dist",
"test": "bun test",
"prepublishOnly": "bun run build"
}
}
Bun Native Publishingβ
Universal Release uses bun publish which is faster than npm publish:
// Internally uses:
await $`bun publish --access public`.cwd(packagePath);
Next Stepsβ
- Version Management - Version strategies
- Configuration - Advanced setup