please-upgrade-git
v1.0.5
Published
Displays a beginner-friendly message telling your user to upgrade their version of git
Downloads
2
Maintainers
Readme
Please upgrade git
supporting semver checking, forked from please-upgrade-npm
:information_desk_person: show a message to your users to upgrade git instead of a stacktrace
Usage
npm install please-upgrade-git
Add please-upgrade-git
at the top of your CLI
#!/usr/bin/env node
const pkg = require('./package.json')
require('please-upgrade-git')(pkg) // <- Must run BEFORE requiring any other modules
// ...
Set in your package.json
the required git version
{
"engines": {
"git": ">=2.20.1"
}
}
Options
You can set custom exitCode
and message
function if needed
pleaseUpgradeGit(pkg, {
exitCode: 0, // Default: 1
message: function(requiredVersion, currentVersion) {
return 'Oops this program require git ' + requiredVersion + ', you have ' + currentVersion
}
})
Important: to keep message
function compatible with older versions of Node, avoid using ES6 features like =>
or string interpolation.