chore(package): update xo to version 0.21.0
This commit is contained in:
		
							parent
							
								
									cd9f2bdd44
								
							
						
					
					
						commit
						f3e4991819
					
				
							
								
								
									
										2
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								index.js
									
									
									
									
									
								
							| @ -48,7 +48,7 @@ async function run(options, plugins) { | |||||||
| 
 | 
 | ||||||
|   options.repositoryUrl = await getGitAuthUrl(options); |   options.repositoryUrl = await getGitAuthUrl(options); | ||||||
| 
 | 
 | ||||||
|   if (!await isBranchUpToDate(options.branch)) { |   if (!(await isBranchUpToDate(options.branch))) { | ||||||
|     logger.log( |     logger.log( | ||||||
|       "The local branch %s is behind the remote one, therefore a new version won't be published.", |       "The local branch %s is behind the remote one, therefore a new version won't be published.", | ||||||
|       options.branch |       options.branch | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ const {gitTags, isRefInHistory, gitTagHead} = require('./git'); | |||||||
|  * - Sort the versions |  * - Sort the versions | ||||||
|  * - Retrive the highest version |  * - Retrive the highest version | ||||||
|  * |  * | ||||||
|  |  * @param {String} tagFormat Git tag format. | ||||||
|  * @param {Object} logger Global logger. |  * @param {Object} logger Global logger. | ||||||
|  * @return {Promise<LastRelease>} The last tagged release or `undefined` if none is found. |  * @return {Promise<LastRelease>} The last tagged release or `undefined` if none is found. | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -37,21 +37,20 @@ module.exports = (pluginType, pluginsPath, globalOpts, pluginOpts, logger) => { | |||||||
|     throw getError('EPLUGIN', {pluginType, pluginName}); |     throw getError('EPLUGIN', {pluginType, pluginName}); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return Object.defineProperty( |   const validator = async input => { | ||||||
|     async input => { |     const definition = PLUGINS_DEFINITIONS[pluginType]; | ||||||
|       const definition = PLUGINS_DEFINITIONS[pluginType]; |     try { | ||||||
|       try { |       const result = await func(cloneDeep(input)); | ||||||
|         const result = await func(cloneDeep(input)); |       if (definition && definition.output && !definition.output.validator(result)) { | ||||||
|         if (definition && definition.output && !definition.output.validator(result)) { |         throw getError(PLUGINS_DEFINITIONS[pluginType].output.error, {result, pluginName}); | ||||||
|           throw getError(PLUGINS_DEFINITIONS[pluginType].output.error, {result, pluginName}); |  | ||||||
|         } |  | ||||||
|         return result; |  | ||||||
|       } catch (err) { |  | ||||||
|         extractErrors(err).forEach(err => Object.assign(err, {pluginName})); |  | ||||||
|         throw err; |  | ||||||
|       } |       } | ||||||
|     }, |       return result; | ||||||
|     'pluginName', |     } catch (err) { | ||||||
|     {value: pluginName, writable: false, enumerable: true} |       extractErrors(err).forEach(err => Object.assign(err, {pluginName})); | ||||||
|   ); |       throw err; | ||||||
|  |     } | ||||||
|  |   }; | ||||||
|  | 
 | ||||||
|  |   Reflect.defineProperty(validator, 'pluginName', {value: pluginName, writable: false, enumerable: true}); | ||||||
|  |   return validator; | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -6,14 +6,14 @@ const getError = require('./get-error'); | |||||||
| module.exports = async options => { | module.exports = async options => { | ||||||
|   const errors = []; |   const errors = []; | ||||||
| 
 | 
 | ||||||
|   if (!await isGitRepo()) { |   if (!(await isGitRepo())) { | ||||||
|     errors.push(getError('ENOGITREPO')); |     errors.push(getError('ENOGITREPO')); | ||||||
|   } else if (!options.repositoryUrl) { |   } else if (!options.repositoryUrl) { | ||||||
|     errors.push(getError('ENOREPOURL')); |     errors.push(getError('ENOREPOURL')); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // Verify that compiling the `tagFormat` produce a valid Git tag
 |   // Verify that compiling the `tagFormat` produce a valid Git tag
 | ||||||
|   if (!await verifyTagName(template(options.tagFormat)({version: '0.0.0'}))) { |   if (!(await verifyTagName(template(options.tagFormat)({version: '0.0.0'})))) { | ||||||
|     errors.push(getError('EINVALIDTAGFORMAT', {tagFormat: options.tagFormat})); |     errors.push(getError('EINVALIDTAGFORMAT', {tagFormat: options.tagFormat})); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -64,7 +64,7 @@ | |||||||
|     "proxyquire": "^2.0.0", |     "proxyquire": "^2.0.0", | ||||||
|     "sinon": "^5.0.1", |     "sinon": "^5.0.1", | ||||||
|     "tempy": "^0.2.1", |     "tempy": "^0.2.1", | ||||||
|     "xo": "^0.20.0" |     "xo": "^0.21.0" | ||||||
|   }, |   }, | ||||||
|   "engines": { |   "engines": { | ||||||
|     "node": ">=8.3" |     "node": ">=8.3" | ||||||
| @ -104,7 +104,8 @@ | |||||||
|     "all": true |     "all": true | ||||||
|   }, |   }, | ||||||
|   "prettier": { |   "prettier": { | ||||||
|     "printWidth": 120 |     "printWidth": 120, | ||||||
|  |     "trailingComma": "es5" | ||||||
|   }, |   }, | ||||||
|   "publishConfig": { |   "publishConfig": { | ||||||
|     "tag": "next" |     "tag": "next" | ||||||
|  | |||||||
| @ -165,12 +165,12 @@ test.serial('Do not set properties in option for which arg is not in command lin | |||||||
| 
 | 
 | ||||||
|   await cli(); |   await cli(); | ||||||
| 
 | 
 | ||||||
|   t.false(Object.prototype.hasOwnProperty.call(run.args[0][0], 'ci')); |   t.false(Reflect.apply(Object.prototype.hasOwnProperty, run.args[0][0], ['ci'])); | ||||||
|   t.false(Object.prototype.hasOwnProperty.call(run.args[0][0], 'd')); |   t.false(Reflect.apply(Object.prototype.hasOwnProperty, run.args[0][0], ['d'])); | ||||||
|   t.false(Object.prototype.hasOwnProperty.call(run.args[0][0], 'dry-run')); |   t.false(Reflect.apply(Object.prototype.hasOwnProperty, run.args[0][0], ['dry-run'])); | ||||||
|   t.false(Object.prototype.hasOwnProperty.call(run.args[0][0], 'debug')); |   t.false(Reflect.apply(Object.prototype.hasOwnProperty, run.args[0][0], ['debug'])); | ||||||
|   t.false(Object.prototype.hasOwnProperty.call(run.args[0][0], 'r')); |   t.false(Reflect.apply(Object.prototype.hasOwnProperty, run.args[0][0], ['r'])); | ||||||
|   t.false(Object.prototype.hasOwnProperty.call(run.args[0][0], 't')); |   t.false(Reflect.apply(Object.prototype.hasOwnProperty, run.args[0][0], ['t'])); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| test.serial('Set "noCi" options to "true" with "--no-ci"', async t => { | test.serial('Set "noCi" options to "true" with "--no-ci"', async t => { | ||||||
|  | |||||||
| @ -20,7 +20,7 @@ import getStream from 'get-stream'; | |||||||
|  * If `withRemote` is `false`, creates a regular repository and initialize it. Change the current working directory to the repository root. |  * If `withRemote` is `false`, creates a regular repository and initialize it. Change the current working directory to the repository root. | ||||||
|  * |  * | ||||||
|  * @param {Boolean} withRemote `true` to create a shallow clone of a bare repository. |  * @param {Boolean} withRemote `true` to create a shallow clone of a bare repository. | ||||||
|  * @param {String} [branc='master'] The branch to initialize. |  * @param {String} [branch='master'] The branch to initialize. | ||||||
|  * @return {String} The path of the clone if `withRemote` is `true`, the path of the repository otherwise. |  * @return {String} The path of the clone if `withRemote` is `true`, the path of the repository otherwise. | ||||||
|  */ |  */ | ||||||
| export async function gitRepo(withRemote, branch = 'master') { | export async function gitRepo(withRemote, branch = 'master') { | ||||||
|  | |||||||
| @ -16,8 +16,6 @@ const gitCredential = `${GIT_USERNAME}:${GIT_PASSWORD}`; | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Download the `gitbox` Docker image, create a new container and start it. |  * Download the `gitbox` Docker image, create a new container and start it. | ||||||
|  * |  | ||||||
|  * @return {Promise} Promise that resolves when the container is started. |  | ||||||
|  */ |  */ | ||||||
| async function start() { | async function start() { | ||||||
|   await getStream(await docker.pull(IMAGE)); |   await getStream(await docker.pull(IMAGE)); | ||||||
| @ -39,8 +37,6 @@ async function start() { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Stop and remote the `mockserver` Docker container. |  * Stop and remote the `mockserver` Docker container. | ||||||
|  * |  | ||||||
|  * @return {Promise} Promise that resolves when the container is stopped. |  | ||||||
|  */ |  */ | ||||||
| async function stop() { | async function stop() { | ||||||
|   await container.stop(); |   await container.stop(); | ||||||
|  | |||||||
| @ -12,8 +12,6 @@ let container; | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Download the `mockserver` Docker image, create a new container and start it. |  * Download the `mockserver` Docker image, create a new container and start it. | ||||||
|  * |  | ||||||
|  * @return {Promise} Promise that resolves when the container is started. |  | ||||||
|  */ |  */ | ||||||
| async function start() { | async function start() { | ||||||
|   await getStream(await docker.pull(IMAGE)); |   await getStream(await docker.pull(IMAGE)); | ||||||
| @ -39,8 +37,6 @@ async function start() { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Stop and remote the `mockserver` Docker container. |  * Stop and remote the `mockserver` Docker container. | ||||||
|  * |  | ||||||
|  * @return {Promise} Promise that resolves when the container is stopped. |  | ||||||
|  */ |  */ | ||||||
| async function stop() { | async function stop() { | ||||||
|   await container.stop(); |   await container.stop(); | ||||||
|  | |||||||
| @ -16,8 +16,6 @@ let container; | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Download the `npm-docker-couchdb` Docker image, create a new container and start it. |  * Download the `npm-docker-couchdb` Docker image, create a new container and start it. | ||||||
|  * |  | ||||||
|  * @return {Promise} Promise that resolves when the container is started. |  | ||||||
|  */ |  */ | ||||||
| async function start() { | async function start() { | ||||||
|   await getStream(await docker.pull(IMAGE)); |   await getStream(await docker.pull(IMAGE)); | ||||||
| @ -69,8 +67,6 @@ const authEnv = { | |||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Stop and remote the `npm-docker-couchdb` Docker container. |  * Stop and remote the `npm-docker-couchdb` Docker container. | ||||||
|  * |  | ||||||
|  * @return {Promise} Promise that resolves when the container is stopped. |  | ||||||
|  */ |  */ | ||||||
| async function stop() { | async function stop() { | ||||||
|   await container.stop(); |   await container.stop(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user