diff --git a/cli.js b/cli.js index f5eee32..5ef587b 100755 --- a/cli.js +++ b/cli.js @@ -94,7 +94,7 @@ function promptForCommand(argv, cb) { var questions = [{ type: 'list', name: 'command', - message: "What do you want to do?", + message: 'What do you want to do?', choices: [{ name: 'Add a new contributor or add a new contribution type', value: 'add' diff --git a/lib/contributors/prompt.js b/lib/contributors/prompt.js index b02d675..bea1c23 100644 --- a/lib/contributors/prompt.js +++ b/lib/contributors/prompt.js @@ -22,12 +22,12 @@ function getQuestions(options, username, contributions) { return [{ type: 'input', name: 'username', - message: "What is the contributor's GitHub username?", + message: 'What is the contributor\'s GitHub username?', when: !username }, { type: 'checkbox', name: 'contributions', - message: "What are the contribution types?", + message: 'What are the contribution types?', when: !contributions, choices: contributionChoices(options) }]; diff --git a/lib/generate/formatBadge.js b/lib/generate/format-badge.js similarity index 100% rename from lib/generate/formatBadge.js rename to lib/generate/format-badge.js diff --git a/lib/generate/formatBadge.test.js b/lib/generate/format-badge.test.js similarity index 95% rename from lib/generate/formatBadge.test.js rename to lib/generate/format-badge.test.js index 17ccd24..d7894e9 100644 --- a/lib/generate/formatBadge.test.js +++ b/lib/generate/format-badge.test.js @@ -1,6 +1,6 @@ import test from 'ava'; import _ from 'lodash/fp'; -import formatBadge from './formatBadge'; +import formatBadge from './format-badge'; test('should return badge with the number of contributors', t => { const options = {}; diff --git a/lib/generate/formatContributionType.js b/lib/generate/format-contribution-type.js similarity index 100% rename from lib/generate/formatContributionType.js rename to lib/generate/format-contribution-type.js diff --git a/lib/generate/formatContributionType.test.js b/lib/generate/format-contribution-type.test.js similarity index 98% rename from lib/generate/formatContributionType.test.js rename to lib/generate/format-contribution-type.test.js index 4dd2fce..43413eb 100644 --- a/lib/generate/formatContributionType.test.js +++ b/lib/generate/format-contribution-type.test.js @@ -1,6 +1,6 @@ import test from 'ava'; import contributors from './fixtures/contributors.json'; -import formatContributionType from './formatContributionType'; +import formatContributionType from './format-contribution-type'; const fixtures = () => { const options = { diff --git a/lib/generate/formatContributor.js b/lib/generate/format-contributor.js similarity index 95% rename from lib/generate/formatContributor.js rename to lib/generate/format-contributor.js index 1419f87..d71b6d9 100644 --- a/lib/generate/formatContributor.js +++ b/lib/generate/format-contributor.js @@ -1,7 +1,7 @@ 'use strict'; var _ = require('lodash/fp'); -var formatContributionType = require('./formatContributionType'); +var formatContributionType = require('./format-contribution-type'); var avatarTemplate = _.template('![<%= contributor.name %>](<%= contributor.avatar_url %>)'); var avatarBlockTemplate = _.template('[<%= avatar %>
<%= contributor.name %>](<%= contributor.profile %>)'); diff --git a/lib/generate/formatContributor.test.js b/lib/generate/format-contributor.test.js similarity index 97% rename from lib/generate/formatContributor.test.js rename to lib/generate/format-contributor.test.js index 62c139b..f152cd0 100644 --- a/lib/generate/formatContributor.test.js +++ b/lib/generate/format-contributor.test.js @@ -1,6 +1,6 @@ import test from 'ava'; import _ from 'lodash/fp'; -import formatContributor from './formatContributor'; +import formatContributor from './format-contributor'; import contributors from './fixtures/contributors.json'; function fixtures() { diff --git a/lib/generate/index.js b/lib/generate/index.js index 7e15749..7eefa9a 100644 --- a/lib/generate/index.js +++ b/lib/generate/index.js @@ -2,10 +2,10 @@ var _ = require('lodash/fp'); var injectContentBetween = require('../util').markdown.injectContentBetween; -var formatBadge = require('./formatBadge'); -var formatContributor = require('./formatContributor'); +var formatBadge = require('./format-badge'); +var formatContributor = require('./format-contributor'); -var badgeRegex = /\[\!\[All Contributors\]\([a-zA-Z0-9\-\.\/_\:\?=]+\)\]\(\#\w+\)/; +var badgeRegex = /\[!\[All Contributors\]\([a-zA-Z0-9\-\.\/_:\?=]+\)\]\(#\w+\)/; function injectListBetweenTags(newContent) { return function (previousContent) { diff --git a/lib/init/addBadge.test.js b/lib/init/add-badge.test.js similarity index 94% rename from lib/init/addBadge.test.js rename to lib/init/add-badge.test.js index 85af951..1bb0e15 100644 --- a/lib/init/addBadge.test.js +++ b/lib/init/add-badge.test.js @@ -1,5 +1,5 @@ import test from 'ava'; -import {addBadge} from './initContent'; +import {addBadge} from './init-content'; test('should insert badge under title', t => { const content = [ diff --git a/lib/init/addContributorsList.test.js b/lib/init/add-contributors-list.test.js similarity index 96% rename from lib/init/addContributorsList.test.js rename to lib/init/add-contributors-list.test.js index 1cd3ef7..35c972e 100644 --- a/lib/init/addContributorsList.test.js +++ b/lib/init/add-contributors-list.test.js @@ -1,5 +1,5 @@ import test from 'ava'; -import {addContributorsList} from './initContent'; +import {addContributorsList} from './init-content'; test('should insert list under contributors section', t => { const content = [ diff --git a/lib/init/index.js b/lib/init/index.js index 0746284..e7acef2 100644 --- a/lib/init/index.js +++ b/lib/init/index.js @@ -4,7 +4,7 @@ var _ = require('lodash/fp'); var series = require('async/series'); var util = require('../util'); var prompt = require('./prompt'); -var initContent = require('./initContent'); +var initContent = require('./init-content'); var configFile = util.configFile; var markdown = util.markdown; diff --git a/lib/init/initContent.js b/lib/init/init-content.js similarity index 100% rename from lib/init/initContent.js rename to lib/init/init-content.js diff --git a/lib/init/prompt.js b/lib/init/prompt.js index fd8e9d6..e364e76 100644 --- a/lib/init/prompt.js +++ b/lib/init/prompt.js @@ -7,11 +7,11 @@ var git = require('../util').git; var questions = [{ type: 'input', name: 'projectName', - message: "What's the name of the repository?" + message: 'What\'s the name of the repository?' }, { type: 'input', name: 'projectOwner', - message: "Who is the owner of the repository?" + message: 'Who is the owner of the repository?' }, { type: 'input', name: 'contributorFile', @@ -20,11 +20,11 @@ var questions = [{ }, { type: 'confirm', name: 'needBadge', - message: "Do you want a badge tallying the number of contributors?" + message: 'Do you want a badge tallying the number of contributors?' }, { type: 'input', name: 'badgeFile', - message: "In which file should the badge be shown?", + message: 'In which file should the badge be shown?', when: function (answers) { return answers.needBadge; }, @@ -34,13 +34,13 @@ var questions = [{ }, { type: 'input', name: 'imageSize', - message: "How big should the avatars be? (in px)", + message: 'How big should the avatars be? (in px)', filter: parseInt, default: 100 }, { type: 'confirm', name: 'commit', - message: "Do you want this badge to auto-commit when contributors are added?", + message: 'Do you want this badge to auto-commit when contributors are added?', default: true }]; diff --git a/lib/util/configFile.js b/lib/util/config-file.js similarity index 100% rename from lib/util/configFile.js rename to lib/util/config-file.js diff --git a/lib/util/contributionTypes.js b/lib/util/contribution-types.js similarity index 100% rename from lib/util/contributionTypes.js rename to lib/util/contribution-types.js diff --git a/lib/util/git.js b/lib/util/git.js index a7e8e73..1f94cd0 100644 --- a/lib/util/git.js +++ b/lib/util/git.js @@ -1,12 +1,11 @@ 'use strict'; var path = require('path'); +var spawn = require('child_process').spawn; var _ = require('lodash/fp'); var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> <%= username %> as a contributor'; -var spawn = require('child_process').spawn; - function getRemoteOriginData(cb) { var output = ''; var git = spawn('git', 'config --get remote.origin.url'.split(' ')); @@ -21,7 +20,7 @@ function getRemoteOriginData(cb) { } function parse(originUrl) { - var result = /\:(\w+)\/([A-Za-z0-9-_]+)/.exec(originUrl); + var result = /:(\w+)\/([A-Za-z0-9-_]+)/.exec(originUrl); return { projectOwner: result[1], projectName: result[2] diff --git a/lib/util/index.js b/lib/util/index.js index e6cfc6c..1bdb752 100644 --- a/lib/util/index.js +++ b/lib/util/index.js @@ -1,8 +1,8 @@ 'use strict'; module.exports = { - configFile: require('./configFile'), - contributionTypes: require('./contributionTypes'), + configFile: require('./config-file'), + contributionTypes: require('./contribution-types'), git: require('./git'), markdown: require('./markdown') };