Verify the format of dependencies before releasing with semantic-release
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

Semantic-release-verify-deps

semantic-release plugin to validate the format of dependencies before releasing.

Why create this plugin

In the typical gitflow process, we release tags on master branch and we implement on develop branch.

When doing implementation we sometimes need to change deps to 'floating' deps like :

Even if this is useful on dev branch, it is a bad idea to release on master branch a version with floating dependencies.

Current plugin lets you define a validation/regular expression pattern to avoid this kind of mistake.

Installation

npm install --save-dev semantic-release-verify-deps 

Usage

Plugin must be set within the plugin definition in the Semantic-release configuration file on Verify Conditions step in the project's package.json file.

For example, you can force each dependency to finish with a digit in package.json by doing :

"release": {
    "verifyConditions": [
      {
        "path": "semantic-release-verify-deps",
        "dependencies": true,
        "devDependencies": false,
        "regExps": [
          "\\D$"
        ]
      }
    ]

Configuration

Parameters:

Parameter Description Type Default
dependencies dependencies that are specified in package.json file boolean true
devDependencies dependencies that are specified in package.json file boolean false
regExps regular expresions that will be used as pattern in RegExp Constructor to match invalid dependencies in package.json file array of patterns []

Regexps examples

"\\D$" : Each dependency ending without a digit is invalid for release

"\\d$" : Each dependency ending with a digit is invalid for release

".*github.*" : Each github dependency is invalid for release