Skip to content

Latest commit

 

History

History
99 lines (64 loc) · 4.71 KB

RELEASE.md

File metadata and controls

99 lines (64 loc) · 4.71 KB

✅📦🚀 Handling jsreport releases

There are some scripts available designed to help with the handling of jsreport release and its extensions.

  • node scripts/changed.js
  • node scripts/audit.js
  • node scripts/publish.js

each script helps with each part of the release process and verification steps.

🔍 Identifying changed packages

When working on a release we first need to identify what were the packages/extensions changed since the last version. this is very important because we need to release those packages/extensions first before we can release the final jsreport version.

We can get a list of changed packages between versions by running the following command:

node scripts/changed.js <initialCommitRef> <lastCommitRef>
  • <initialCommitRef> should be the starting commit, typically the hash of the last commit with message "release xxx" and tag
  • <lastCommitRef> should be the most recent commit, typically the hash of the last commit in the current branch
node scripts/changed.js 37b82056a17ac64d812ec6161547c964398759de cdb7ec10ea1ca301863e84f91ec36d5c8f7d0072

The list represents all the packages that we need to release before jsreport, it is sorted by priority, which means that the top most package is the one that should be released first.

👁 Running npm audit checks

Now that we know the list of packages/extensions we need to release, we can run npm audit on them to check if they contain some vulnerability report that we can simply try to fix by doing some deps update.

To execute the npm audit for all packages:

node scripts/audit.js

To execute the npm audit for some or a single specific package run the following command:

node scripts/audit.js <pkgName> <pkgName2> ...
  • pkgName should be the name of the package/extension that we want to audit
node scripts/audit.js @jsreport/jsreport-core @jsreport/jsreport-studio

The audit will tell us if there are packages with vulnerabilities, and if yes, expose the details of such audit reports at scripts/temp/audit-xxxxx.log. After the audit was fully analyzed and we are ready to move to the next step we can run node scripts/audit.js clean to clean the workspace of package-lock.json files and restore the node_modules tree to its original state.

🚀 Publishing new version of a package

With the audit verified, we can now check the changes related to each package and publish. For the start, we need to understand what were the specific changes related to a specific package in order to decide if the new version is going to be a major, minor or patch release.

To help with that we can use the following command:

node scripts/changed.js <initialCommitRef> <lastCommitRef> <pkgName>
  • <initialCommitRef> should be the starting commit, typically the hash of the last commit with message "release xxx" and tag
  • <lastCommitRef> should be the most recent commit, typically the hash of the last commit in the current branch
  • pkgName should be the name of the package/extension that we want to get details
node scripts/changed.js 37b82056a17ac64d812ec6161547c964398759de cdb7ec10ea1ca301863e84f91ec36d5c8f7d0072 @jsreport/jsreport-core

The command will output a list of commits messages that should describe the changes related to the package between specific commits. These messages will help us in decide what is the new version that we need to use for the package.

By knowing the changes and the expected new version we can update the CHANGELOG section in README.md of the package.

Finally, now that we know the specific version number we are going to use we can publish the package.

To start the publish process we can use the following command:

node scripts/publish.js <pkgName> <newVersion>
  • pkgName should be the name of the package/extension that we want to publish
  • newVersion should be the new version that we want to publish
node scripts/publish.js @jsreport/jsreport-core 3.3.0

Assuming that 3.3.0 is the new version of @jsreport/jsreport-core that we want to publish the above command will do:

  • check that the package does not depend on extraneous versions 🔍 (like dep to a git version)
  • if exists, it will execute the build script 🔨 of package (usually this means that studio build files are updated)
  • if exists, it will execute the test script ✅ of package (ensuring that the package has all tests on green before publish)
  • will update the package.json of package 📦 to the new version and also all references in the monorepo to that package to the new version
  • run yarn install to normalize the node_modules after updating the package to new version
  • execute npm publish 🚀 on the package