Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/antongolub/npm-upgrade-monorepo

Wrapper to use npm-upgrade with monorepos
https://github.com/antongolub/npm-upgrade-monorepo

npm

Last synced: 7 days ago
JSON representation

Wrapper to use npm-upgrade with monorepos

Awesome Lists containing this project

README

        

# npm-upgrade-monorepo

Apply [npm-upgrade](https://github.com/th0r/npm-upgrade) to monorepos. The wrapper just parses `workspaces` field of package.json, and invokes **npm-upgrade** for each internal package dir.

[![CI](https://github.com/antongolub/npm-upgrade-monorepo/workflows/CI/badge.svg)](https://github.com/antongolub/npm-upgrade-monorepo/actions)
[![Maintainability](https://api.codeclimate.com/v1/badges/ba54d6fecd9b4d088387/maintainability)](https://codeclimate.com/github/antongolub/npm-upgrade-monorepo/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/ba54d6fecd9b4d088387/test_coverage)](https://codeclimate.com/github/antongolub/npm-upgrade-monorepo/test_coverage)
[![npm (tag)](https://img.shields.io/npm/v/npm-upgrade-monorepo)](https://www.npmjs.com/package/npm-upgrade-monorepo)

## Install
```shell
npm i -g npm-upgrade-monorepo
```

## Usage
API inherits `npm-upgrade` [CLI contract](https://github.com/th0r/npm-upgrade#usage).
```shell
npm-upgrade-monorepo [...args]
```

### --workspaces / -w
Additional param to override `package.json` `workspaces` field value.
```shell
npm-upgrade-monorepo -w packages/*
npm-upgrade-monorepo -w scope1/a,scope2/b
```

## Alternatives
* `yarn upgrade-interactive`
* [Anifacted/lerna-update-wizard](https://github.com/Anifacted/lerna-update-wizard)
* [codsen/update-versions](https://github.com/codsen/codsen/tree/main/packages/update-versions)
* Bash script
```shell
#!/bin/bash

NPM_UPGRADE="npm-upgrade"
PACKAGES=$(cat package.json | jq -r '.workspaces | join(" ")')

eval $NPM_UPGRADE

for f in $PACKAGES; do
if [ -d "$f" ]; then
cd $f
eval $NPM_UPGRADE
fi
done
```
## License
[MIT](./LICENSE)