@labshare/semantic-release-config
Version:
Shared semantic-release configuration for LabShare Github projects
72 lines (56 loc) • 3.76 kB
Markdown
# semantic-release-config
[](https://github.com/semantic-release/semantic-release)
Shared configuration for Semantic Release.
Details: [shared-config](https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/shareable-configurations.md).
## 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](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md) 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](https://www.npmjs.com/package/ng-packagr). 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](https://www.npmjs.com/package/ng-packagr) as `devDependency` and [configure it](https://www.npmjs.com/package/ng-packagr#usage-example)
* 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](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md) file:
```
{
"extends": "@labshare/semantic-release-config/angular-lib"
}
```
* Setup your Travis.yml to call build and semantic-release scripts during release step. E.g.:
```yml
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](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication) correctly.
* `NPM_TOKEN` owner should have publish permission on NPM groups.
* `GH_TOKEN` owner should have push permission for the Git Repository.