パッケージの詳細

danger-plugin-toolbox

sogame20.8kMIT3.1.2

Danger Plugin Toolbox is a Danger JS plugin containing a set of common validations and utilities, build to make it easy to start using Danger JS.

danger, danger-plugin

readme

danger-plugin-toolbox

Danger Plugin Toolbox is a Danger JS plugin containing a set of common validations and utilities, build to make it easy to start using Danger JS.

build npm version

Installation

npm install danger-plugin-toolbox --save-dev

Usage

Edit your dangerfile.js to import the required validations and utilities, and build the contents using those:

const { warn } = require('danger');
const {
  jsLockfile,
  commonValidJson,
  inCommitGrep,
} = require('danger-plugin-toolbox');

jsLockfile();

commonValidJson();

if (inCommitGrep(/.+\.log$/)) {
  warn('Do not commit log files');
}

Validations and utilities

Find here the documentation of all validations and utilities provided by Danger Plugin Toolbox:

Changelog

See the release history in CHANGELOG.md.

Contributing

To contribute please see CONTRIBUTING.md.

更新履歴

Danger Plugin Toolbox

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

Nothing yet

[3.1.2] - 2024-10-22

Fixed

  • Fixed getFileOwners to return the last match. See GitHub documentation

    If the code owners are not on the same line, the pattern matches only the last mentioned code owner.

[3.1.1] - 2024-10-21

Fixed

[3.1.0] - 2024-10-19

Added

[3.0.1] - 2024-6-7

Fixed

[3.0.0] - 2024-6-4

Fixed

Breaking

  • Drop support for Node versions lower than 18.

[2.0.1] - 2023-2-3

Fixed

  • Fixed false positives in jsTestShortcuts.

[2.0.0] - 2023-2-3

Breaking

  • Drop support for Node versions lower than 16.

Added

  • Add support for tsx TypeScript files in jsConsoleCommands, jsLocalEslintChange, jsRecommendAsyncAwait and jsTestShortcuts.

[1.31.0] - 2022-4-14

Added

  • Added the option notInCommit in commonFileContains to allow running the validation for files that are not included in the commit.

[1.30.0] - 2021-4-16

Added

  • The regular expressions defined in commonCommitMessage that check merges, now also identify remote branch merges.

[1.29.0] - 2020-7-17

Added

  • Added the option ignorePathRegex in jsConsoleCommands to ignore the files/folders that match it.

Changed

  • Use <br> instead of \n to format new lines in the messages generated by some validations.

[1.28.0] - 2020-7-11

Added

  • New validation jsOutOfSyncDeps to check if dependencies and devDependencies in package.json and package-lock.json are in sync.

[1.27.0] - 2020-6-6

Changed

  • commonCommitMessage) now shows the messages of the commits that triggered the rule. This behaviour can be changed using hideCommits configuration.

[1.26.0] - 2020-5-15

Added

  • Added the regular expression COMMON_COMMIT_MESSAGE_JIRA_OR_COMMON_EXCEPTIONS_REGEX (used in commonCommitMessage) to allow the most common exceptions (merge branch, merge pull request, revert or dependency bump).

Changed

  • The regular expressions defined in commonCommitMessage now allow any character after the Jira ticket, not only a space or a colon.
  • The option ignoreTests in jsRecommendAsyncAwait will also ignore files in __tests__ and tests folders.

[1.25.2] - 2020-4-12

Fixed

[1.25.1] - 2020-4-12

Fixed

[1.25.0] - 2020-4-5

Changed

Added

  • Added the configuration option ignoreNonExistingFile to commonFileWarnings to not show a warning when the file does not exist.

[1.24.0] - 2020-4-4

Added

  • Added the configuration option ignoreRegex to commonFileWarnings to ignore the lines that match that regex.

[1.23.0] - 2020-4-4

Changed

[1.22.1] - 2020-3-20

Fixed

[1.22.0] - 2020-3-20

Added

  • Added the configuration option ignoredAuthors to commonCommitMessage) to allow ignoring commits authored by the provided users (useful to ignore bots, for example).

[1.21.0] - 2020-3-16

Added

  • Added the regular expressions COMMON_COMMIT_MESSAGE_JIRA_OR_MERGE_REVERT_REGEX and COMMON_COMMIT_MESSAGE_NO_JIRA_OR_MERGE_REVERT_REGEX (used in commonCommitMessage) to allow revert commits also.

