Shared configuration for Semantic Release. Details: shared-config.
Labshare repositories can use the following configurations:
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.
- 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"
}
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
andpackage-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 rootpackage.json
andpackage-lock.json
files with customized scripts.
In your Angular Library repository:
-
Install ngPackagr as
devDependency
and configure it -
Make sure you have
build:lib
script configured to callng-packagr
in the repo to be built, as well assemantic-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.