husky-pivotal
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -11,2 +11,6 @@ const ckbranch = require('../ckbranch'); | ||
test('matches feature/{feature}_{story} branch style', () => { | ||
expect(ckbranch('feature/greatStuff_123456')).toBe('123456'); | ||
}); | ||
test('matches branch names with long numbers', () => { | ||
@@ -13,0 +17,0 @@ expect(ckbranch('123456789101112-great-stuff')).toBe('123456789101112'); |
@@ -19,1 +19,5 @@ const mkmsg = require('../mkmsg'); | ||
}); | ||
test('appends content without removing existing content', () => { | ||
expect(mkmsg('Commit message', '123456-feature-name').split('\n').pop()).toBe('[#123456]'); | ||
}); |
@@ -7,4 +7,4 @@ /** | ||
module.exports = branch => { | ||
const matches = branch.match(/\b(\d{6,})/); | ||
const matches = branch.match(/(?:\b|_)(\d{6,})/); | ||
return matches ? matches[1] : false; | ||
}; |
@@ -10,2 +10,5 @@ /** | ||
// Returns true if the provided commit contains non-comment lines | ||
const hasBody = msg => !!String(msg).match(/^\b[^#].+/m) | ||
module.exports = (msg, branch) => { | ||
@@ -19,3 +22,3 @@ // Early escape for messages that already contain a Story ID | ||
// Construct message addition | ||
const prepend = story ? [ | ||
const extra = (story ? [ | ||
'', | ||
@@ -32,5 +35,9 @@ '', | ||
'#', | ||
]; | ||
]).join('\n'); | ||
return `${prepend.join('\n')}${msg}`; | ||
// If the existing commit message contains text then the extras | ||
// should be appended to it, otherwise they should be prepended | ||
return hasBody(msg) | ||
? `${msg}${extra}` | ||
: `${extra}${msg}`; | ||
}; |
{ | ||
"name": "husky-pivotal", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Husky Git hooks for Pivotal Tracker.", | ||
@@ -36,11 +36,12 @@ "scripts": { | ||
"peerDependencies": { | ||
"husky": ">=0.13.0 <2.0.0" | ||
"husky": ">=0.13.0" | ||
}, | ||
"dependencies": { | ||
"chalk": "^2.4.1" | ||
"chalk": "^2.4.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^4.19.1", | ||
"jest": "^23.0.0" | ||
"eslint": "^6.0.0", | ||
"husky": "^3.0.0", | ||
"jest": "^24.8.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
52086
208
3
+ Addedhusky@9.1.6(transitive)
- Removedargparse@1.0.10(transitive)
- Removedcaller-callsite@2.0.0(transitive)
- Removedcaller-path@2.0.0(transitive)
- Removedcallsites@2.0.0(transitive)
- Removedci-info@2.0.0(transitive)
- Removedcosmiconfig@5.2.1(transitive)
- Removedcross-spawn@6.0.5(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedesprima@4.0.1(transitive)
- Removedexeca@1.0.0(transitive)
- Removedfind-up@3.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-stdin@6.0.0(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedhusky@1.3.1(transitive)
- Removedimport-fresh@2.0.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-ci@2.0.0(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-directory@0.3.1(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedjson-parse-better-errors@1.0.2(transitive)
- Removedlocate-path@3.0.0(transitive)
- Removednice-try@1.0.5(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removednpm-run-path@2.0.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@3.0.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedparse-json@4.0.0(transitive)
- Removedpath-exists@3.0.0(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpify@3.0.0(transitive)
- Removedpkg-dir@3.0.0(transitive)
- Removedplease-upgrade-node@3.2.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedread-pkg@4.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedresolve-from@3.0.0(transitive)
- Removedrun-node@1.0.0(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsemver-compare@1.0.0(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedslash@2.0.0(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstrip-eof@1.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedchalk@^2.4.0