-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
76 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# 1.0.0 | ||
|
||
- check git repository | ||
- optimize help message | ||
|
||
# 0.0.0 | ||
|
||
first 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
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,14 @@ | ||
/** | ||
* @since 2016-11-22 16:16 | ||
* @author vivaxy | ||
*/ | ||
|
||
import chalk from 'chalk'; | ||
|
||
export const info = (...args) => { | ||
console.log(chalk.blue(...args)); | ||
}; | ||
|
||
export const error = (...args) => { | ||
console.log(chalk.red(...args)); | ||
}; |
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,19 @@ | ||
/** | ||
* @since 2016-11-22 16:04 | ||
* @author vivaxy | ||
*/ | ||
|
||
import sh from 'shelljs'; | ||
|
||
const shellSilentConfig = { | ||
silent: true, | ||
}; | ||
|
||
export default (command) => { | ||
let result = null; | ||
const shellExec = sh.exec(command, shellSilentConfig); | ||
if (shellExec.code === 0) { | ||
result = shellExec.stdout.split(`\n`)[0]; | ||
} | ||
return result; | ||
}; |
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,20 @@ | ||
/** | ||
* @since 2016-11-22 16:05 | ||
* @author vivaxy | ||
*/ | ||
|
||
import path from 'path'; | ||
import sh from 'shelljs'; | ||
|
||
import getInfoFromShell from './getInfoFromShell'; | ||
|
||
const cwd = process.cwd(); | ||
|
||
export default () => { | ||
if (sh.test(`-d`, path.join(cwd, `.git`))) { | ||
if (getInfoFromShell(`git rev-parse --is-inside-work-tree`) === `true`) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; |