feat(verify): initial verification for pkg, options and env
This commit is contained in:
		
							parent
							
								
									c47ff97ab3
								
							
						
					
					
						commit
						b63a43fa53
					
				
							
								
								
									
										37
									
								
								src/lib/verify.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								src/lib/verify.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,37 @@ | ||||
| const SemanticReleaseError = require('./error') | ||||
| 
 | ||||
| module.exports = function (pkg, options, env) { | ||||
|   let errors = [] | ||||
| 
 | ||||
|   if (!pkg.name) { | ||||
|     errors.push(new SemanticReleaseError( | ||||
|       'No "name" found in package.json.', | ||||
|       'ENOPKGNAME' | ||||
|     )) | ||||
|   } | ||||
| 
 | ||||
|   if (!pkg.repository || !pkg.repository.url) { | ||||
|     errors.push(new SemanticReleaseError( | ||||
|       'No "repository" found in package.json.', | ||||
|       'ENOPKGREPO' | ||||
|     )) | ||||
|   } | ||||
| 
 | ||||
|   if (options.debug) return errors | ||||
| 
 | ||||
|   if (!options['github-token']) { | ||||
|     errors.push(new SemanticReleaseError( | ||||
|       'No github token specified.', | ||||
|       'ENOGHTOKEN' | ||||
|     )) | ||||
|   } | ||||
| 
 | ||||
|   if (!env.NPM_TOKEN) { | ||||
|     errors.push(new SemanticReleaseError( | ||||
|       'No npm token specified.', | ||||
|       'ENONPMTOKEN' | ||||
|     )) | ||||
|   } | ||||
| 
 | ||||
|   return errors | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user