diff --git a/.all-contributorsrc b/.all-contributorsrc
index abc17991..7e7f36d4 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -276,9 +276,28 @@
"contributions": [
"design"
]
+ },
+ {
+ "login": "ehmicky",
+ "name": "ehmicky",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/8136211?v=4",
+ "profile": "https://twitter.com/ehmicky",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "jamesgeorge007",
+ "name": "James George",
+ "avatar_url": "https://avatars2.githubusercontent.com/u/25279263?v=4",
+ "profile": "https://ghuser.io/jamesgeorge007",
+ "contributions": [
+ "code"
+ ]
}
],
"files": [
"README.md"
- ]
+ ],
+ "repoHost": "https://github.com"
}
diff --git a/.gitignore b/.gitignore
index 09048d22..ab4f4cb3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@ dist
# when working with contributors
package-lock.json
yarn.lock
+.vscode
+cache
diff --git a/README.md b/README.md
index 0f374251..4d7ae894 100644
--- a/README.md
+++ b/README.md
@@ -7,19 +7,33 @@
-[![Build Status][build-badge]][build]
-[![Code Coverage][coverage-badge]][coverage]
-[![Greenkeeper badge](https://badges.greenkeeper.io/all-contributors/all-contributors-cli.svg)](https://greenkeeper.io/)
-[![version][version-badge]][package] [![downloads][downloads-badge]][downloads]
-[![MIT License][license-badge]][license]
-[![Chat on Slack][chat-badge]][chat]
-[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
-
-[![All Contributors](https://img.shields.io/badge/all_contributors-28-orange.svg?style=flat-square)](#contributors)
-[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc]
-[![Watch on GitHub][github-watch-badge]][github-watch]
-[![Star on GitHub][github-star-badge]][github-star]
-[![Tweet][twitter-badge]][twitter]
+
+
+[![Build Status](https://img.shields.io/circleci/project/all-contributors/all-contributors-cli/master.svg)](https://circleci.com/gh/all-contributors/workflows/all-contributors-cli/tree/master)
+[![Code Coverage](https://img.shields.io/codecov/c/github/all-contributors/all-contributors-cli.svg)](https://codecov.io/github/all-contributors/all-contributors-cli)
+[![Version](https://img.shields.io/npm/v/all-contributors-cli.svg)](https://www.npmjs.com/package/all-contributors-cli)
+[![Downloads](https://img.shields.io/npm/dm/all-contributors-cli.svg)](http://www.npmtrends.com/all-contributors-cli)
+[![All Contributors](https://img.shields.io/badge/all_contributors-30-orange.svg?style=flat-square)](#contributors)
+[![Star on Github](https://img.shields.io/github/stars/all-contributors/all-contributors-cli.svg?style=social)](https://github.com/all-contributors/all-contributors-cli/stargazers)
## The problem
@@ -43,8 +57,8 @@ Thanks goes to these wonderful people
- Jeroen Engels 💻 📖 ⚠️ | Kent C. Dodds 📖 💻 | João Guimarães 💻 | Ben Briggs 💻 | Itai Steinherz 📖 💻 | Alex Jover 💻 📖 |
Jerod Santo 💻 | Kevin Jalbert 💻 | tunnckoCore 🔧 | Mehdi Achour 💻 | Roy Revelt 🐛 | Chris Vickery 💻 |
Bryce Reynolds 💻 | James, please 🤔 💻 | Spyros Ioakeimidis 💻 | Fernando Costa 💻 | snipe 📖 | Gant Laborde 💻 |
Md Zubair Ahmed 📖 🐛 💻 ⚠️ | Divjot Singh 📖 | João Marques 💻 📖 🤔 | Andrew Lisowski 💻 📖 ⚠️ | Xianming Zhong 📖 | C.Y.Xu 💻 |
Dura 📖 | Jake Bolam 🚇 💻 📖 ⚠️ | Maximilian Berkmann 💻 ⚠️ 📖 | tbenning 🎨 |
-
+
@@ -57,30 +71,3 @@ specification. Contributions of any kind are welcome!
## LICENSE
MIT
-
-[npm]: https://www.npmjs.com/
-[node]: https://nodejs.org
-[chat-badge]: https://img.shields.io/badge/slack-join-ff69b4.svg?style=flat-square
-[chat]: https://join.slack.com/t/all-contributors/shared_invite/enQtNTE3ODMyMTA4NTk0LTUwZDMxZGZkMmViMzYzYzk2YTM2NjRkZGM5Yzc0ZTc5NmYzNWY3Y2Q0ZTY3ZmFhZDgyY2E3ZmIzNWQwMTUxZmE
-[build-badge]: https://img.shields.io/circleci/project/all-contributors/all-contributors-cli/master.svg?style=flat-square
-[build]: https://circleci.com/gh/all-contributors/all-contributors-cli
-[coverage-badge]: https://img.shields.io/codecov/c/github/all-contributors/all-contributors-cli.svg?style=flat-square
-[coverage]: https://codecov.io/github/all-contributors/all-contributors-cli
-[version-badge]: https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square
-[package]: https://www.npmjs.com/package/all-contributors-cli
-[downloads-badge]: https://img.shields.io/npm/dm/all-contributors-cli.svg?style=flat-square
-[downloads]: http://www.npmtrends.com/all-contributors-cli
-[license-badge]: https://img.shields.io/npm/l/all-contributors-cli.svg?style=flat-square
-[license]: https://github.com/all-contributors/all-contributors-cli/blob/master/other/LICENSE
-[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
-[prs]: http://makeapullrequest.com
-[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
-[coc]: https://github.com/all-contributors/all-contributors-cli/blob/master/other/CODE_OF_CONDUCT.md
-[github-watch-badge]: https://img.shields.io/github/watchers/all-contributors/all-contributors-cli.svg?style=social
-[github-watch]: https://github.com/all-contributors/all-contributors-cli/watchers
-[github-star-badge]: https://img.shields.io/github/stars/all-contributors/all-contributors-cli.svg?style=social
-[github-star]: https://github.com/all-contributors/all-contributors-cli/stargazers
-[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20all-contributors-cli!%20https://github.com/all-contributors/all-contributors-cli%20%F0%9F%91%8D
-[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/all-contributors/all-contributors-cli.svg?style=social
-[emojis]: https://github.com/all-contributors/all-contributors#emoji-key
-[all-contributors]: https://github.com/all-contributors/all-contributors
diff --git a/package.json b/package.json
index 54453c46..6094ff1f 100644
--- a/package.json
+++ b/package.json
@@ -45,17 +45,19 @@
"@babel/runtime": "^7.2.0",
"async": "^2.0.0-rc.1",
"chalk": "^2.3.0",
+ "didyoumean": "^1.2.1",
"inquirer": "^6.2.1",
+ "json-fixer": "^1.3.1-0",
"lodash": "^4.11.2",
"pify": "^4.0.1",
"request": "^2.72.0",
- "yargs": "^12.0.5"
+ "yargs": "^13.1.0"
},
"devDependencies": {
"codecov": "^3.1.0",
"cz-conventional-changelog": "^2.1.0",
- "git-cz": "^1.8.0",
- "kcd-scripts": "^0.49.0",
+ "git-cz": "^3.0.0",
+ "kcd-scripts": "^1.0.0",
"nock": "^10.0.6",
"semantic-release": "^15.13.2"
},
diff --git a/src/cli.js b/src/cli.js
index 96f0895d..1ed3a394 100755
--- a/src/cli.js
+++ b/src/cli.js
@@ -5,6 +5,10 @@ const path = require('path')
const yargs = require('yargs')
const chalk = require('chalk')
const inquirer = require('inquirer')
+const didYouMean = require('didyoumean')
+
+// Setting edit length to be 60% of the input string's length
+didYouMean.threshold = 0.6
const init = require('./init')
const generate = require('./generate')
@@ -46,6 +50,15 @@ const yargv = yargs
}
}).argv
+function suggestCommands(cmd) {
+ const availableCommands = ['generate', 'add', 'init', 'check']
+ const suggestion = didYouMean(cmd, availableCommands)
+
+ if (suggestion) {
+ console.log(chalk.bold(`Did you mean ${suggestion}`))
+ }
+}
+
function startGeneration(argv) {
return Promise.all(
argv.files.map(file => {
@@ -170,6 +183,7 @@ promptForCommand(yargv)
case 'check':
return checkContributors(yargv)
default:
+ suggestCommands(command)
throw new Error(`Unknown command ${command}`)
}
})
diff --git a/src/contributors/prompt.js b/src/contributors/prompt.js
index 89555b88..f3bdbe77 100644
--- a/src/contributors/prompt.js
+++ b/src/contributors/prompt.js
@@ -26,6 +26,12 @@ function getQuestions(options, username, contributions) {
options.repoType,
)} username?`,
when: !username,
+ validate: function validate(input) {
+ if (!input) {
+ return 'Username not provided'
+ }
+ return true
+ },
},
{
type: 'checkbox',
@@ -88,7 +94,6 @@ function getValidUserContributions(options, contributions) {
`${invalidUserContributions.toString()} is/are invalid contribution type(s)`,
)
}
-
return validUserContributions
}
diff --git a/src/generate/__tests__/__snapshots__/index.js.snap b/src/generate/__tests__/__snapshots__/index.js.snap
index 1459a087..860d71f5 100644
--- a/src/generate/__tests__/__snapshots__/index.js.snap
+++ b/src/generate/__tests__/__snapshots__/index.js.snap
@@ -9,7 +9,8 @@ Description
These people contributed to the project:
-Kent C. Dodds is awesome! | Divjot Singh is awesome! | Jeroen Engels is awesome! |
+Kent C. Dodds is awesome! | Divjot Singh is awesome! | Jeroen Engels is awesome! |
+
Thanks a lot everyone!"
@@ -24,7 +25,8 @@ Description
These people contributed to the project:
-Kent C. Dodds is awesome! | Kent C. Dodds is awesome! | Kent C. Dodds is awesome! | Kent C. Dodds is awesome! | Kent C. Dodds is awesome! |
Kent C. Dodds is awesome! | Kent C. Dodds is awesome! |
+Kent C. Dodds is awesome! | Kent C. Dodds is awesome! | Kent C. Dodds is awesome! | Kent C. Dodds is awesome! | Kent C. Dodds is awesome! |
Kent C. Dodds is awesome! | Kent C. Dodds is awesome! |
+
Thanks a lot everyone!"
diff --git a/src/generate/__tests__/format-contributor.js b/src/generate/__tests__/format-contributor.js
index e84024e4..b8feece1 100644
--- a/src/generate/__tests__/format-contributor.js
+++ b/src/generate/__tests__/format-contributor.js
@@ -20,7 +20,7 @@ test('format a simple contributor', () => {
const {options} = fixtures()
const expected =
- '
Kent C. Dodds
👀'
+ '
Kent C. Dodds
👀'
expect(formatContributor(options, contributor)).toBe(expected)
})
@@ -30,7 +30,7 @@ test('format contributor with complex contribution types', () => {
const {options} = fixtures()
const expected =
- '
Kent C. Dodds
📖 👀 💬'
+ '
Kent C. Dodds
📖 👀 💬'
expect(formatContributor(options, contributor)).toBe(expected)
})
@@ -53,7 +53,7 @@ test('default image size to 100', () => {
delete options.imageSize
const expected =
- '
Kent C. Dodds
👀'
+ '
Kent C. Dodds
👀'
expect(formatContributor(options, contributor)).toBe(expected)
})
@@ -63,7 +63,7 @@ test('format contributor with pipes in their name', () => {
const {options} = fixtures()
const expected =
- '
Who | Needs | Pipes?
📖'
+ '
Who | Needs | Pipes?
📖'
expect(formatContributor(options, contributor)).toBe(expected)
})
@@ -73,7 +73,7 @@ test('format contributor with no github account', () => {
const {options} = fixtures()
const expected =
- '
No Github Account
🌍'
+ '
No Github Account
🌍'
expect(formatContributor(options, contributor)).toBe(expected)
})
diff --git a/src/generate/index.js b/src/generate/index.js
index a3b76ac3..33592361 100644
--- a/src/generate/index.js
+++ b/src/generate/index.js
@@ -36,7 +36,7 @@ function injectListBetweenTags(newContent) {
}
function formatLine(contributors) {
- return `${contributors.join(' | ')} | `
+ return `${contributors.join(' | ')} | `
}
diff --git a/src/init/__tests__/__snapshots__/add-contributors-list.js.snap b/src/init/__tests__/__snapshots__/add-contributors-list.js.snap
index 8ccac35f..3877768c 100644
--- a/src/init/__tests__/__snapshots__/add-contributors-list.js.snap
+++ b/src/init/__tests__/__snapshots__/add-contributors-list.js.snap
@@ -2,7 +2,7 @@
exports[`create contributors section if content is empty 1`] = `
"
-## Contributors
+## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@@ -17,7 +17,7 @@ exports[`create contributors section if it is absent 1`] = `
"# project
Description
-## Contributors
+## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
diff --git a/src/init/__tests__/add-contributors-list.js b/src/init/__tests__/add-contributors-list.js
index a6f05a6b..cb690ce5 100644
--- a/src/init/__tests__/add-contributors-list.js
+++ b/src/init/__tests__/add-contributors-list.js
@@ -1,4 +1,6 @@
+import {unlink} from 'fs'
import {addContributorsList} from '../init-content'
+import ensureFileExists from '../file-exist'
test('insert list under contributors section', () => {
const content = [
@@ -27,3 +29,21 @@ test('create contributors section if content is empty', () => {
expect(result).toMatchSnapshot()
})
+
+test('README exists', done => {
+ const file = 'README.md'
+ ensureFileExists(file)
+ .then(data => expect(data).toStrictEqual(file))
+ .then(_ => done())
+})
+
+test("LOREM doesn't exists", done => {
+ const file = 'LOREM.md'
+ ensureFileExists(file).then(data => {
+ expect(data).toStrictEqual(file)
+ return unlink(file, err => {
+ if (err) throw err
+ done()
+ })
+ })
+})
diff --git a/src/init/commit-conventions.js b/src/init/commit-conventions.js
new file mode 100644
index 00000000..5600533a
--- /dev/null
+++ b/src/init/commit-conventions.js
@@ -0,0 +1,39 @@
+const conventions = {
+ angular: {
+ name: 'Angular',
+ msg: 'docs:',
+ lowercase: true,
+ transform(msg) {
+ return msg.replace(
+ /(^.*?) ([A-Z][a-z]+) \w*/,
+ (_, ...words) => `${words[0]} ${words[1].toLowerCase()} `,
+ )
+ },
+ },
+ atom: {
+ name: 'Atom',
+ msg: ':memo:',
+ },
+ ember: {
+ name: 'Ember',
+ msg: '[DOC canary]',
+ },
+ eslint: {
+ name: 'ESLint',
+ msg: 'Docs:',
+ },
+ jshint: {
+ name: 'JSHint',
+ msg: '[[DOCS]]',
+ },
+ none: {
+ name: 'None',
+ msg: '',
+ },
+}
+
+Object.keys(conventions).forEach(style => {
+ conventions[style].value = style
+})
+
+module.exports = conventions
diff --git a/src/init/file-exist.js b/src/init/file-exist.js
new file mode 100644
index 00000000..9266104c
--- /dev/null
+++ b/src/init/file-exist.js
@@ -0,0 +1,11 @@
+const fs = require('fs')
+
+module.exports = function ensureFileExists(file) {
+ return new Promise((resolve, reject) => {
+ if (fs.existsSync(file)) return resolve(file)
+ fs.writeFile(file, '', err => {
+ if (err) reject(err)
+ resolve(file)
+ })
+ })
+}
diff --git a/src/init/index.js b/src/init/index.js
index 14759f67..59fa9bd5 100644
--- a/src/init/index.js
+++ b/src/init/index.js
@@ -1,6 +1,7 @@
const util = require('../util')
const prompt = require('./prompt')
const initContent = require('./init-content')
+const ensureFileExists = require('./file-exist')
const configFile = util.configFile
const markdown = util.markdown
@@ -13,6 +14,9 @@ module.exports = function init() {
return prompt().then(result => {
return configFile
.writeConfig('.all-contributorsrc', result.config)
+ .then(() => {
+ ensureFileExists(result.contributorFile)
+ })
.then(() =>
injectInFile(result.contributorFile, initContent.addContributorsList),
)
diff --git a/src/init/init-content.js b/src/init/init-content.js
index c4af5df2..20f08ebb 100644
--- a/src/init/init-content.js
+++ b/src/init/init-content.js
@@ -31,7 +31,7 @@ function addContributorsList(lines) {
const insertionLine = findContributorsSection(lines)
if (insertionLine === -1) {
return lines.concat([
- '## Contributors',
+ '## Contributors ✨',
'',
headerContent,
'',
diff --git a/src/init/prompt.js b/src/init/prompt.js
index 59bfa770..6606d8ec 100644
--- a/src/init/prompt.js
+++ b/src/init/prompt.js
@@ -1,6 +1,7 @@
const _ = require('lodash/fp')
const inquirer = require('inquirer')
const git = require('../util').git
+const conventions = require('./commit-conventions')
const questions = [
{
@@ -32,7 +33,8 @@ const questions = [
{
type: 'input',
name: 'repoHost',
- message: 'Where is the repository hosted? Hit Enter if it\'s on GitHub or GitLab',
+ message:
+ "Where is the repository hosted? Hit Enter if it's on GitHub or GitLab",
default: function(answers) {
if (answers.repoType === 'github') {
return 'https://github.com'
@@ -77,9 +79,19 @@ const questions = [
'Do you want this badge to auto-commit when contributors are added?',
default: true,
},
+ {
+ type: 'list',
+ name: 'commitConvention',
+ message: 'What commit convention would you want it to use?',
+ choices: Object.values(conventions),
+ default: 'none',
+ },
]
-const uniqueFiles = _.flow(_.compact, _.uniq)
+const uniqueFiles = _.flow(
+ _.compact,
+ _.uniq,
+)
module.exports = function prompt() {
return git
@@ -101,6 +113,7 @@ module.exports = function prompt() {
files: uniqueFiles([answers.contributorFile, answers.badgeFile]),
imageSize: answers.imageSize,
commit: answers.commit,
+ commitConvention: answers.commitConvention,
contributors: [],
contributorsPerLine: 7,
linkToUsage: true,
diff --git a/src/repo/__tests__/github.js b/src/repo/__tests__/github.js
index e291b4e8..478d50aa 100644
--- a/src/repo/__tests__/github.js
+++ b/src/repo/__tests__/github.js
@@ -65,6 +65,30 @@ test('handle errors', async () => {
await rejects(getUserInfo('nodisplayname'))
})
+test('Throw error when no username is provided', () => {
+ expect(getUserInfo).toThrow(
+ 'No login when adding a contributor. Please specify a username.',
+ )
+})
+
+test('Throw error when non existent username is provided', async () => {
+ const username = 'thisusernamedoesntexist'
+ nock('https://api.github.com')
+ .get(`/users/${username}`)
+ .reply(404, {
+ message: 'Not Found',
+ documentation_url:
+ 'https://developer.github.com/v3/users/#get-a-single-user',
+ })
+ try {
+ await getUserInfo(username)
+ } catch (error) {
+ expect(error.message).toEqual(
+ `Login not found when adding a contributor for username - ${username}.`,
+ )
+ }
+})
+
test('handle github errors', async () => {
nock('https://api.github.com')
.get('/users/nodisplayname')
diff --git a/src/repo/github.js b/src/repo/github.js
index dd59b49b..b3069650 100644
--- a/src/repo/github.js
+++ b/src/repo/github.js
@@ -60,6 +60,12 @@ const getUserInfo = function(username, hostname, optionalPrivateToken) {
hostname = 'https://github.com'
}
+ if (!username) {
+ throw new Error(
+ `No login when adding a contributor. Please specify a username.`,
+ )
+ }
+
const root = hostname.replace(/:\/\//, '://api.')
return request
.get({
@@ -68,11 +74,14 @@ const getUserInfo = function(username, hostname, optionalPrivateToken) {
})
.then(res => {
const body = JSON.parse(res.body)
+
let profile = body.blog || body.html_url
// Github throwing specific errors as 200...
if (!profile && body.message) {
- throw new Error(body.message)
+ throw new Error(
+ `Login not found when adding a contributor for username - ${username}.`,
+ )
}
profile = profile.startsWith('http') ? profile : `http://${profile}`
diff --git a/src/util/config-file.js b/src/util/config-file.js
index 661b5d0e..912d95fb 100644
--- a/src/util/config-file.js
+++ b/src/util/config-file.js
@@ -1,17 +1,29 @@
const fs = require('fs')
const pify = require('pify')
const _ = require('lodash/fp')
+const jf = require('json-fixer')
function readConfig(configPath) {
try {
- const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'))
+ const {data: config, changed} = jf(fs.readFileSync(configPath, 'utf-8'))
if (!('repoType' in config)) {
config.repoType = 'github'
}
+ if (!('commitConvention' in config)) {
+ config.commitConvention = 'none'
+ }
+ if (changed) {
+ //Updates the file with fixes
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2))
+ }
return config
} catch (error) {
if (error instanceof SyntaxError) {
- throw new SyntaxError(`Configuration file has malformed JSON: ${configPath}. Error:: ${error.message}`)
+ throw new SyntaxError(
+ `Configuration file has malformed JSON: ${configPath}. Error:: ${
+ error.message
+ }`,
+ )
}
if (error.code === 'ENOENT') {
throw new Error(`Configuration file not found: ${configPath}`)
diff --git a/src/util/contribution-types.js b/src/util/contribution-types.js
index 0d08749e..8d792c11 100644
--- a/src/util/contribution-types.js
+++ b/src/util/contribution-types.js
@@ -70,6 +70,10 @@ const defaultTypes = function(repoType) {
symbol: '🔌',
description: 'Plugin/utility libraries',
},
+ projectManagement: {
+ symbol: '📆',
+ description: 'Project Management',
+ },
question: {
symbol: '💬',
description: 'Answering Questions',
diff --git a/src/util/git.js b/src/util/git.js
index fdde39d9..e082925f 100644
--- a/src/util/git.js
+++ b/src/util/git.js
@@ -2,9 +2,11 @@ const path = require('path')
const spawn = require('child_process').spawn
const _ = require('lodash/fp')
const pify = require('pify')
+const conventions = require('../init/commit-conventions')
+const {readConfig} = require('./config-file')
const commitTemplate =
- '<%= (newContributor ? "Add" : "Update") %> @<%= username %> as a contributor'
+ '<%= prefix %> <%= (newContributor ? "Add" : "Update") %> @<%= username %> as a contributor'
const getRemoteOriginData = pify(cb => {
let output = ''
@@ -37,16 +39,18 @@ function getRepoInfo() {
const spawnGitCommand = pify((args, cb) => {
const git = spawn('git', args)
- const bufs = [];
- git.stderr.on('data', (buf) => bufs.push(buf));
- git.on('close', (code) => {
+ const bufs = []
+ git.stderr.on('data', buf => bufs.push(buf))
+ git.on('close', code => {
if (code) {
- const msg = Buffer.concat(bufs).toString() || `git ${args.join(' ')} - exit code: ${code}`;
- cb(new Error(msg));
+ const msg =
+ Buffer.concat(bufs).toString() ||
+ `git ${args.join(' ')} - exit code: ${code}`
+ cb(new Error(msg))
} else {
- cb(null);
+ cb(null)
}
- });
+ })
})
function commit(options, data) {
@@ -54,10 +58,16 @@ function commit(options, data) {
const absolutePathFiles = files.map(file => {
return path.resolve(process.cwd(), file)
})
+ const config = readConfig(options.config)
+ const commitConvention = conventions[config.commitConvention]
+
return spawnGitCommand(['add'].concat(absolutePathFiles)).then(() => {
- const commitMessage = _.template(options.commitTemplate || commitTemplate)(
- data,
- )
+ let commitMessage = _.template(options.commitTemplate || commitTemplate)({
+ ...data,
+ prefix: commitConvention.msg,
+ })
+ if (commitConvention.lowercase)
+ commitMessage = commitConvention.transform(commitMessage)
return spawnGitCommand(['commit', '-m', commitMessage])
})
}