Skip to content

Commit

Permalink
fix: provide more helpful success message
Browse files Browse the repository at this point in the history
A link to documentation and the `git aliases` command are both shown
after a successful install.
  • Loading branch information
jlegrone committed Aug 8, 2017
1 parent c06a74a commit 63f7d44
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions scripts/validate-git-version.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
const validateGitVersion = require('validate-git-version')
const { blue, yellow } = require('chalk')
const { blue, yellow, red, green, reset } = require('chalk')
const { name: moduleName } = require('../package')

const minimumVersion = '2.6.0'

validateGitVersion(
`^${minimumVersion}`,
(currentVersion) => console.log(yellow(
`⚠️ Git version ${currentVersion} is not compatible with ${moduleName}. Please upgrade to git ${minimumVersion} or later.`
)),
(currentVersion) => console.log(blue(
`🎉 Git version ${currentVersion} is compatible with ${moduleName}.`
))
)
const onInValid = (currentVersion) => console.log(yellow(
`
⚠️ Git version ${red(currentVersion)} is not compatible with ${moduleName}.
Please upgrade to git ${green(minimumVersion)} or later.
`
))

const onValid = () => console.log(blue(
`
🎉 ${moduleName} install successful!
Type ${yellow('git aliases')} to view available aliases.
${reset('More documentation is available at https://github.com/jlegrone/git-config.')}
`
))

validateGitVersion(`^${minimumVersion}`, onInValid, onValid)

0 comments on commit 63f7d44

Please sign in to comment.