danger-plugin-simple-collection

Build Status npm version semantic-release

A collection of danger plugins for a FE React project

Usage

Install with Yarn:

yarn add danger-plugin-simple-collection --dev

Install with npm:

npm i danger-plugin-simple-collection --save-dev

You need to have setup an env variable DANGER_GITHUB_API_TOKEN with a value of a GitHub api token that has access to write on the repo you are en-danger-ing

Use this on your project's dangerfile.js (in root folder):

// dangerfile.js
import simpleCollection from 'danger-plugin-simple-collection'

const options = {
  jiraKey: 'FA', // required, key used for JIRA tickets eg. FA would be the key for ticket FA-123
  jiraUrl: 'https://<ORG_NAME>.atlassian.net/browse', // required, url to the account's/organization's JIRA home
  reportsPath: 'reports/danger', // optional default is reports/danger
  noConsoleWhitelist: ['warn', 'error'], // optional, whitelist options for console calls, possible options log,warn,info,error
  disabled: { // optional, disable some plugins, options are listed in example below
    coverage: false,
    jiraIssue: false,
    mentor: false,
    packageReport: false,
    noConsole: false,
    npmAudit: false,
    npmOutdated: false,
  }
};

simpleCollection(options);

Use this on your CI's job shell command: The below example is for a Jenkins (with gh pull request builder) job, change accordingly for the CI of your preference.

More information here

# Create folder structure
mkdir -p reports/danger # input folder needs to be the same as reportsPath in the configuration, note how this folder is referenced below too

# Run tests on develop
git checkout develop
npm ci
node scripts/test.js --env=jsdom --json --coverage --outputFile reports/danger/coverage-develop.json

# Run tests on branch
git checkout ${ghprbActualCommit}
npm ci
node scripts/test.js --env=jsdom --json --coverage --outputFile reports/danger/coverage-current.json

# Run danger task
yarn danger ci

Plugins used

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.