Maintainer guide for publishing a new version of @piwikpro/tracking-base-library to npm.
- You have merge rights to
masterand your working tree is clean. - CI on
masteris green. - Publishing to npm is automated: it runs from
.github/workflows/main.ymlwhen a GitHub Release is published, using theNPM_TOKENsecret. You do not runnpm publishby hand.
We follow Semantic Versioning:
- patch (
x.y.Z) — bug fixes, dependency bumps, no public API change. - minor (
x.Y.0) — new backwards-compatible functionality. - major (
X.0.0) — breaking changes.
Because every other Piwik PRO SDK depends on this library, be deliberate about the bump: a new tracking method or exported type is a minor; any change to existing signatures or behaviour is a major.
CHANGELOG.md follows the Keep a Changelog
convention and is generated from git history by
auto-changelog — each entry comes
from a merged pull request, so the quality of the changelog depends on clear PR
titles.
The changelog lists released versions only — there is no persistent
"Unreleased" section, since it would go stale between releases. The entry for a
new version is produced automatically as part of the release (see below), by the
version npm lifecycle hook — you never generate the changelog by hand. To
preview what will be in the next release at any time, use the GitHub compare
view (<last-tag>...HEAD), or run npx auto-changelog --unreleased --stdout
(read-only, prints to the terminal without touching the file).
Releases go through a pull request, like everything else — do not push the
version bump or a tag directly to master. The tag is created by the GitHub
Release after the PR is merged, so it points at the real squash-merge commit
on master.
-
Start a release branch from an up-to-date
master:git checkout master && git pull git checkout -b release/x.y.z -
Bump the version. This does not create a commit or tag —
.npmrcsetsgit-tag-version=false, sonpm versiononly editspackage.json. Theversionnpm lifecycle hook still runs, so it also regenerates the changelog (adds the new version heading + commits since the last release):npm version <patch|minor|major>
-
Commit and push the branch:
git commit -am "chore(release): x.y.z" git push -u origin release/x.y.z -
Open a pull request titled
chore(release): x.y.zand squash-merge it intomaster. This is what lands the changelog and version bump onmaster. -
On GitHub, create a Release with a new tag
x.y.ztargetingmaster. GitHub creates the tag on the merged commit. Use the matchingCHANGELOG.mdsection as the release notes. -
Publishing the GitHub Release triggers
main.yml, which builds and publishes to npm. Verify at https://www.npmjs.com/package/@piwikpro/tracking-base-library.
- When you create the GitHub Release, type the tag unprefixed (
1.7.2, notv1.7.2). This matches the existing tag history and the changelog compare links, which auto-changelog derives from the (unprefixed)package.jsonversion. The tag is created by the GitHub Release, so this is a manual convention — nothing enforces it automatically. - After releasing, remember the downstream SDKs (
react-piwik-pro,ngx-piwik-pro,vue-piwik-pro,nuxt-piwik-pro,gatsby-plugin-piwik-pro) may need their@piwikpro/tracking-base-librarydependency bumped to pick up the new version. - If a release fails to publish, fix the issue and re-publish the GitHub
Release (or re-run the
main.ymlworkflow); you do not need a new version for a failed publish.