issue-parser
Advanced tools
Comparing version 2.3.0 to 3.0.0
132
index.js
@@ -7,4 +7,7 @@ 'use strict'; | ||
const isPlainObject = require('lodash.isplainobject'); | ||
const uniqBy = require('lodash.uniqby'); | ||
const hostConfig = require('./lib/hosts-config'); | ||
const {hasOwnProperty} = Object.prototype; | ||
const FENCE_BLOCK_REGEXP = /^(([ \t]*`{3,4})([^\n]*)([\s\S]+?)(^[ \t]*\2))/gm; | ||
@@ -46,18 +49,10 @@ const CODE_BLOCK_REGEXP = /(`(?![\\]))((?:.(?!\1(?![\\])))*.?)\1/g; | ||
function buildRefRegexp({ | ||
referenceActions, | ||
blocksActions, | ||
requiresActions, | ||
parentOfActions, | ||
childOfActions, | ||
duplicateActions, | ||
issuePrefixes, | ||
issueURLSegments, | ||
hosts, | ||
}) { | ||
return `(?:(?:[^\\w\\n\\v\\r]|^)+(${join( | ||
[].concat(referenceActions, blocksActions, requiresActions, parentOfActions, childOfActions, duplicateActions) | ||
)}))?(?:${['[^\\w\\n\\v\\r]|^'].concat(join(issuePrefixes.concat(issueURLSegments))).join('|')})+${ | ||
hosts.length > 0 ? `(?:${join(hosts)})?` : '' | ||
}((?:(?:[\\w-\\.]+)\\/)+(?:[\\w-\\.]+))?(${join(issuePrefixes.concat(issueURLSegments))})(\\d+)(?!\\w)`; | ||
function buildRefRegexp({actions, issuePrefixes, issueURLSegments, hosts}) { | ||
return `(?:(?:[^\\w\\n\\v\\r]|^)+(${join([].concat(...Object.keys(actions).map(key => actions[key])))}))?(?:${[ | ||
'[^\\w\\n\\v\\r]|^', | ||
join([...issuePrefixes, ...issueURLSegments]), | ||
].join('|')})+${hosts.length > 0 ? `(?:${join(hosts)})?` : ''}((?:(?:[\\w-\\.]+)\\/)+(?:[\\w-\\.]+))?(${join([ | ||
...issuePrefixes, | ||
...issueURLSegments, | ||
])})(\\d+)(?!\\w)`; | ||
} | ||
@@ -78,25 +73,9 @@ | ||
function parse( | ||
text, | ||
regexp, | ||
mentionRegexp, | ||
{ | ||
issuePrefixes, | ||
hosts, | ||
referenceActions, | ||
blocksActions, | ||
requiresActions, | ||
parentOfActions, | ||
childOfActions, | ||
duplicateActions, | ||
} | ||
) { | ||
function parse(text, regexp, mentionRegexp, {actions, issuePrefixes, hosts}) { | ||
let parsed; | ||
const results = { | ||
actions: [], | ||
blocks: [], | ||
requires: [], | ||
parentOf: [], | ||
childOf: [], | ||
duplicates: [], | ||
actions: Object.keys(actions).reduce( | ||
(result, key) => (actions[key].length > 0 ? Object.assign(result, {[key]: []}) : result), | ||
{} | ||
), | ||
refs: [], | ||
@@ -124,14 +103,8 @@ mentions: [], | ||
if (includesIgnoreCase(referenceActions, action)) { | ||
results.actions.push({raw, action, slug, prefix, issue}); | ||
} else if (includesIgnoreCase(blocksActions, action)) { | ||
results.blocks.push({raw, action, slug, prefix, issue}); | ||
} else if (includesIgnoreCase(requiresActions, action)) { | ||
results.requires.push({raw, action, slug, prefix, issue}); | ||
} else if (includesIgnoreCase(parentOfActions, action)) { | ||
results.parentOf.push({raw, action, slug, prefix, issue}); | ||
} else if (includesIgnoreCase(childOfActions, action)) { | ||
results.childOf.push({raw, action, slug, prefix, issue}); | ||
} else if (includesIgnoreCase(duplicateActions, action)) { | ||
results.duplicates.push({raw, action, slug, prefix, issue}); | ||
const actionTypes = Object.keys(actions).filter(key => includesIgnoreCase(actions[key], action)); | ||
if (actionTypes.length > 0) { | ||
for (const actionType of actionTypes) { | ||
results.actions[actionType].push({raw, action, slug, prefix, issue}); | ||
} | ||
} else if (issue) { | ||
@@ -151,7 +124,37 @@ results.refs.push({raw, slug, prefix, issue}); | ||
function typeError(parentOpt, opt) { | ||
return new TypeError( | ||
`The ${[parentOpt, opt].filter(Boolean).join('.')} property must be a String or an array of Strings` | ||
); | ||
} | ||
function normalize(opts, parentOpt) { | ||
for (const opt of Object.keys(opts)) { | ||
if (!parentOpt && opt === 'actions') { | ||
normalize(opts[opt], opt); | ||
} else { | ||
if (!opts[opt]) { | ||
opts[opt] = []; | ||
} else if (isString(opts[opt])) { | ||
opts[opt] = [opts[opt]]; | ||
} else if (!Array.isArray(opts[opt])) { | ||
throw typeError(parentOpt, opt); | ||
} | ||
if (opts[opt].length !== 0 && !opts[opt].every(opt => isString(opt))) { | ||
throw typeError(parentOpt, opt); | ||
} | ||
opts[opt] = opts[opt].filter(Boolean); | ||
} | ||
} | ||
} | ||
module.exports = (options = 'default', overrides = {}) => { | ||
if (!isString(options) && !isPlainObject(options)) { | ||
throw new TypeError('Options must be a String or an Object'); | ||
throw new TypeError('The options argument must be a String or an Object'); | ||
} | ||
if (isPlainObject(options) && hasOwnProperty.call(options, 'actions') && !isPlainObject(options.actions)) { | ||
throw new TypeError('The options.actions property must be an Object'); | ||
} | ||
if (isString(options) && !includesIgnoreCase(Object.keys(hostConfig), options)) { | ||
@@ -162,24 +165,15 @@ throw new TypeError(`The supported configuration are [${Object.keys(hostConfig).join(', ')}], got '${options}'`); | ||
if (!isPlainObject(overrides)) { | ||
throw new TypeError('Override must be an Object'); | ||
throw new TypeError('The overrides argument must be an Object'); | ||
} else if (hasOwnProperty.call(overrides, 'actions') && !isPlainObject(overrides.actions)) { | ||
throw new TypeError('The overrides.actions property must be an Object'); | ||
} | ||
const opts = Object.assign( | ||
{}, | ||
hostConfig.default, | ||
isString(options) ? hostConfig[options.toLowerCase()] : options, | ||
overrides | ||
); | ||
options = isString(options) ? hostConfig[options.toLowerCase()] : options; | ||
for (const opt of Object.keys(opts)) { | ||
if (isString(opts[opt])) { | ||
opts[opt] = [opts[opt]]; | ||
} else if (!Array.isArray(opts[opt])) { | ||
throw new TypeError(`The ${opt} option must be a string or an array of strings`); | ||
} | ||
if (opts[opt].length !== 0 && !opts[opt].every(opt => isString(opt))) { | ||
throw new TypeError(`The ${opt} option must be a string or an array of strings`); | ||
} | ||
opts[opt] = opts[opt].filter(Boolean); | ||
} | ||
const opts = Object.assign({}, hostConfig.default, options, overrides, { | ||
actions: Object.assign({}, hostConfig.default.actions, options.actions, overrides.actions), | ||
}); | ||
normalize(opts); | ||
opts.hosts = opts.hosts.map(addTrailingSlash); | ||
@@ -200,3 +194,3 @@ opts.issueURLSegments = opts.issueURLSegments.map(addLeadingAndTrailingSlash); | ||
get() { | ||
return this.actions.concat(this.refs, this.duplicates, this.blocks, this.requires, this.parentOf, this.childOf); | ||
return uniqBy(this.refs.concat(...Object.keys(this.actions).map(key => this.actions[key])), 'raw'); | ||
}, | ||
@@ -203,0 +197,0 @@ }); |
module.exports = { | ||
github: { | ||
// https://help.github.com/articles/closing-issues-using-keywords | ||
referenceActions: ['close', 'closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved'], | ||
blocksActions: [], | ||
requiresActions: [], | ||
parentOfActions: [], | ||
childOfActions: [], | ||
// https://help.github.com/articles/about-duplicate-issues-and-pull-requests | ||
duplicateActions: ['Duplicate of'], | ||
actions: { | ||
// https://help.github.com/articles/closing-issues-using-keywords | ||
close: ['close', 'closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved'], | ||
block: [], | ||
require: [], | ||
parentOf: [], | ||
childOf: [], | ||
// https://help.github.com/articles/about-duplicate-issues-and-pull-requests | ||
duplicate: ['Duplicate of'], | ||
}, | ||
// https://guides.github.com/features/issues/#notifications | ||
@@ -18,22 +20,24 @@ mentionsPrefixes: ['@'], | ||
bitbucket: { | ||
// https://confluence.atlassian.com/bitbucket/resolve-issues-automatically-when-users-push-code-221451126.html | ||
referenceActions: [ | ||
'close', | ||
'closes', | ||
'closed', | ||
'closing', | ||
'fix', | ||
'fixes', | ||
'fixed', | ||
'fixing', | ||
'resolve', | ||
'resolves', | ||
'resolved', | ||
'resolving', | ||
], | ||
blocksActions: [], | ||
requiresActions: [], | ||
parentOfActions: [], | ||
childOfActions: [], | ||
duplicateActions: [], | ||
actions: { | ||
// https://confluence.atlassian.com/bitbucket/resolve-issues-automatically-when-users-push-code-221451126.html | ||
close: [ | ||
'close', | ||
'closes', | ||
'closed', | ||
'closing', | ||
'fix', | ||
'fixes', | ||
'fixed', | ||
'fixing', | ||
'resolve', | ||
'resolves', | ||
'resolved', | ||
'resolving', | ||
], | ||
block: [], | ||
require: [], | ||
parentOf: [], | ||
childOf: [], | ||
duplicate: [], | ||
}, | ||
// https://confluence.atlassian.com/bitbucket/mark-up-comments-issues-and-commit-messages-321859781.html | ||
@@ -47,27 +51,29 @@ mentionsPrefixes: ['@'], | ||
gitlab: { | ||
// https://docs.gitlab.com/ee/user/project/issues/automatic_issue_closing.html | ||
referenceActions: [ | ||
'close', | ||
'closes', | ||
'closed', | ||
'closing', | ||
'fix', | ||
'fixes', | ||
'fixed', | ||
'fixing', | ||
'resolve', | ||
'resolves', | ||
'resolved', | ||
'resolving', | ||
'implement', | ||
'implements', | ||
'implemented', | ||
'implementing', | ||
], | ||
blocksActions: [], | ||
requiresActions: [], | ||
parentOfActions: [], | ||
childOfActions: [], | ||
// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12845 | ||
duplicateActions: ['/duplicate'], | ||
actions: { | ||
// https://docs.gitlab.com/ee/user/project/issues/automatic_issue_closing.html | ||
close: [ | ||
'close', | ||
'closes', | ||
'closed', | ||
'closing', | ||
'fix', | ||
'fixes', | ||
'fixed', | ||
'fixing', | ||
'resolve', | ||
'resolves', | ||
'resolved', | ||
'resolving', | ||
'implement', | ||
'implements', | ||
'implemented', | ||
'implementing', | ||
], | ||
block: [], | ||
require: [], | ||
parentOf: [], | ||
childOf: [], | ||
// https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12845 | ||
duplicate: ['/duplicate'], | ||
}, | ||
// https://about.gitlab.com/2016/03/08/gitlab-tutorial-its-all-connected | ||
@@ -81,13 +87,15 @@ mentionsPrefixes: ['@'], | ||
waffle: { | ||
// https://help.waffle.io/dependencies/which-keywords-are-supported-with-dependencies | ||
referenceActions: ['close', 'closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved'], | ||
// https://help.github.com/articles/closing-issues-using-keywords | ||
blocksActions: ['blocks', 'block', 'required by', 'needed by', 'dependency of'], | ||
requiresActions: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'], | ||
// https://help.waffle.io/epics/which-keywords-are-supported-with-epics | ||
parentOfActions: ['parent of', 'parent to', 'parent'], | ||
// https://help.waffle.io/epics/which-keywords-are-supported-with-epics | ||
childOfActions: ['child of', 'child to', 'child'], | ||
// https://help.github.com/articles/about-duplicate-issues-and-pull-requests | ||
duplicateActions: ['Duplicate of'], | ||
actions: { | ||
// https://help.waffle.io/dependencies/which-keywords-are-supported-with-dependencies | ||
close: ['close', 'closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved'], | ||
// https://help.github.com/articles/closing-issues-using-keywords | ||
block: ['blocks', 'block', 'required by', 'needed by', 'dependency of'], | ||
require: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'], | ||
// https://help.waffle.io/epics/which-keywords-are-supported-with-epics | ||
parentOf: ['parent of', 'parent to', 'parent'], | ||
// https://help.waffle.io/epics/which-keywords-are-supported-with-epics | ||
childOf: ['child of', 'child to', 'child'], | ||
// https://help.github.com/articles/about-duplicate-issues-and-pull-requests | ||
duplicate: ['Duplicate of'], | ||
}, | ||
// https://guides.github.com/features/issues/#notifications | ||
@@ -100,25 +108,27 @@ mentionsPrefixes: ['@'], | ||
default: { | ||
referenceActions: [ | ||
'close', | ||
'closes', | ||
'closed', | ||
'closing', | ||
'fix', | ||
'fixes', | ||
'fixed', | ||
'fixing', | ||
'resolve', | ||
'resolves', | ||
'resolved', | ||
'resolving', | ||
'implement', | ||
'implements', | ||
'implemented', | ||
'implementing', | ||
], | ||
blocksActions: ['blocks', 'block', 'required by', 'needed by', 'dependency of'], | ||
requiresActions: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'], | ||
parentOfActions: ['parent of', 'parent to', 'parent'], | ||
childOfActions: ['child of', 'child to', 'child'], | ||
duplicateActions: ['Duplicate of', '/duplicate'], | ||
actions: { | ||
close: [ | ||
'close', | ||
'closes', | ||
'closed', | ||
'closing', | ||
'fix', | ||
'fixes', | ||
'fixed', | ||
'fixing', | ||
'resolve', | ||
'resolves', | ||
'resolved', | ||
'resolving', | ||
'implement', | ||
'implements', | ||
'implemented', | ||
'implementing', | ||
], | ||
block: ['blocks', 'block', 'required by', 'needed by', 'dependency of'], | ||
require: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'], | ||
parentOf: ['parent of', 'parent to', 'parent'], | ||
childOf: ['child of', 'child to', 'child'], | ||
duplicate: ['Duplicate of', '/duplicate'], | ||
}, | ||
mentionsPrefixes: ['@'], | ||
@@ -125,0 +135,0 @@ issuePrefixes: ['#', 'gh-'], |
{ | ||
"name": "issue-parser", | ||
"description": "Parser for Github, GitLab, Bitbucket and Waffle issues actions, references and mentions", | ||
"version": "2.3.0", | ||
"version": "3.0.0", | ||
"author": "Pierre Vanduynslager (https://github.com/pvdlg)", | ||
@@ -13,3 +13,4 @@ "bugs": { | ||
"lodash.isplainobject": "^4.0.6", | ||
"lodash.isstring": "^4.0.1" | ||
"lodash.isstring": "^4.0.1", | ||
"lodash.uniqby": "^4.7.0" | ||
}, | ||
@@ -16,0 +17,0 @@ "devDependencies": { |
233
README.md
@@ -14,2 +14,3 @@ # issue-parser | ||
- Waffle.io [epics](https://help.waffle.io/epics/which-keywords-are-supported-with-epics) and [dependencies](https://help.waffle.io/dependencies/which-keywords-are-supported-with-dependencies) keywords | ||
- [Custom](#custom-format) or [additional](#extend-existing-format) keywords | ||
@@ -34,4 +35,6 @@ ## Install | ||
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}], | ||
actions: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}], | ||
duplicates: [{raw: 'Duplicate of #3', action: 'Duplicate of', prefix: '#', issue: '3'}], | ||
actions: { | ||
close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}], | ||
duplicate: [{raw: 'Duplicate of #3', action: 'Duplicate of', prefix: '#', issue: '3'}], | ||
}, | ||
mentions: [{raw: '@user', prefix: '@', user: 'user'}], | ||
@@ -55,4 +58,6 @@ } | ||
], | ||
actions: [{raw: 'implement #3', action: 'Implement', prefix: '#', issue: '4'}], | ||
duplicates: [{raw: 'Duplicate of #4', action: 'Duplicate of', prefix: '#', issue: '4'}], | ||
actions: { | ||
close: [{raw: 'implement #3', action: 'Implement', prefix: '#', issue: '4'}], | ||
duplicate: [{raw: 'Duplicate of #4', action: 'Duplicate of', prefix: '#', issue: '4'}], | ||
}, | ||
mentions: [{raw: '@user', prefix: '@', user: 'user'}], | ||
@@ -73,3 +78,5 @@ } | ||
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}], | ||
actions: [{raw: 'fixing #2', action: 'Fixing', prefix: '#', issue: '2'}], | ||
actions: { | ||
close: [{raw: 'fixing #2', action: 'Fixing', prefix: '#', issue: '2'}], | ||
}, | ||
mentions: [{raw: '@user', prefix: '@', user: 'user'}], | ||
@@ -90,7 +97,9 @@ } | ||
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}], | ||
actions: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}], | ||
blocks: [{raw: 'blocks user/package#3', action: 'Blocks', slug: 'user/package', prefix: '#', issue: '3'}], | ||
requires: [{raw: 'Require #4', action: 'Require', prefix: '#', issue: '4'}], | ||
parentOf: [{raw: 'Parent of #5', action: 'Parent of', prefix: '#', issue: '5'}], | ||
childOf: [{raw: 'Child of #6', action: 'Child of', prefix: '#', issue: '6'}], | ||
actions: { | ||
close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}], | ||
block: [{raw: 'blocks user/package#3', action: 'Blocks', slug: 'user/package', prefix: '#', issue: '3'}], | ||
require: [{raw: 'Require #4', action: 'Require', prefix: '#', issue: '4'}], | ||
parentOf: [{raw: 'Parent of #5', action: 'Parent of', prefix: '#', issue: '5'}], | ||
childOf: [{raw: 'Child of #6', action: 'Child of', prefix: '#', issue: '6'}], | ||
}, | ||
mentions: [{raw: '@user', prefix: '@', user: 'user'}], | ||
@@ -105,3 +114,3 @@ } | ||
const issueParser = require('issue-parser'); | ||
const parse = issueParser({referenceActions: ['complete'], blocksActions: ['holds up'], issuePrefixes: ['🐛']}); | ||
const parse = issueParser({actions: {fix: ['complete'], hold: ['holds up']}, issuePrefixes: ['🐛']}); | ||
@@ -112,4 +121,6 @@ parse('Issue description, related to user/package🐛1, Complete 🐛2, holds up 🐛3'); | ||
refs: [{raw: 'user/package🐛1', slug: 'user/package', prefix: '🐛', issue: '1'}], | ||
actions: [{raw: 'Complete 🐛2', action: 'Complete', prefix: '🐛', issue: '2'}], | ||
blocks: [{raw: 'holds up 🐛3', action: 'Holds up', prefix: '🐛', issue: '3'}], | ||
actions: { | ||
fix: [{raw: 'Complete 🐛2', action: 'Complete', prefix: '🐛', issue: '2'}], | ||
hold: [{raw: 'holds up 🐛3', action: 'Holds up', prefix: '🐛', issue: '3'}], | ||
}, | ||
} | ||
@@ -119,2 +130,22 @@ */ | ||
### Extend existing format | ||
```js | ||
const issueParser = require('issue-parser'); | ||
const parse = issueParser('github', {actions: {parent: ['parent of'], related: ['related to']}}); | ||
parse('Issue description, ref user/package#1, Fix #2, Parent of #3, related to #4 /cc @user'); | ||
/* | ||
{ | ||
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}], | ||
actions: { | ||
close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}], | ||
parent: [{raw: 'Parent of #3', action: 'Parent of', prefix: '#', issue: '3'}], | ||
related: [{raw: 'related to #4', action: 'Related to', prefix: '#', issue: '4'}], | ||
}, | ||
mentions: [{raw: '@user', prefix: '@', user: 'user'}], | ||
} | ||
*/ | ||
``` | ||
## Features | ||
@@ -146,3 +177,3 @@ | ||
```js | ||
{actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]} | ||
{actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}} | ||
``` | ||
@@ -156,3 +187,3 @@ | ||
```js | ||
{duplicates: [{raw: 'Duplicate of #1', action: 'Duplicate of', slug: undefined, prefix: '#', issue: '1'}]} | ||
{actions: {duplicate: [{raw: 'Duplicate of #1', action: 'Duplicate of', slug: undefined, prefix: '#', issue: '1'}]}} | ||
``` | ||
@@ -179,5 +210,7 @@ | ||
refs: [{raw: 'https://github.com/owner/repo/pull/1', slug: 'owner/repo', prefix: undefined, issue: '1'},] | ||
actions: [ | ||
{raw: 'Fix https://github.com/owner/repo/issues/2', action: 'Fix', slug: 'owner/repo', prefix: undefined, issue: '2'} | ||
] | ||
actions: { | ||
close: [ | ||
{raw: 'Fix https://github.com/owner/repo/issues/2', action: 'Fix', slug: 'owner/repo', prefix: undefined, issue: '2'} | ||
] | ||
} | ||
} | ||
@@ -192,3 +225,3 @@ ``` | ||
```js | ||
{actions: [{raw: 'FIX #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]} | ||
{actions: {close: [{raw: 'FIX #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}} | ||
``` | ||
@@ -203,3 +236,3 @@ | ||
{ | ||
actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}], | ||
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}, | ||
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}] | ||
@@ -216,3 +249,3 @@ } | ||
{ | ||
actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}], | ||
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}, | ||
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}] | ||
@@ -239,3 +272,3 @@ } | ||
{ | ||
actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}], | ||
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}, | ||
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}] | ||
@@ -258,3 +291,3 @@ } | ||
{ | ||
actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}], | ||
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}, | ||
mentions: [{raw: '@user', prefix: '@', user: 'user'}] | ||
@@ -275,3 +308,3 @@ } | ||
{ | ||
actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}], | ||
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}, | ||
mentions: [{raw: '@user1', prefix: '@', user: 'user1'}] | ||
@@ -289,3 +322,3 @@ } | ||
{ | ||
actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}], | ||
actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}, | ||
mentions: [{raw: '@user', prefix: '@', user: 'user'}] | ||
@@ -301,3 +334,3 @@ } | ||
```js | ||
{actions: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]} | ||
{actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}} | ||
``` | ||
@@ -316,44 +349,17 @@ | ||
##### referenceActions | ||
##### actions | ||
Type: `Array<String>` `String`<br> | ||
Default: `['close', 'closes', 'closed', 'closing', 'fix', 'fixes', 'fixed', 'fixing', 'resolve', 'resolves', 'resolved', 'resolving', 'implement', 'implements', 'implemented', 'implementing']` | ||
Type: `Object`<br> | ||
Default: | ||
`{close: ['close', 'closes', 'closed', 'closing', 'fix', 'fixes', 'fixed', 'fixing', 'resolve', 'resolves', 'resolved', 'resolving', 'implement', 'implements', 'implemented', 'implementing'], | ||
block: ['blocks', 'block', 'required by', 'needed by', 'dependency of'], | ||
require: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'], | ||
parentOf: ['parent of', 'parent to', 'parent'], | ||
childOf: ['child of', 'child to', 'child'], | ||
duplicate: ['Duplicate of', '/duplicate']}` | ||
List of action keywords used to close issues and pull requests. | ||
Object with type of action as key and array of keywords as value. | ||
##### blocksActions | ||
Each keyword match will be placed in the corresponding property of the [`result`](#result) `action` object. For example the with the configuration `{actions: fix: ['fixed', 'fixing']}` each action matching `fixed` or `fixing` will be under `result.actions.fix`. | ||
Type: `Array<String>` `String`<br> | ||
Default: `['blocks', 'block', 'required by', 'needed by', 'dependency of']` | ||
List of action keywords used to make an issue or pull request block another one. | ||
##### requiresActions | ||
Type: `Array<String>` `String`<br> | ||
Default: `['blocked by', 'requires', 'require', 'need', 'needs', 'depends on']` | ||
List of action keywords used to make an issue or pull request blocked by another one. | ||
##### parentOfActions | ||
Type: `Array<String>` `String`<br> | ||
Default: `['parent of', 'parent to', 'parent']` | ||
List of action keywords used to make an issue or pull request the parent of another one. | ||
##### childOfActions | ||
Type: `Array<String>` `String`<br> | ||
Default: `['child of', 'child to', 'child']` | ||
List of action keywords used to make an issue or pull request the child of another one. | ||
##### duplicateActions | ||
Type: `Array<String>` `String`<br> | ||
Default: `['Duplicate of', '/duplicate']` | ||
List of keywords used to identify duplicate issues and pull requests. | ||
##### mentionsPrefixes | ||
@@ -412,6 +418,6 @@ | ||
Type: `Array<Object>` | ||
Type: `Object` | ||
List of issues and pull requests closed.<br> | ||
Each action has the following properties: | ||
List of matching actions by type.<br> | ||
Each type of action is an array of objects with the following properties: | ||
@@ -426,77 +432,2 @@ | Name | Type | Description | | ||
#### blocks | ||
Type: `Array<Object>` | ||
List of issues and pull requests blocked.<br> | ||
Each action has the following properties: | ||
| Name | Type | Description | | ||
|--------|----------|---------------------------------------------------------------------------------------| | ||
| raw | `String` | The raw value parsed, for example `Blocks #1`. | | ||
| action | `String` | The keyword used to identify the action, capitalized. | | ||
| slug | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. | | ||
| prefix | `String` | The prefix used to identify the issue. | | ||
| issue | `String` | The issue number. | | ||
#### requires | ||
Type: `Array<Object>` | ||
List of issues and pull requests required.<br> | ||
Each action has the following properties: | ||
| Name | Type | Description | | ||
|--------|----------|---------------------------------------------------------------------------------------| | ||
| raw | `String` | The raw value parsed, for example `Requires #1`. | | ||
| action | `String` | The keyword used to identify the action, capitalized. | | ||
| slug | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. | | ||
| prefix | `String` | The prefix used to identify the issue. | | ||
| issue | `String` | The issue number. | | ||
#### parentOf | ||
Type: `Array<Object>` | ||
List of child issues and pull requests.<br> | ||
Each action has the following properties: | ||
| Name | Type | Description | | ||
|--------|----------|---------------------------------------------------------------------------------------| | ||
| raw | `String` | The raw value parsed, for example `Parent of #1`. | | ||
| action | `String` | The keyword used to identify the action, capitalized. | | ||
| slug | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. | | ||
| prefix | `String` | The prefix used to identify the issue. | | ||
| issue | `String` | The issue number. | | ||
#### childOf | ||
Type: `Array<Object>` | ||
List of parent issues and pull requests.<br> | ||
Each action has the following properties: | ||
| Name | Type | Description | | ||
|--------|----------|---------------------------------------------------------------------------------------| | ||
| raw | `String` | The raw value parsed, for example `Child of #1`. | | ||
| action | `String` | The keyword used to identify the action, capitalized. | | ||
| slug | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. | | ||
| prefix | `String` | The prefix used to identify the issue. | | ||
| issue | `String` | The issue number. | | ||
#### duplicates | ||
Type: `Array<Object>` | ||
List of issues and pull requests marked as duplicate.<br> | ||
Each duplicate has the following properties: | ||
| Name | Type | Description | | ||
|--------|----------|---------------------------------------------------------------------------------------| | ||
| raw | `String` | The raw value parsed, for example `Duplicate of #1`. | | ||
| action | `String` | The keyword used to identify the duplicate, capitalized. | | ||
| slug | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. | | ||
| prefix | `String` | The prefix used to identify the issue. | | ||
| issue | `String` | The issue number. | | ||
#### refs | ||
@@ -506,3 +437,3 @@ | ||
List of issues and pull requests referenced, but not closed or marked as duplicates.<br> | ||
List of issues and pull requests referenced, but not matched with an action.<br> | ||
Each reference has the following properties: | ||
@@ -534,11 +465,11 @@ | ||
List of all issues and pull requests [closed](#actions), [marked as duplicate](#duplicates) or [referenced](#refs).<br> | ||
List of all issues and pull requests [referenced](#refs) or matching an [action](#actions-1).<br> | ||
Each reference has the following properties: | ||
| Name | Type | Description | | ||
|--------|----------|---------------------------------------------------------------------------------------| | ||
| raw | `String` | The raw value parsed, for example `Fix #1`. | | ||
| action | `String` | The keyword used to identify the action or the duplicate, capitalized. | | ||
| slug | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. | | ||
| prefix | `String` | The prefix used to identify the issue. | | ||
| issue | `String` | The issue number. | | ||
| Name | Type | Description | | ||
|--------|----------|------------------------------------------------------------------------------------------------------| | ||
| raw | `String` | The raw value parsed, for example `Fix #1`. | | ||
| action | `String` | The keyword used to identify the action or the duplicate, capitalized. Only if matched by an action. | | ||
| slug | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. | | ||
| prefix | `String` | The prefix used to identify the issue. | | ||
| issue | `String` | The issue number. | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27229
5
296
452
+ Addedlodash.uniqby@^4.7.0
+ Addedlodash.uniqby@4.7.0(transitive)