A ultra-simple module to check if a command-line command exists.
npm install is-yarn-installed
or if you prefer use yarn:
yarn add is-yarn-installed
You can pass a callback, but for default, a return of the value is defined.
const isYarnInstalled = require('is-yarn-installed');
console.log(isYarnInstalled())
const isYarnInstalled = require('is-yarn-installed');
isYarnInstalled(function (isInstalled) => {
if (isInstalled) {
console.log('Is installed!')
} else {
console.log('Isnt installed. :(')
}
})
To @mathisonian for all the code to detect if the system have the command installed.