Skip to content

Publication to NPM

Bastien Gatellier edited this page Apr 1, 2023 · 5 revisions

Which packages are published?

The ones that satisfy the following conditions:

  • is listed in the projects key of the rush.json file, and does not have a "shouldPublish": false attribute.
  • has changes since the last release (has JSON changelogs located in the common/changes/@fabernovel directory)

Who can publish?

People who can write on the repository.

How to publish?

The publication of packages is a manual operation. There are two main reasons behind this choice:

  • there is no strong, automated mechanisms to ensure bug minimization at the moment
  • published packages cannot be rollback

To do a publication (simulated or real), choose the 🚀 Publish packages workflow from the Actions tabs of the repository, then click on the Run workflow button on the right to open the following window:

image

From there, you can choose:

  • The branch: master will always be used, whatever you choose. This avoid publishing packages from work branches.
  • The publication mode, which indicates if you want to simulate or do the publication
  • The version policy to use, which indicates the version increment strategy you want to use. The list of strategies is located in common/config/rush/version-policies.json:
    • individualVersion: increments every package version number according to their own minor or patch increment (depends of the type of changes made to each package)
    • nextMajor: increments every package version number to the same major version. Only used for major releases.

What are the operations made during a publication?

  1. Create a release branch (name format: release/<workflow_id>)
  2. Bump packages version number
  3. Update the changelog of each package
  4. Publish the packages to npmjs.com
  5. Create a Git tag for each package
  6. Merge the release branch into master

You now have every information to start publishing packages; you just need to click on the Run workflow button and voilà 🚀