Mural Design System Semantic Release Configuration
We use Semantic Release for version management and the package release workflow. This package contains the configuration files required by Semantic Release.
Table of Contents
How to release a new package
If you want to use this configuration to release a new package within the design system, please follow these steps:
- In the new package that you want to release, update
package.json
devDependencies by manually adding the packages below. Because we need to use*
instead of a version number, please don't usenpm install
."devDependencies": { "@muraldevkit/ds-semrel-config": "*", "@muraldevkit/ds-semrel-manager": "*", "@muraldevkit/ds-semrel-stencil-exports": "*", }
- Run
npm install
from the root of the monorepo. - Create a release configuration file within the
config
folder of your package namedrelease.config.js
. You may need to create the folder if it does not already exist. The file should contain the following content:/* eslint-disable @typescript-eslint/no-var-requires */ 'use strict'; const releaseConfig = require('@muraldevkit/ds-semrel-config'); module.exports = releaseConfig;
- Set up the
package.json
file:- Add a new
release
object that extends thesemantic-release-monorepo
package and our newly-created local configuration (described in the previous step)."release": { "extends": [ "semantic-release-monorepo", "./config/release.config" ] }
- Update the
scripts
object with a consistently-named command that can be executed within the monorepo's workflow."release": "npx semantic-release"
- Add a new
- Set up the monorepo root to execute a release across all packages (assuming you are using Lerna):
"release": "npx lerna run release --concurrency 1 --stream",
Skip this step if that script already exists
Running releases locally
To run the script locally, the branch you are attempting to release must be pushed to the repository first. Once that is done, use:
npm run release
Plugin configuration
In some cases, the plugins called by Semantic Release use custom functions or configuration:
@semantic-release/commit-analyzer
The Semantic Release Commit Analyzer looks at each commit found since the last release and determines if it should trigger a new release and what the release type should be (major, minor, or patch).
The rules used by the plugin are customized by passing a releaseRules array as part of the plugin's configuration object. The design system uses a custom function which takes a configuration object and generates the releaseRules
array. The default configuration object is located in config/default-rules.js
.
Testing
Jest unit tests can be run within the package directory using:
npm run test
Test files are located in the tests
directory and new files should follow the naming convention <scriptToTest>.test.ts
.