-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from jlegrone/feature/better-postinstall-message
Better postinstall message
- Loading branch information
Showing
5 changed files
with
46 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { exec } = require('child_process') | ||
|
||
exec( | ||
`git config --global --add include.path ${process.cwd()}/src/jlegrone.gitconfig`, | ||
(err, stdout, stderr) => { | ||
const error = err || stderr | ||
if (error) { | ||
throw new Error(error) | ||
} | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require('./remove-config') | ||
require('./add-config') | ||
require('./validate-git-version') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { exec } = require('child_process') | ||
|
||
exec( | ||
'sed -i.backup "/jlegrone.gitconfig/d" ~/.gitconfig', | ||
(err, stdout, stderr) => { | ||
const error = err || stderr | ||
if (error) { | ||
throw new Error(error) | ||
} | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |