Merge pull request #2332 from semantic-release/beta
This commit is contained in:
		
						commit
						95af1e40f9
					
				
							
								
								
									
										3
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/test.yml
									
									
									
									
										vendored
									
									
								
							| @ -18,7 +18,8 @@ jobs: | |||||||
|       matrix: |       matrix: | ||||||
|         node-version: |         node-version: | ||||||
|           - 14.17 |           - 14.17 | ||||||
|           - 16 |           - 16.0.0 | ||||||
|  |           - 17 | ||||||
| 
 | 
 | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										20
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								index.js
									
									
									
									
									
								
							| @ -1,6 +1,5 @@ | |||||||
| const {pick} = require('lodash'); | const {pick} = require('lodash'); | ||||||
| const marked = require('marked'); | const marked = require('marked'); | ||||||
| const TerminalRenderer = require('marked-terminal'); |  | ||||||
| const envCi = require('env-ci'); | const envCi = require('env-ci'); | ||||||
| const hookStd = require('hook-std'); | const hookStd = require('hook-std'); | ||||||
| const semver = require('semver'); | const semver = require('semver'); | ||||||
| @ -21,7 +20,16 @@ const {verifyAuth, isBranchUpToDate, getGitHead, tag, push, pushNotes, getTagHea | |||||||
| const getError = require('./lib/get-error'); | const getError = require('./lib/get-error'); | ||||||
| const {COMMIT_NAME, COMMIT_EMAIL} = require('./lib/definitions/constants'); | const {COMMIT_NAME, COMMIT_EMAIL} = require('./lib/definitions/constants'); | ||||||
| 
 | 
 | ||||||
|  | let markedOptionsSet = false; | ||||||
|  | async function terminalOutput(text) { | ||||||
|  |   if (!markedOptionsSet) { | ||||||
|  |     const {default: TerminalRenderer} = await import('marked-terminal'); // eslint-disable-line node/no-unsupported-features/es-syntax
 | ||||||
|     marked.setOptions({renderer: new TerminalRenderer()}); |     marked.setOptions({renderer: new TerminalRenderer()}); | ||||||
|  |     markedOptionsSet = true; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   return marked.parse(text); | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| /* eslint complexity: off */ | /* eslint complexity: off */ | ||||||
| async function run(context, plugins) { | async function run(context, plugins) { | ||||||
| @ -207,20 +215,20 @@ async function run(context, plugins) { | |||||||
|   if (options.dryRun) { |   if (options.dryRun) { | ||||||
|     logger.log(`Release note for version ${nextRelease.version}:`); |     logger.log(`Release note for version ${nextRelease.version}:`); | ||||||
|     if (nextRelease.notes) { |     if (nextRelease.notes) { | ||||||
|       context.stdout.write(marked(nextRelease.notes)); |       context.stdout.write(await terminalOutput(nextRelease.notes)); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return pick(context, ['lastRelease', 'commits', 'nextRelease', 'releases']); |   return pick(context, ['lastRelease', 'commits', 'nextRelease', 'releases']); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function logErrors({logger, stderr}, err) { | async function logErrors({logger, stderr}, err) { | ||||||
|   const errors = extractErrors(err).sort((error) => (error.semanticRelease ? -1 : 0)); |   const errors = extractErrors(err).sort((error) => (error.semanticRelease ? -1 : 0)); | ||||||
|   for (const error of errors) { |   for (const error of errors) { | ||||||
|     if (error.semanticRelease) { |     if (error.semanticRelease) { | ||||||
|       logger.error(`${error.code} ${error.message}`); |       logger.error(`${error.code} ${error.message}`); | ||||||
|       if (error.details) { |       if (error.details) { | ||||||
|         stderr.write(marked(error.details)); |         stderr.write(await terminalOutput(error.details)); // eslint-disable-line no-await-in-loop
 | ||||||
|       } |       } | ||||||
|     } else { |     } else { | ||||||
|       logger.error('An error occurred while running semantic-release: %O', error); |       logger.error('An error occurred while running semantic-release: %O', error); | ||||||
| @ -234,7 +242,7 @@ async function callFail(context, plugins, err) { | |||||||
|     try { |     try { | ||||||
|       await plugins.fail({...context, errors}); |       await plugins.fail({...context, errors}); | ||||||
|     } catch (error) { |     } catch (error) { | ||||||
|       logErrors(context, error); |       await logErrors(context, error); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -265,7 +273,7 @@ module.exports = async (cliOptions = {}, {cwd = process.cwd(), env = process.env | |||||||
|       throw error; |       throw error; | ||||||
|     } |     } | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     logErrors(context, error); |     await logErrors(context, error); | ||||||
|     unhook(); |     unhook(); | ||||||
|     throw error; |     throw error; | ||||||
|   } |   } | ||||||
|  | |||||||
							
								
								
									
										6869
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6869
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -23,7 +23,7 @@ | |||||||
|     "@semantic-release/commit-analyzer": "^9.0.2", |     "@semantic-release/commit-analyzer": "^9.0.2", | ||||||
|     "@semantic-release/error": "^3.0.0", |     "@semantic-release/error": "^3.0.0", | ||||||
|     "@semantic-release/github": "^8.0.0", |     "@semantic-release/github": "^8.0.0", | ||||||
|     "@semantic-release/npm": "^8.0.0", |     "@semantic-release/npm": "^9.0.0-beta.1", | ||||||
|     "@semantic-release/release-notes-generator": "^10.0.0", |     "@semantic-release/release-notes-generator": "^10.0.0", | ||||||
|     "aggregate-error": "^3.0.0", |     "aggregate-error": "^3.0.0", | ||||||
|     "cosmiconfig": "^7.0.0", |     "cosmiconfig": "^7.0.0", | ||||||
| @ -37,8 +37,8 @@ | |||||||
|     "hook-std": "^2.0.0", |     "hook-std": "^2.0.0", | ||||||
|     "hosted-git-info": "^4.0.0", |     "hosted-git-info": "^4.0.0", | ||||||
|     "lodash": "^4.17.21", |     "lodash": "^4.17.21", | ||||||
|     "marked": "^2.0.0", |     "marked": "^4.0.10", | ||||||
|     "marked-terminal": "^4.1.1", |     "marked-terminal": "^5.0.0", | ||||||
|     "micromatch": "^4.0.2", |     "micromatch": "^4.0.2", | ||||||
|     "p-each-series": "^2.1.0", |     "p-each-series": "^2.1.0", | ||||||
|     "p-reduce": "^2.0.0", |     "p-reduce": "^2.0.0", | ||||||
| @ -70,7 +70,7 @@ | |||||||
|     "xo": "0.29.1" |     "xo": "0.29.1" | ||||||
|   }, |   }, | ||||||
|   "engines": { |   "engines": { | ||||||
|     "node": ">=14.17" |     "node": ">=16 || ^14.17" | ||||||
|   }, |   }, | ||||||
|   "files": [ |   "files": [ | ||||||
|     "bin", |     "bin", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user