semantic-release-config
Shared configuration for Semantic Release.
Details: shared-config.
Available Configurations
Labshare repositories can use the following configurations:
Default:
Defined in index.js
file, loaded by default when requiring @labshare/semantic-release-config
. Used by both client-side and server-side projects, contains the standard release procedure for semantic-release.
Usage Instructions:
- Install this module as
devDependency
: npm i @labshare/semantic-release-config --save-dev
- Add to your semantic-release config file:
{
"extends": "@labshare/semantic-release-config"
}
Angular Lib:
Defined in angular-lib.js
file, specific for Angular Libraries. Loaded by default when requiring @labshare/semantic-release-config/angular-lib
and adapted for the following requirements:
- Angular Libraries are built with NgPackagr. During
build
step (npm run build:lib
), NgPackagr will create a new folder for the bundled package (/dist
, by default). This happens because:
- Several bundle types will be compiled - FESM2015, FESM5, UMD, Minified UMD bundle, etc.
- Package metadata will be altered - "main", "module", "es2015" and other fields will be created; npm scripts will be removed (security vulnerabilities)
- Extra Dependencies might be necessary and will be added automatically.
- Package Typings and Metadata will be generated by Ngc AOT and exported automatically.
In order for NgPackagr and Semantic-Release integrate correctly, some adjustments have been made necessary:
- Npm released package should only contain the bundle inside
/dist
- Semantic-release plugin will automatically update
package.json
and package-lock.json
versions to reflect updates on Git repository after a release. However, since the default folder is now /dist
, this specific configuration has to update root package.json
and package-lock.json
files with customized scripts.
Usage Instructions:
In your Angular Library repository:
-
Install ngPackagr as devDependency
and configure it
-
Make sure you have build:lib
script configured to call ng-packagr
in the repo to be built,
as well as semantic-release
script.
-
Install this module as devDependency
: npm i @labshare/semantic-release-config --save-dev
-
Add to your semantic-release config file:
{
"extends": "@labshare/semantic-release-config/angular-lib"
}
- Setup your Travis.yml to call build and semantic-release scripts during release step. E.g.:
jobs:
include:
- stage: release
if: branch = master
node_js: lts/*
script:
- npm run build:lib
deploy:
provider: script
skip_cleanup: true
script:
- npm run semantic-release
- Make sure you have configured Travis CI Environment Tokens for Semantic-Release correctly.
NPM_TOKEN
owner should have publish permission on NPM groups.GH_TOKEN
owner should have push permission for the Git Repository.