[1.20.0] - 2020-3-14

Changed

  • Change the regular expressions COMMON_COMMIT_MESSAGE_JIRA_REGEX, COMMON_COMMIT_MESSAGE_JIRA_OR_MERGE_REGEX, COMMON_COMMIT_MESSAGE_NO_JIRA_REGEX and COMMON_COMMIT_MESSAGE_NO_JIRA_OR_MERGE_REGEX to allow NOJIRA, NO JIRA and a colon after the square brackets (used in commonCommitMessage).

[1.19.1] - 2020-3-6

Fixed

[1.19.0] - 2020-3-6

Added

  • Added the configuration option reverse in commonCommitMessage. This option changes the behaviour, showing the message when some commit message matches the provided regular expression.
  • Added the regular expressions COMMON_COMMIT_MESSAGE_NO_JIRA_REGEX and COMMON_COMMIT_MESSAGE_NO_JIRA_OR_MERGE_REGEX (used in commonCommitMessage) to match only the string NO-JIRA and not a Jira ticket.

[1.18.0] - 2020-2-28

Added

[1.17.1] - 2019-12-17

Fixed

  • Added missing export for COMMON_COMMIT_MESSAGE_JIRA_OR_MERGE_REGEX.

[1.17.0] - 2019-12-17

Added

  • Added the regular expression COMMON_COMMIT_MESSAGE_JIRA_OR_MERGE_REGEX (used in commonCommitMessage) to allow merge commits also when expecting a Jira ticket.

[1.16.0] - 2019-12-15

Added

Fixed

  • Fix in jsLockfile to avoid showing a warning if dependencies or devDependencies do not exist in package.json.

[1.15.0] - 2019-7-24

Added

Changed

  • Change the regular expression COMMON_COMMIT_MESSAGE_JIRA_REGEX to allow a colon after the Jira ticket (used in commonCommitMessage).

[1.14.0] - 2019-6-26

Added

[1.13.1] - 2019-6-12

Fixed

[1.13.0] - 2019-5-18

Changed

  • Improved jsLockfile validation: now it checks that dependencies or devDependencies have changed in package.json (it used to only check if package.json was changed).

Added

[1.12.0] - 2019-5-10

Added

[1.11.0] - 2019-5-7

Fixed

Added

[1.10.0] - 2019-5-3

Fixed

Added

[1.9.0] - 2019-5-2

Added

[1.8.0] - 2019-4-23

Added

[1.7.0] - 2019-4-17

Added

Changed

  • Change the message COMMON_COMMIT_MESSAGE_JIRA_MSG (this is the suggested message to use when commits do not include a Jira ticket in commonCommitMessage).

[1.6.0] - 2019-3-26

Added

  • The regex to check for a Jira ticket in a commit message now allows not using brackets around the ticket id (so ABC-123 My commit message will now work). The regex is also case insensitive now.

[1.5.1] - 2019-3-14

Fixed

  • Improve jsTestShortcuts check (make sure it's a function call).

[1.5.0] - 2019-3-14

Added

  • The validation cssBackpackVariables now also checks if $bpk-one-pixel-rem is used. This can hide the usage of px units.
  • Allow logType in rules with multiple log types. This will be used as default value for any log type not defined explicitly.

Fixed

  • Improve jsTestShortcuts check (make sure it's a function call).

[1.4.0] - 2018-11-25

Added

  • Add support for TypeScript files in jsConsoleCommands, jsLocalEslintChange and jsTestShortcuts.

[1.3.1] - 2018-11-13

Fixed

  • Fix messages in commonFileContains validation.

[1.3.0] - 2018-11-13

Added

  • New validation commonFileWarnings to list all file lines containing the word warning (useful to surface linting/test warnings).
  • New validation commonFileContains to make sure the file contents match a regex.

[1.2.0] - 2018-10-31

Added

  • New utility linkToTargetRepo to generate links to files in the target repository.
  • New utility linkToSourceRepo to generate links to files in the source repository.
  • New utility targetRepoUrl containing the target repository url.
  • New utility sourceRepoUrl containing the source repository url.

[1.1.0] - 2018-10-29

Added

  • New validation commonCommitMessage to make sure all commit messages match a regex (like ensuring a ticked id is added to all commit messages).

[1.0.0] - 2018-10-23

Added

  • Initial release.