From 2644badeecc745f40e79778a4b15ed9f9860166a Mon Sep 17 00:00:00 2001 From: jrwebdev Date: Wed, 6 Jan 2016 19:10:06 +1300 Subject: [PATCH] feat(post): Adds GitHub Enterprise support Adds githubApiPathPrefix option for GitHub Enterprise APIs. Removes parse-github-repo-url check from verify to support custom GitHub URLs closes #146 --- README.md | 1 + src/lib/verify.js | 7 ------- src/post.js | 3 ++- test/specs/verify.js | 13 ------------- 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 778c89b7..28de4065 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ These options are currently available: - `debug`: If true doesn’t actually publish to npm or write things to file. Default: `!process.env.CI` - `githubToken`: The token used to authenticate with GitHub. Default: `process.env.GH_TOKEN` - `githubUrl`: Optional. Pass your GitHub Enterprise endpoint. +- `githubApiPathPrefix`: Optional. The path prefix for your GitHub Enterprise API. _A few notes on `npm` config_: 1. The `npm` token can only be defined in the environment as `NPM_TOKEN`, because that’s where `npm` itself is going to read it from. diff --git a/src/lib/verify.js b/src/lib/verify.js index f36a746a..954a58d0 100644 --- a/src/lib/verify.js +++ b/src/lib/verify.js @@ -1,5 +1,3 @@ -var parseSlug = require('@bahmutov/parse-github-repo-url') - var SemanticReleaseError = require('@semantic-release/error') module.exports = function (config) { @@ -20,11 +18,6 @@ module.exports = function (config) { '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 diff --git a/src/post.js b/src/post.js index 2ebe79cc..2591a0b4 100644 --- a/src/post.js +++ b/src/post.js @@ -14,7 +14,8 @@ module.exports = function (config, cb) { version: '3.0.0', port: ghConfig.port, protocol: (ghConfig.protocol || '').split(':')[0] || null, - host: ghConfig.hostname + host: ghConfig.hostname, + pathPrefix: options.githubApiPathPrefix || null }) plugins.generateNotes(config, function (err, log) { diff --git a/test/specs/verify.js b/test/specs/verify.js index 7a624af3..13c91fbc 100644 --- a/test/specs/verify.js +++ b/test/specs/verify.js @@ -25,19 +25,6 @@ test('verify pkg, options and env', function (t) { tt.is(errors[0].code, 'ENOPKGNAME') tt.is(errors[1].code, 'ENOPKGREPO') - var errors2 = verify({ - options: {debug: true}, - pkg: { - name: 'package', - repository: { - url: 'lol' - } - } - }) - - tt.is(errors2.length, 1) - tt.is(errors2[0].code, 'EMALFORMEDPKGREPO') - tt.end() })