0.7.13 • Published 1 month ago

@moreapp/common-nodejs v0.7.13

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
1 month ago

MoreApp Common Node.js

This project contains common code that can be used for our Node.js projects.

Getting started

Run yarn prepare once to install Git hooks, doing lints and prettier formatting

Project usage

Most code can be used as is, except for tracing, see below.

Tracing

Tracing code should always be loaded (import/require) first, before any other libraries. This is because the OpenTelemetry instrumentations monkey patch libraries to add tracing. Patching has to happen first, because already loaded libraries will be cached by the module system.

The recommended way to do this, is to create a file instrumentation.ts with the following content (the extra instrumentation is there as an example):

import { tracer } from "@moreapp/common-nodejs";
import { MongoDBInstrumentation } from "@opentelemetry/instrumentation-mongodb";

tracer("<SERVICE_NAME>", {
  extraInstrumentations: [new MongoDBInstrumentation()],
});

And then use the --require Node.js CLI option to load this file.

Creating a new release

Follow the steps below to create a new release:

  1. Ensure that the master branch has the commits you want to release
  2. Start a new build in Bitbucket Pipelines for the master branch with the create-release pipeline
  3. Select which type of version bump you want to do
  4. The build will automatically create a new version and publish it to NPM

Creating a local release

If you want to test new code in other projects, then you can link this repository using Yarn.

  1. Run yarn link in this repository
  2. Run yarn link @moreapp/common-nodejs in the project you want to use this repository in