https://github.com/tada5hi/workspaces-publish
This library facilitates the publication of packages encompassing multiple workspaces as defined in a package.json file.
https://github.com/tada5hi/workspaces-publish
monorepo monorepository npm npm-workspaces publish publishing workspaces
Last synced: 4 months ago
JSON representation
This library facilitates the publication of packages encompassing multiple workspaces as defined in a package.json file.
- Host: GitHub
- URL: https://github.com/tada5hi/workspaces-publish
- Owner: tada5hi
- Created: 2023-12-16T18:02:07.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2026-02-06T11:40:22.000Z (4 months ago)
- Last Synced: 2026-02-06T19:23:39.648Z (4 months ago)
- Topics: monorepo, monorepository, npm, npm-workspaces, publish, publishing, workspaces
- Language: TypeScript
- Homepage:
- Size: 499 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# workspaces-publish 📦
[](https://badge.fury.io/js/workspaces-publish)
[](https://github.com/Tada5hi/workspaces-publish)
[](https://snyk.io/test/github/Tada5hi/workspaces-publish?targetFile=package.json)
[](https://conventionalcommits.org)
This library facilitates the publication of packages encompassing multiple workspaces as defined in a package.json file.
It determines the unpublished packages by checking each package manifest of the registry,
if one already exists.
At best, it should be used with a library that increments the version of the packages beforehand
(e.g. [release-please](https://github.com/googleapis/release-please)).
It is based on the packages
([libnpmpublish](https://www.npmjs.com/package/libnpmpublish),
[libnpmpack](https://www.npmjs.com/package/libnpmpack))
that the npm cli uses to publish packages.
**Table of Contents**
- [Installation](#installation)
- [Documentation](#documentation)
- [Usage](#usage)
- [CI](#ci)
## Installation
```bash
npm install workspaces-publish --save-dev
```
## Usage
```bash
npx workspaces-publish \
--token \
--registry \
--root \
--rootPackage
```
### token
- Type: `String`
- Default: `process.env.NODE_AUTH_TOKEN`
- Description: Token for the registry.
### registry
- Type: `String`
- Default: `https://registry.npmjs.org/`
- Description: Registry url.
### root
- Type: `String`
- Default: `process.cwd()`
- Description: Directory where the root package is located.
### rootPackage
- Type: `Boolean`
- Default: `true`
- Description: Also consider the root package for publishing. The library still
checks whether a name- & version-property is set and whether the private property evaluates to false.
## CI
### GitHub Action
The library can also be used in combination with [release-please](https://github.com/googleapis/release-please),
as release-please only increases the versions in the monorepo, but does not release the packages.
```yaml
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
if: steps.release.outputs.releases_created == 'true'
uses: actions/checkout@v4
- name: Install Node.JS
if: steps.release.outputs.releases_created == 'true'
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
if: steps.release.outputs.releases_created == 'true'
run: npm ci
- name: Publish
if: steps.release.outputs.releases_created == 'true'
run: npx workspaces-publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```