Skip to content

Commit

Permalink
fix(prompt): 🐛 Fix prompt default value
Browse files Browse the repository at this point in the history
  • Loading branch information
vivaxy committed Jun 14, 2019
1 parent 446e027 commit 4cfa76a
Show file tree
Hide file tree
Showing 3 changed files with 311 additions and 104 deletions.
8 changes: 7 additions & 1 deletion lib/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
* @author vivaxy
*/

const prompts = require('prompts');
const debug = require('debug');
const wrap = require('word-wrap');
const prompts = require('prompts');

const { getHistory, setHistory } = require('./history.js');
const { getCommitTypes, updateTypesStat } = require('./commitTypes.js');
const { getGitmojis, updateGitmojisStat } = require('./gitmojis.js');

const debugPrompt = debug('prompt');

module.exports = async (emoji) => {
const [typeList, gitmojiList] = await Promise.all([
getCommitTypes(),
Expand All @@ -24,6 +27,7 @@ module.exports = async (emoji) => {
if (index === -1) {
return 0;
}
return index;
}

function suggest(input, choices) {
Expand All @@ -35,6 +39,8 @@ module.exports = async (emoji) => {
});
}

debugPrompt('history:', history);

// ${type}(${scope}): ${emoji}${subject} \n\n ${body} \n\n ${footer}
const questions = [
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"prompts": "^2.1.0",
"right-pad": "^1.0.1",
"standard-version": "^4.3.0",
"update-notifier": "^2.1.0",
"update-notifier": "^3.0.0",
"word-wrap": "^1.1.0",
"yargs": "^6.4.0"
},
Expand Down
Loading

0 comments on commit 4cfa76a

Please sign in to comment.