You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 466B

123456789101112131415
  1. 'use strict';
  2. const execa = require('execa');
  3. const findVersions = require('find-versions');
  4. module.exports = (binary, options = {}) => {
  5. return execa(binary, options.args || ['--version'])
  6. .then(result => findVersions(result.stdout || result.stderr, {loose: true})[0])
  7. .catch(error => {
  8. if (error.code === 'ENOENT') {
  9. error.message = `Couldn't find the \`${binary}\` binary. Make sure it's installed and in your $PATH.`;
  10. }
  11. throw error;
  12. });
  13. };