fix(verify): ensure repo url in package.json is well formed

This commit is contained in:
Stephan Bönnemann
2015-07-16 14:07:52 +02:00
parent dbea5cc1b1
commit 431babb42e
2 changed files with 19 additions and 0 deletions
+7
View File
@@ -1,3 +1,5 @@
const parseSlug = require('parse-github-repo-url')
const SemanticReleaseError = require('@semantic-release/error')
module.exports = function (pkg, options, env) {
@@ -15,6 +17,11 @@ module.exports = function (pkg, options, env) {
'No "repository" found in package.json.',
'ENOPKGREPO'
))
} else if (!parseSlug(pkg.repository.url)) {
errors.push(new SemanticReleaseError(
'The "repository" field in the package.json is malformed.',
'EMALFORMEDPKGREPO'
))
}
if (options.debug) return errors