-
-
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.
feat(commitlint config): ✨ format commit message with local com
- Loading branch information
Showing
4 changed files
with
75 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* @since 2016-11-22 13:29 | ||
* @author vivaxy | ||
*/ | ||
const yargs = require('yargs'); | ||
const updateNotifier = require('update-notifier'); | ||
const findUp = require('find-up'); | ||
const fs = require('fs'); | ||
|
||
const pkg = require('../package.json'); | ||
const index = require('../commands/index.js'); | ||
|
||
const configureYargs = () => { | ||
const configPath = findUp.sync(['.gacprc', '.gacprc.json']); | ||
const config = configPath ? JSON.parse(fs.readFileSync(configPath)) : {}; | ||
return yargs | ||
.options({ | ||
push: { | ||
alias: 'p', | ||
describe: 'run git push', | ||
default: true, | ||
}, | ||
emoji: { | ||
alias: 'e', | ||
describe: 'use emoji code', | ||
choices: ['code', 'emoji'], | ||
default: 'code', | ||
}, | ||
}) | ||
.config(config) | ||
.help() | ||
.version().argv._; | ||
}; | ||
|
||
configureYargs(); | ||
updateNotifier({ pkg }).notify(); | ||
|
||
const argv = yargs.argv; | ||
|
||
console.log(argv); | ||
index(argv).catch((ex) => { | ||
throw ex; | ||
}); |
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 load = require('@commitlint/load'); | ||
|
||
module.exports = async () => { | ||
let rules; | ||
try { | ||
rules = await load().then((config) => config.rules); | ||
} catch (e) { | ||
rules = {}; | ||
} | ||
return rules; | ||
}; |
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