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
This commit is contained in:
		
							parent
							
								
									6492693489
								
							
						
					
					
						commit
						2644badeec
					
				| @ -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. | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -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) { | ||||
|  | ||||
| @ -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() | ||||
|   }) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user