Add support for packages.json #2

Closed
opened 2026-10-29 06:58:23 +00:00 by alex · 2 comments
Owner

Most JS/Typescript projects use that file to also keep track of version, it should be trivial to add an adapter to support that too

Most JS/Typescript projects use that file to also keep track of version, it should be trivial to add an adapter to support that too
Author
Owner

/pi new PR

/pi new PR

Now add specs:PR created: #3

Summary — feat: add npm adapter for package.json (#3, closes #2)

  • New adapter ConventionalRelease::Adapter::Npm (src/conventional_release/adapter/npm.cr): manifest package.json, --lang npm.
    • Reads the top-level version field via a light regex instead of JSON parse + re-serialize, so formatting, key order, and trailing newline are preserved on rewrite.
    • Validates the version as SemVer 2.0.0 (prereleases included) and raises clear Errors for a missing version field or an invalid version.
    • Stages package.json + CHANGELOG.md in the release commit.
  • Registration: added to ADAPTERS between version-file and crystal, keeping the existing precedence model; auto-detection works by presence of package.json.
  • Specs: rewrite preserving formatting, reading plain/prerelease versions, missing-field and invalid-version errors, and detection — all 50 examples pass, ameba clean (just checks green).
  • README: Node.js/TypeScript projects listed as supported, NodeJS roadmap entry removed.

View action run | Model: zai/glm-5.3-flash (thinking: low) | Time: 3m 45s | Tokens: 244.5K | Cost: $0.01 | Pi SDK v1.4.0 | Action v2.30.1-develop (develop @ 4ea2232)

<!-- pi-coding-agent-comment --> Now add specs:PR created: https://forge.l3x.in/alex/conventional-release/pulls/3 ## Summary — feat: add npm adapter for `package.json` (#3, closes #2) - **New adapter** `ConventionalRelease::Adapter::Npm` (`src/conventional_release/adapter/npm.cr`): manifest `package.json`, `--lang npm`. - Reads the top-level `version` field via a light regex instead of JSON parse + re-serialize, so formatting, key order, and trailing newline are preserved on rewrite. - Validates the version as SemVer 2.0.0 (prereleases included) and raises clear `Error`s for a missing `version` field or an invalid version. - Stages `package.json` + `CHANGELOG.md` in the release commit. - **Registration**: added to `ADAPTERS` between `version-file` and `crystal`, keeping the existing precedence model; auto-detection works by presence of `package.json`. - **Specs**: rewrite preserving formatting, reading plain/prerelease versions, missing-field and invalid-version errors, and detection — all 50 examples pass, ameba clean (`just checks` green). - **README**: Node.js/TypeScript projects listed as supported, NodeJS roadmap entry removed. --- [View action run](https://forge.l3x.in/alex/conventional-release/actions/runs/10) | Model: zai/glm-5.3-flash (thinking: low) | Time: 3m 45s | Tokens: 244.5K | Cost: $0.01 | Pi SDK v1.4.0 | Action v2.30.1-develop (develop @ 4ea2232)
alex closed this issue 2026-10-29 07:12:57 +00:00
Sign in to join this conversation.
No labels
dependencies
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
alex/conventional-release#2
No description provided.