Merge pull request #171 from jrwebdev/caribou

feat(post): Adds GitHub Enterprise support
This commit is contained in:
Stephan Bönnemann 2016-01-18 23:11:56 +01:00
commit adc65e4950
4 changed files with 3 additions and 21 deletions

View File

@ -157,6 +157,7 @@ These options are currently available:
- `debug`: If true doesnt actually publish to npm or write things to file. Default: `!process.env.CI` - `debug`: If true doesnt 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` - `githubToken`: The token used to authenticate with GitHub. Default: `process.env.GH_TOKEN`
- `githubUrl`: Optional. Pass your GitHub Enterprise endpoint. - `githubUrl`: Optional. Pass your GitHub Enterprise endpoint.
- `githubApiPathPrefix`: Optional. The path prefix for your GitHub Enterprise API.
_A few notes on `npm` config_: _A few notes on `npm` config_:
1. The `npm` token can only be defined in the environment as `NPM_TOKEN`, because thats where `npm` itself is going to read it from. 1. The `npm` token can only be defined in the environment as `NPM_TOKEN`, because thats where `npm` itself is going to read it from.

View File

@ -1,5 +1,3 @@
var parseSlug = require('@bahmutov/parse-github-repo-url')
var SemanticReleaseError = require('@semantic-release/error') var SemanticReleaseError = require('@semantic-release/error')
module.exports = function (config) { module.exports = function (config) {
@ -20,11 +18,6 @@ module.exports = function (config) {
'No "repository" found in package.json.', 'No "repository" found in package.json.',
'ENOPKGREPO' '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 if (options.debug) return errors

View File

@ -14,7 +14,8 @@ module.exports = function (config, cb) {
version: '3.0.0', version: '3.0.0',
port: ghConfig.port, port: ghConfig.port,
protocol: (ghConfig.protocol || '').split(':')[0] || null, protocol: (ghConfig.protocol || '').split(':')[0] || null,
host: ghConfig.hostname host: ghConfig.hostname,
pathPrefix: options.githubApiPathPrefix || null
}) })
plugins.generateNotes(config, function (err, log) { plugins.generateNotes(config, function (err, log) {

View File

@ -25,19 +25,6 @@ test('verify pkg, options and env', function (t) {
tt.is(errors[0].code, 'ENOPKGNAME') tt.is(errors[0].code, 'ENOPKGNAME')
tt.is(errors[1].code, 'ENOPKGREPO') 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() tt.end()
}) })