# @mongodb-js/bump-monorepo-packages

> Compute and writes conventional bumps for monorepo packages

Latest version **0.2.4** (published 2023-06-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @mongodb-js/bump-monorepo-packages
pnpm add @mongodb-js/bump-monorepo-packages
yarn add @mongodb-js/bump-monorepo-packages
bun add @mongodb-js/bump-monorepo-packages
```

Provides the command `bump-monorepo-packages`.

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2023-06-23 |
| First published | 2022-08-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 24.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | MongoDB Inc |
| Maintainers | mongo-j, mabaasit, alexander_schroll, chuck.kalmanek, mongodb-js-user, rueckstiess, durran, lerouxb, fredtruman, mbroadst, hswolff, satyasinha, matt_d_rat, rhysm, tomhollander, alena.khineika, jeff-allen-mongo, mmarcon, jonathan.balsano, mongodb-build, jack.weir, stennie, mcasimir, kristina.stefano, jarjee, shaketbaby, devtoolsbot, addaleax, gribnoysup, mutukrish |

## Links

- npm: https://www.npmjs.com/package/@mongodb-js/bump-monorepo-packages
- Repository: https://github.com/mongodb-js/devtools-shared
- Issues: https://jira.mongodb.org/projects/COMPASS/issues
- npm.io page: https://npm.io/package/@mongodb-js/bump-monorepo-packages

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^10.2.7
- [semver](https://npm.io/package/semver.md) ^7.3.7
- [toposort](https://npm.io/package/toposort.md) ^2.0.2
- [git-log-parser](https://npm.io/package/git-log-parser.md) ^1.2.0

## Recent versions

- 0.2.4 (latest) — 2023-06-23
- 0.2.3 — 2023-06-21
- 0.2.2 — 2023-06-21
- 0.2.1 — 2022-08-15
- 0.2.0 — 2022-08-12
- 0.1.2 — 2022-08-02
- 0.1.1 — 2022-08-01

## README

# Bump Packages Task

Bump the version of changed packages according to their commit history since the last commit with a special subject (`chore(ci): bump packages`).

**NOTE:** this script will only write changes to the disk: it will not commit, push or release any package.

## Usage

Run this in CI in order to update the packages `package.json` and the root `package-lock.json`:

```
node scripts/bump-packages/bump-packages.js
```

The "bump packages" commit message can be overriden by setting the `LAST_BUMP_COMMIT_MESSAGE` env var. By default is: `chore(ci): bump packages`.

Packages can be excluded from the automatic version bump by adding them to the `SKIP_BUMP_PACKAGES` env var. For example: `export SKIP_BUMP_PACKAGES="package1,package2"`. This can be used in case some of the packages are versioned manually.

## What it does

The command performs the following steps:

1. Find the **"last bump commit"** in the branch, the one which subject starts with `chore(ci): bump packages`
2. Gets a list of all the packages in the monorepo sorted in topological order of dependencies, eg: `{ "name": "pkg1", "dependencies": {"pkg2": "1.0.0"}` -> `["pkg2", "pkg1"]`
3. For each package in the list:

- Calculate the **"conventional bump"** according to commits in the package since the **"last bump commit"**.
- Align all the dependencies previously bumped during the traversal of the list and calculate the **"dependencies bump"**.
- Bump the package version with the maximum increment between the **"conventional bump"** and the **"dependencies bump"** (eg: between `patch` and `minor` take `minor`).

### Conventional Bump

The **"conventional bump"** is calculated based on the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) in the package commit history as follows:

- if any commit on a package has subject or body containing `BREAKING CHANGE` or `BREAKING CHANGES` or has a `!` after the type/scope in the subject (ie. `feat!: ...` or `feat(somescope)!: ...`) then the package will be bumped to the next **major** version.

- if any commit on a package has subject starting with `feat` or `fix` then the package will be bumped to the next **minor** version.

- if any commit on a package exists the package will be bumped to the next **patch** version.

### Dependencies Bump

A package version is bumped also when any dependencies version is bumped. The version change in this case is calculated as follows:

- when only `devDependencies` changed then the package will be bumped to the next **patch** version.
- when any other type of dependency changed (`dependencies`, `peerDependencies`, `optionalDependencies`), then the package will receive the same bump of its dependencies, picking the maximum if more than a dependency was changed.

---
_Source: https://npm.io/package/@mongodb-js/bump-monorepo-packages · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
