@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 build

The 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.

  1. Version bump – run pnpm --filter @mereb/shared-packages version:bump (optionally pass major or minor). The script inspects the latest v* tag and updates package.json to the next version so the release tag and package stay in sync.
  2. Push to main – Jenkins runs the branch build. After it lints/builds, the release.autoTag stage (configured with allowDirty: true because the build leaves node_modules/ around) creates and pushes the next v<semver> tag.
  3. Release stages – in the same build, the new releaseStages block uses that tag (RELEASE_TAG) to run pnpm publish and then the release.github stage publishes release notes.
  4. 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.
  5. Credentials – add an npm-registry-token secret text credential in Jenkins for npm publish, plus github-credentials for tagging/GitHub releases. The pipeline writes the npm token to .npmrc during the publish stage.
  6. Registry override (optional) – set the job environment variable NPM_REGISTRY if you publish somewhere other than https://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, or patch (default) so you can control which segment changes: pnpm --filter @mereb/shared-packages version:bump minor.

The repo installs a Husky pre-commit hook that automatically runs pnpm run version:bump and stages services/shared/package.json, keeping the version aligned with the next release tag before every commit. Jenkins sets HUSKY=0 (see .ci/ci.yml) so the hook never runs in CI; locally you can bypass it with HUSKY=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-checks

Ensure the git tag matches the package version before publishing so the CI job can take over again on the next release.