feat(post): custom release note generation
This commit is contained in:
		
							parent
							
								
									3369f31a8d
								
							
						
					
					
						commit
						323b5d5bf8
					
				| @ -68,7 +68,7 @@ if (~argv._.indexOf('pre')) { | ||||
| } | ||||
| 
 | ||||
| if (~argv._.indexOf('post')) { | ||||
|   require('../src/post')(argv, efh(function () { | ||||
|   require('../src/post')(argv, plugins, efh(function () { | ||||
|     // see src/restart.js
 | ||||
|     if (npmArgv['semantic-release-rerun']) { | ||||
|       console.log('Everything is alright :) npm will now print an error message that you can safely ignore.') | ||||
|  | ||||
							
								
								
									
										17
									
								
								lib/release-notes.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								lib/release-notes.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| 'use strict' | ||||
| 
 | ||||
| var readFile = require('fs').readFileSync | ||||
| 
 | ||||
| var changelog = require('conventional-changelog') | ||||
| var parseUrl = require('github-url-from-git') | ||||
| 
 | ||||
| module.exports = function (cb) { | ||||
|   var pkg = JSON.parse(readFile('./package.json')) | ||||
|   var repository = pkg.repository ? parseUrl(pkg.repository.url) : null | ||||
| 
 | ||||
|   changelog({ | ||||
|     version: pkg.version, | ||||
|     repository: repository, | ||||
|     file: false | ||||
|   }, cb) | ||||
| } | ||||
							
								
								
									
										12
									
								
								src/post.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/post.js
									
									
									
									
									
								
							| @ -3,20 +3,20 @@ | ||||
| var readFile = require('fs').readFileSync | ||||
| var url = require('url') | ||||
| 
 | ||||
| var changelog = require('conventional-changelog') | ||||
| var gitHead = require('git-head') | ||||
| var GitHubApi = require('github') | ||||
| var parseSlug = require('parse-github-repo-url') | ||||
| var parseUrl = require('github-url-from-git') | ||||
| 
 | ||||
| var efh = require('../lib/error').efh | ||||
| 
 | ||||
| module.exports = function (options, cb) { | ||||
| module.exports = function (options, plugins, cb) { | ||||
|   var pkg = JSON.parse(readFile('./package.json')) | ||||
|   var repository = pkg.repository ? pkg.repository.url : null | ||||
| 
 | ||||
|   if (!repository) return cb(new Error('Package must have a repository')) | ||||
| 
 | ||||
|   var notesGenerator = require(plugins.notes || '../lib/release-notes') | ||||
| 
 | ||||
|   var config = options['github-url'] ? url.parse(options['github-url']) : {} | ||||
| 
 | ||||
|   var github = new GitHubApi({ | ||||
| @ -26,11 +26,7 @@ module.exports = function (options, cb) { | ||||
|     host: config.hostname | ||||
|   }) | ||||
| 
 | ||||
|   changelog({ | ||||
|     version: pkg.version, | ||||
|     repository: parseUrl(repository), | ||||
|     file: false | ||||
|   }, efh(cb)(function (log) { | ||||
|   notesGenerator(efh(cb)(function (log) { | ||||
|     gitHead(efh(cb)(function (hash) { | ||||
|       var ghRepo = parseSlug(repository) | ||||
|       var release = { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user