@mereb/shared-packages
v0.0.35
Published
This package exposes the shared Fastify/OpenTelemetry helpers used across the backend services. It is built independently with TypeScript and published as `@mereb/shared-packages`.
Downloads
2,759
Readme
Shared Mereb Backend Packages
This package exposes the shared Fastify/OpenTelemetry helpers used across the backend services. It is built independently with TypeScript and published as @mereb/shared-packages.
Local development
pnpm install
pnpm --filter @mereb/shared-packages lint
pnpm --filter @mereb/shared-packages typecheck
pnpm --filter @mereb/shared-packages buildThe compiled JavaScript and type definitions land in dist/.
Jenkins publishing workflow
The folder contains its own Jenkinsfile plus .ci/ci.yml so it can run through the mereb-jenkins shared library just like the services do.
- Version bump – run
pnpm --filter @mereb/shared-packages version:bump(optionally passmajororminor). The script inspects the latestv*tag and updatespackage.jsonto the next version so the release tag and package stay in sync. - Push to
main– Jenkins runs the branch build. After it lints/builds, therelease.autoTagstage (configured withallowDirty: truebecause the build leavesnode_modules/around) creates and pushes the nextv<semver>tag. - Release stages – in the same build, the new
releaseStagesblock uses that tag (RELEASE_TAG) to runpnpm publishand then therelease.githubstage publishes release notes. - Jenkins job – create a Multibranch Pipeline pointing at this repository. Tags are optional now, but still enable tag discovery if you want Jenkins to react to manual tags.
- Credentials – add an
npm-registry-tokensecret text credential in Jenkins for npm publish, plusgithub-credentialsfor tagging/GitHub releases. The pipeline writes the npm token to.npmrcduring the publish stage. - Registry override (optional) – set the job environment variable
NPM_REGISTRYif you publish somewhere other thanhttps://registry.npmjs.org.
Every successful main build with a version bump now produces a tag, publishes the package, and creates GitHub release notes without waiting for a second job.
Tip: The bump script accepts
major,minor, orpatch(default) so you can control which segment changes:pnpm --filter @mereb/shared-packages version:bump minor.
The repo installs a Husky
pre-commithook that automatically runspnpm run version:bumpand stagesservices/shared/package.json, keeping the version aligned with the next release tag before every commit. Jenkins setsHUSKY=0(see.ci/ci.yml) so the hook never runs in CI; locally you can bypass it withHUSKY=0 git commit ....
Manual publish (fallback)
If you need to publish outside Jenkins:
cd services/shared
pnpm install
pnpm lint && pnpm typecheck && pnpm build
NPM_TOKEN=... pnpm publish --registry https://registry.npmjs.org --no-git-checksEnsure the git tag matches the package version before publishing so the CI job can take over again on the next release.