@opndev/rzilla
v0.0.4
Published
Release zilla for npm packages
Maintainers
Readme
@opndev/rzilla
Release zilla for npm packages.
rzil lets you replace manual package.json maintenance with a
declarative dist.toml file.
Inspired by Dist::Zilla, but for npm.
Philosophy
dist.tomlis the source of truth.package.jsonis a generated artifact.- Strict where ambiguity is dangerous.
- Ergonomic where it does not matter.
- No automatic pushing.
- Deterministic releases.
Commands
The following commands are listed, but maybe incomplete. Please run the actual script for an update to date listing.
rzil pkg # Generate package.json from dist.toml
rzil release # Run release workflow
rzil test # npm test
rzil build # Run build workflow
rzil clean # Clean the .build dir
rzil prereqs # List all the dependenciesdist.toml Example
name = "@opndev/rzilla"
description = "Release zilla for npm packages"
type = "module"
keywords = ["release","npm","changes","git"]
[license]
spdx = "MIT"
file = "LICENSES/MIT.txt"
[author]
name = "Your Name"
email = "[email protected]"
[repository]
remote = "origin"
[prereqs]
node = ">= 18 < 22"
npm = ">= 9"
lodash = "^4.17.0"
[prereqs.dev]
tap = "latest"
jsdoc = "0"
[prereqs.peer]
left-pad = "latest"
[gather]
main = "lib/index.mjs"
bin = "bin"
files = "lib/**/*.mjs"
include = ["README.md"]
[exports]
__DOT__ = "lib/index.mjs"
foo = "lib/foo.mjs"
[release]
changes = "Changes"
tagPrefix = "v"
bump = "patch"
access = "public"
[release.preflight]
dirty = "dist.toml"
airplane = false
[release.after]
commit = ["Changes", "dist.toml", "package.json"]
bump = trueKey Concepts
package.json is generated
Run:
rzil pkgThis creates:
package.jsonbinentries fromgather.binexportsmap- dependencies from
[prereqs] - engines from
nodeandnpm - repository + homepage derived from git remote
Do not edit package.json manually.
Prereqs
Prereqs or dependencies can be set via [prereqs] and friends:
[prereqs]
node = ">= 18 < 22"
npm = ">= 9"
foo = "^1.2.3"
bar = 0
baz = "latest"Mapping:
node→engines.nodenpm→engines.npm- others →
dependencies 0→"*"- Spaces in ranges are normalized (
"> 18 < 22"→">18 <22")
[prereqs.test]
tap = "latest"
[prereqs.peer]
left-pad = "latest"Autoprereqs
When enabled, rzil scans your source tree and fills in missing dependencies:
[autoprereqs]
# enabled when the table exists
# enabled = true
ignore = ["node:fs"]- Runtime imports (uses the
[gather]paths/globs) are added todependencies. - Test imports (from
t/,test/,tests/,__tests__/) are added todevDependencies. - Inferred versions default to
"latest". - Explicit entries in
[prereqs]always win. - Relative imports and Node builtins are ignored.
Gather
[gather]
main = "lib/index.mjs"
bin = ["bin", "cli"]
files = "lib/**/*.mjs"
include = ["README.md"]maindefines the root export"."binauto-discovers CLI filesfilesandincludepopulatepackage.json.filesbinsupports string or array- You don't need to add your license file, it is taken from
license.file.
License
[license]
spdx = "MIT"
file = "LICENSES/MIT.txt"spdxbecomespackage.json.license.fileis written asLICENSEin the build artifact.
Exports
[exports]
__DOT__ = "lib/index.mjs"
foo = "lib/foo.mjs"
[exports.deny]
testing = trueRules:
__DOT__→"."- other keys →
"./key" exports.denyremoves subpathsexports.deny.__DOT__is forbidden
If [exports] exists, you fully control the export surface.
Repository
[repository]
remote = "origin"
provider = "github" # optionalrzil:
- reads
git remote - derives
repository.url - derives
repository.homepage - derives
bugs.urlif[bugtracker]exists - supports github, gitlab, codeberg, bitbucket
- supports private hosts with
provider
rzil never pushes automatically.
Release Workflow
rzil releaseSteps:
- Check
{{ NEXT }}in Changes has entries - Run tests
- Check git dirty state (with allowlist)
- Create a build directory (
.build/<id>/and.build/current) - Copy only publishable files into the build directory
- Generate
package.json(and other build artifacts) into the build directory - Finalize Changes
- Commit release
- Tag release
npm publishfrom.build/current(unless airplane mode)- Restore
{{ NEXT }} - Bump version (optional)
- Commit post-release files
You push manually.
Airplane mode disables network actions.
Status
Early-stage but functional.
Code of Conduct
Be human.
Developer notes about this package
Semver
This project does not adhere to semver and one should not rely on the version x.y.z notation to infer stability or reliability. Read the Changes file to see any updates a version may bring. The fact that this module sits currently at 0.x.z ranges does not indicate alpha or beta or even unstable associations. It is just a number and we started at 0.0.1.
In general the following hard guarantee will be given: We will not break your code. In case we do happen to cause breakage: we will fix it accordingly.
In case we foresee breaking changes we'll add deprecation warnings. Giving you time to fix things before a breaking change will be introduced. When a change will be introduced is communicated in the Changes file. Security fixes may cause breakage at any given time without notice.
This package is released by itself, so obviously changes to package.json will
be overridden. Versioning for humans yo, not machines. Rawr.
