Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: all-contributors-cli @ 6.2.0 .. 6.3.0

dist/contributors/__tests__/add.js

@@ -1,184 +1,182 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
-
-var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
-
-var _add = _interopRequireDefault(require("../add"));
-
-var _fixtures8 = _interopRequireDefault(require("./fixtures"));
+import addContributor from '../add'
+import fixtures from './fixtures'
function mockInfoFetcher(username) {
return Promise.resolve({
login: username,
name: 'Some name',
avatar_url: 'www.avatar.url',
- profile: 'www.profile.url'
- });
+ profile: 'www.profile.url',
+ })
}
function caseFixtures() {
- return {
- options: {
- contributors: [{
+ const options = {
+ contributors: [
+ {
login: 'Login1',
name: 'Some name',
avatar_url: 'www.avatar.url',
profile: 'www.profile.url',
- contributions: ['code']
- }]
+ contributions: ['code'],
+ },
+ ],
}
- };
+ return {options}
}
-test('callback with error if infoFetcher fails',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee() {
- var _fixtures, options, username, contributions, error, infoFetcher, resolvedError;
-
- return _regenerator.default.wrap(function (_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- infoFetcher = function () {
- return Promise.reject(error);
- };
-
- _fixtures = (0, _fixtures8.default)(), options = _fixtures.options;
- username = 'login3';
- contributions = ['doc'];
- error = new Error('infoFetcher error');
- _context.next = 7;
- return (0, _add.default)(options, username, contributions, infoFetcher).catch(function (e) {
- return e;
- });
-
- case 7:
- resolvedError = _context.sent;
- expect(resolvedError).toBe(error);
-
- case 9:
- case "end":
- return _context.stop();
+test('callback with error if infoFetcher fails', async () => {
+ const {options} = fixtures()
+ const username = 'login3'
+ const contributions = ['doc']
+ const error = new Error('infoFetcher error')
+ function infoFetcher() {
+ return Promise.reject(error)
}
- }
- }, _callee);
-})));
-test('add new contributor at the end of the list of contributors', function () {
- var _fixtures2 = (0, _fixtures8.default)(),
- options = _fixtures2.options;
-
- return (0, _add.default)(options, 'login3', ['doc'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toHaveLength(options.contributors.length + 1);
+ const resolvedError = await addContributor(
+ options,
+ username,
+ contributions,
+ infoFetcher,
+ ).catch(e => e)
+
+ expect(resolvedError).toBe(error)
+})
+
+test('add new contributor at the end of the list of contributors', () => {
+ const {options} = fixtures()
+ const username = 'login3'
+ const contributions = ['doc']
+
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toHaveLength(options.contributors.length + 1)
expect(contributors[options.contributors.length]).toEqual({
login: 'login3',
name: 'Some name',
avatar_url: 'www.avatar.url',
profile: 'www.profile.url',
- contributions: ['doc']
- });
- });
-});
-test('add new contributor at the end of the list of contributors with a url link', function () {
- var _fixtures3 = (0, _fixtures8.default)(),
- options = _fixtures3.options;
-
- options.url = 'www.foo.bar';
- return (0, _add.default)(options, 'login3', ['doc'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toHaveLength(options.contributors.length + 1);
+ contributions: ['doc'],
+ })
+ },
+ )
+})
+
+test('add new contributor at the end of the list of contributors with a url link', () => {
+ const {options} = fixtures()
+ const username = 'login3'
+ const contributions = ['doc']
+ options.url = 'www.foo.bar'
+
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toHaveLength(options.contributors.length + 1)
expect(contributors[options.contributors.length]).toEqual({
login: 'login3',
name: 'Some name',
avatar_url: 'www.avatar.url',
profile: 'www.profile.url',
- contributions: [{
- type: 'doc',
- url: 'www.foo.bar'
- }]
- });
- });
-});
-test(`should not update an existing contributor's contributions where nothing has changed`, function () {
- var _fixtures4 = (0, _fixtures8.default)(),
- options = _fixtures4.options;
-
- return (0, _add.default)(options, 'login2', ['blog', 'code'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toEqual(options.contributors);
- });
-});
-test(`should not update an existing contributor's contributions where nothing has changed but the casing`, function () {
- var _caseFixtures = caseFixtures(),
- options = _caseFixtures.options;
-
- return (0, _add.default)(options, 'login1', ['code'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toEqual(options.contributors);
- });
-});
-test(`should update an existing contributor's contributions if a new type is added`, function () {
- var _fixtures5 = (0, _fixtures8.default)(),
- options = _fixtures5.options;
-
- return (0, _add.default)(options, 'login1', ['bug'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toHaveLength(options.contributors.length);
+ contributions: [{type: 'doc', url: 'www.foo.bar'}],
+ })
+ },
+ )
+})
+
+test(`should not update an existing contributor's contributions where nothing has changed`, () => {
+ const {options} = fixtures()
+ const username = 'login2'
+ const contributions = ['blog', 'code']
+
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toEqual(options.contributors)
+ },
+ )
+})
+
+test(`should not update an existing contributor's contributions where nothing has changed but the casing`, () => {
+ const {options} = caseFixtures()
+ const username = 'login1'
+ const contributions = ['code']
+
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toEqual(options.contributors)
+ },
+ )
+})
+
+test(`should update an existing contributor's contributions if a new type is added`, () => {
+ const {options} = fixtures()
+ const username = 'login1'
+ const contributions = ['bug']
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toHaveLength(options.contributors.length)
expect(contributors[0]).toEqual({
login: 'login1',
name: 'Some name',
avatar_url: 'www.avatar.url',
profile: 'www.profile.url',
- contributions: ['code', 'bug']
- });
- });
-});
-test(`should update an existing contributor's contributions if a new type is added with different username case`, function () {
- var _caseFixtures2 = caseFixtures(),
- options = _caseFixtures2.options;
-
- return (0, _add.default)(options, 'login1', ['bug'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toHaveLength(1);
+ contributions: ['code', 'bug'],
+ })
+ },
+ )
+})
+
+test(`should update an existing contributor's contributions if a new type is added with different username case`, () => {
+ const {options} = caseFixtures()
+ const username = 'login1'
+ const contributions = ['bug']
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toHaveLength(1)
expect(contributors[0]).toEqual({
login: 'Login1',
name: 'Some name',
avatar_url: 'www.avatar.url',
profile: 'www.profile.url',
- contributions: ['code', 'bug']
- });
- });
-});
-test(`should update an existing contributor's contributions if a new type is added with a link`, function () {
- var _fixtures6 = (0, _fixtures8.default)(),
- options = _fixtures6.options;
-
- options.url = 'www.foo.bar';
- return (0, _add.default)(options, 'login1', ['bug'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toHaveLength(options.contributors.length);
+ contributions: ['code', 'bug'],
+ })
+ },
+ )
+})
+
+test(`should update an existing contributor's contributions if a new type is added with a link`, () => {
+ const {options} = fixtures()
+ const username = 'login1'
+ const contributions = ['bug']
+ options.url = 'www.foo.bar'
+
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toHaveLength(options.contributors.length)
expect(contributors[0]).toEqual({
login: 'login1',
name: 'Some name',
avatar_url: 'www.avatar.url',
profile: 'www.profile.url',
- contributions: ['code', {
- type: 'bug',
- url: 'www.foo.bar'
- }]
- });
- });
-});
-test(`should update an existing contributor's contributions if an existing type is removed`, function () {
- var _fixtures7 = (0, _fixtures8.default)(),
- options = _fixtures7.options;
-
- return (0, _add.default)(options, 'login2', ['code'], mockInfoFetcher).then(function (contributors) {
- expect(contributors).toHaveLength(options.contributors.length);
+ contributions: ['code', {type: 'bug', url: 'www.foo.bar'}],
+ })
+ },
+ )
+})
+
+test(`should update an existing contributor's contributions if an existing type is removed`, () => {
+ const {options} = fixtures()
+ const username = 'login2'
+ const contributions = ['code']
+
+ return addContributor(options, username, contributions, mockInfoFetcher).then(
+ contributors => {
+ expect(contributors).toHaveLength(options.contributors.length)
expect(contributors[1]).toEqual({
login: 'login2',
name: 'Some name',
avatar_url: 'www.avatar.url',
profile: 'www.profile.url',
- contributions: ['code']
- });
- });
-});
\ No newline at end of file
+ contributions: ['code'],
+ })
+ },
+ )
+})

dist/contributors/__tests__/addWithDetails.js

@@ -1,53 +1,25 @@
-"use strict";
+import addContributorWithDetails from '../addWithDetails'
+import fixtures from './fixtures'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
-
-var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
-
-var _addWithDetails = _interopRequireDefault(require("../addWithDetails"));
-
-var _fixtures2 = _interopRequireDefault(require("./fixtures"));
-
-test('add new contributor without going to the network',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee() {
- var _fixtures, options, userDetails, contributors;
-
- return _regenerator.default.wrap(function (_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _fixtures = (0, _fixtures2.default)(), options = _fixtures.options;
- userDetails = {
+test('add new contributor without going to the network', async () => {
+ const {options} = fixtures()
+ const userDetails = {
login: 'jakebolam',
contributions: ['code', 'security'],
name: 'Jake Bolam',
avatar_url: 'my-avatar.example.com',
- profile: 'jakebolam.com'
- };
- _context.next = 4;
- return (0, _addWithDetails.default)({
+ profile: 'jakebolam.com',
+ }
+
+ const contributors = await addContributorWithDetails({
options,
login: userDetails.login,
contributions: userDetails.contributions,
name: userDetails.name,
avatar_url: userDetails.avatar_url,
- profile: userDetails.profile
- });
-
- case 4:
- contributors = _context.sent;
- expect(contributors).toHaveLength(options.contributors.length + 1);
- expect(contributors[options.contributors.length]).toEqual(userDetails);
+ profile: userDetails.profile,
+ })
- case 7:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
-})));
\ No newline at end of file
+ expect(contributors).toHaveLength(options.contributors.length + 1)
+ expect(contributors[options.contributors.length]).toEqual(userDetails)
+})

dist/contributors/__tests__/fixtures/index.js

@@ -1,18 +1,8 @@
-"use strict";
+import contributors from './contributors.json'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.default = fixtures;
-
-var _contributors = _interopRequireDefault(require("./contributors.json"));
-
-function fixtures() {
- return {
- options: {
- contributors: _contributors.default
+export default function fixtures() {
+ const options = {
+ contributors,
}
- };
+ return {options}
}
\ No newline at end of file

dist/contributors/__tests__/prompt.js

@@ -1,52 +1,59 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _prompt = _interopRequireDefault(require("../prompt"));
+import prompt from '../prompt'
function fixtures() {
- return {
- contributors: [{
+ const options = {
+ contributors: [
+ {
login: 'jfmengels',
name: 'Jeroen Engels',
avatar_url: 'https://avatars.githubusercontent.com/u/3869412?v=3',
profile: 'https://github.com/jfmengels',
- contributions: []
- }, {
+ contributions: [],
+ },
+ {
login: 'kentcdodds',
name: 'Kent C. Dodds',
avatar_url: 'https://avatars.githubusercontent.com/u/1500684?v=3',
profile: 'http://kentcdodds.com/',
- contributions: []
- }, {
+ contributions: [],
+ },
+ {
login: 'jccguimaraes',
name: 'João Guimarães',
avatar_url: 'https://avatars.githubusercontent.com/u/14871650?v=3',
profile: 'https://github.com/jccguimaraes',
- contributions: []
- }]
- };
+ contributions: [],
+ },
+ ],
+ }
+ return options
}
-test(`should throw error if all contribution types are invalid`, function () {
- var options = fixtures();
- expect(function () {
- return (0, _prompt.default)(options, 'userName', 'invalidContributionType1,invalidContributionType2');
- }).toThrow('invalidContributionType1,invalidContributionType2 is/are invalid contribution type(s)');
-});
-test(`should not throw error if atleast one of the contribution types is valid`, function () {
- var options = fixtures();
- return (0, _prompt.default)(options, 'userName', 'wrongContributionType,code').then(function (answers) {
- expect(answers).toEqual({
- username: 'userName',
- contributions: ['code']
- });
- });
-});
-test(`should filter valid contribution types from user inserted types`, function () {
- var options = fixtures();
- return (0, _prompt.default)(options, 'userName', 'invalidContributionType1,code,invalidContributionType2,bug').then(function (answers) {
- expect(answers.contributions).toHaveLength(2);
- expect(answers.contributions).toEqual(['code', 'bug']);
- });
-});
\ No newline at end of file
+test(`should throw error if all contribution types are invalid`, () => {
+ const options = fixtures()
+ const username = 'userName'
+ const contributions = 'invalidContributionType1,invalidContributionType2'
+ expect(() => prompt(options, username, contributions)).toThrow(
+ 'invalidContributionType1,invalidContributionType2 is/are invalid contribution type(s)',
+ )
+})
+
+test(`should not throw error if atleast one of the contribution types is valid`, () => {
+ const options = fixtures()
+ const username = 'userName'
+ const contributions = 'wrongContributionType,code'
+ return prompt(options, username, contributions).then(answers => {
+ expect(answers).toEqual({username: 'userName', contributions: ['code']})
+ })
+})
+
+test(`should filter valid contribution types from user inserted types`, () => {
+ const options = fixtures()
+ const username = 'userName'
+ const contributions =
+ 'invalidContributionType1,code,invalidContributionType2,bug'
+ return prompt(options, username, contributions).then(answers => {
+ expect(answers.contributions).toHaveLength(2)
+ expect(answers.contributions).toEqual(['code', 'bug'])
+ })
+})

dist/generate/__tests__/format-badge.js

@@ -1,20 +1,26 @@
-"use strict";
+import _ from 'lodash/fp'
+import formatBadge from '../format-badge'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
+test('return badge with the number of contributors', () => {
+ const options = {}
+ const expected8 =
+ '[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)'
+ const expected16 =
+ '[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors)'
-var _fp = _interopRequireDefault(require("lodash/fp"));
+ expect(formatBadge(options, _.times(_.constant({}), 8))).toBe(expected8)
+ expect(formatBadge(options, _.times(_.constant({}), 16))).toBe(expected16)
+})
-var _formatBadge = _interopRequireDefault(require("../format-badge"));
+test('be able to specify custom badge template', () => {
+ const options = {
+ badgeTemplate: 'We have <%= contributors.length %> contributors',
+ }
-test('return badge with the number of contributors', function () {
- var options = {};
- expect((0, _formatBadge.default)(options, _fp.default.times(_fp.default.constant({}), 8))).toBe('[![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors)');
- expect((0, _formatBadge.default)(options, _fp.default.times(_fp.default.constant({}), 16))).toBe('[![All Contributors](https://img.shields.io/badge/all_contributors-16-orange.svg?style=flat-square)](#contributors)');
-});
-test('be able to specify custom badge template', function () {
- var options = {
- badgeTemplate: 'We have <%= contributors.length %> contributors'
- };
- expect((0, _formatBadge.default)(options, _fp.default.times(_fp.default.constant({}), 8))).toBe('We have 8 contributors');
- expect((0, _formatBadge.default)(options, _fp.default.times(_fp.default.constant({}), 16))).toBe('We have 16 contributors');
-});
\ No newline at end of file
+ expect(formatBadge(options, _.times(_.constant({}), 8))).toBe(
+ 'We have 8 contributors',
+ )
+ expect(formatBadge(options, _.times(_.constant({}), 16))).toBe(
+ 'We have 16 contributors',
+ )
+})

dist/generate/__tests__/format-contribution-type.js

@@ -1,156 +1,167 @@
-"use strict";
+import formatContributionType from '../format-contribution-type'
+import contributors from './fixtures/contributors.json'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _formatContributionType = _interopRequireDefault(require("../format-contribution-type"));
-
-var _contributors = _interopRequireDefault(require("./fixtures/contributors.json"));
-
-var fixtures = function () {
- return {
- options: {
+const fixtures = () => {
+ const options = {
projectOwner: 'all-contributors',
projectName: 'all-contributors-cli',
repoType: 'github',
repoHost: 'https://github.com',
- imageSize: 100
+ imageSize: 100,
}
- };
-};
-
-test('return corresponding symbol', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures = fixtures(),
- options = _fixtures.options;
-
- expect((0, _formatContributionType.default)(options, contributor, 'tool')).toBe('<a href="#tool-kentcdodds" title="Tools">🔧</a>');
- expect((0, _formatContributionType.default)(options, contributor, 'question')).toBe('<a href="#question-kentcdodds" title="Answering Questions">💬</a>');
-});
-test('return link to commits', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures2 = fixtures(),
- options = _fixtures2.options;
-
- var expectedLink = 'https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds';
- expect((0, _formatContributionType.default)(options, contributor, 'code')).toBe(`<a href="${expectedLink}" title="Code">💻</a>`);
- expect((0, _formatContributionType.default)(options, contributor, 'doc')).toBe(`<a href="${expectedLink}" title="Documentation">📖</a>`);
- expect((0, _formatContributionType.default)(options, contributor, 'test')).toBe(`<a href="${expectedLink}" title="Tests">⚠️</a>`);
-});
-test('return link to issues', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures3 = fixtures(),
- options = _fixtures3.options;
-
- expect((0, _formatContributionType.default)(options, contributor, 'bug')).toBe('<a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Akentcdodds" title="Bug reports">🐛</a>');
-});
-test('make any symbol into a link if contribution is an object', function () {
- var contributor = _contributors.default.kentcdodds;
+ return {options}
+}
- var _fixtures4 = fixtures(),
- options = _fixtures4.options;
-
- expect((0, _formatContributionType.default)(options, contributor, {
+test('return corresponding symbol', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+
+ expect(formatContributionType(options, contributor, 'tool')).toBe(
+ '<a href="#tool-kentcdodds" title="Tools">🔧</a>',
+ )
+ expect(formatContributionType(options, contributor, 'question')).toBe(
+ '<a href="#question-kentcdodds" title="Answering Questions">💬</a>',
+ )
+})
+
+test('return link to commits', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+ const expectedLink =
+ 'https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds'
+
+ expect(formatContributionType(options, contributor, 'code')).toBe(
+ `<a href="${expectedLink}" title="Code">💻</a>`,
+ )
+ expect(formatContributionType(options, contributor, 'doc')).toBe(
+ `<a href="${expectedLink}" title="Documentation">📖</a>`,
+ )
+ expect(formatContributionType(options, contributor, 'test')).toBe(
+ `<a href="${expectedLink}" title="Tests">⚠️</a>`,
+ )
+})
+
+test('return link to issues', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+ const expected =
+ '<a href="https://github.com/all-contributors/all-contributors-cli/issues?q=author%3Akentcdodds" title="Bug reports">🐛</a>'
+
+ expect(formatContributionType(options, contributor, 'bug')).toBe(expected)
+})
+
+test('make any symbol into a link if contribution is an object', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+ const contribution = {
type: 'tool',
- url: 'www.foo.bar'
- })).toBe('<a href="www.foo.bar" title="Tools">🔧</a>');
-});
-test('override url for given types', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures5 = fixtures(),
- options = _fixtures5.options;
+ url: 'www.foo.bar',
+ }
- expect((0, _formatContributionType.default)(options, contributor, {
+ expect(formatContributionType(options, contributor, contribution)).toBe(
+ '<a href="www.foo.bar" title="Tools">🔧</a>',
+ )
+})
+
+test('override url for given types', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+ const contribution = {
type: 'code',
- url: 'www.foo.bar'
- })).toBe('<a href="www.foo.bar" title="Code">💻</a>');
-});
-test('be able to add types to the symbol list', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures6 = fixtures(),
- options = _fixtures6.options;
+ url: 'www.foo.bar',
+ }
+ expect(formatContributionType(options, contributor, contribution)).toBe(
+ '<a href="www.foo.bar" title="Code">💻</a>',
+ )
+})
+
+test('be able to add types to the symbol list', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
options.types = {
- cheerful: {
- symbol: ':smiley:'
+ cheerful: {symbol: ':smiley:'},
}
- };
- expect((0, _formatContributionType.default)(options, contributor, 'cheerful')).toBe('<a href="#cheerful-kentcdodds" title="">:smiley:</a>');
- expect((0, _formatContributionType.default)(options, contributor, {
- type: 'cheerful',
- url: 'www.foo.bar'
- })).toBe('<a href="www.foo.bar" title="">:smiley:</a>');
-});
-test('be able to add types with template to the symbol list', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures7 = fixtures(),
- options = _fixtures7.options;
+ expect(formatContributionType(options, contributor, 'cheerful')).toBe(
+ '<a href="#cheerful-kentcdodds" title="">:smiley:</a>',
+ )
+ expect(
+ formatContributionType(options, contributor, {
+ type: 'cheerful',
+ url: 'www.foo.bar',
+ }),
+ ).toBe('<a href="www.foo.bar" title="">:smiley:</a>')
+})
+
+test('be able to add types with template to the symbol list', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
options.types = {
web: {
symbol: ':web:',
- link: 'www.<%= contributor.login %>.com'
+ link: 'www.<%= contributor.login %>.com',
+ },
}
- };
- expect((0, _formatContributionType.default)(options, contributor, 'web')).toBe('<a href="www.kentcdodds.com" title="">:web:</a>');
-});
-test('be able to override existing types', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures8 = fixtures(),
- options = _fixtures8.options;
+ expect(formatContributionType(options, contributor, 'web')).toBe(
+ '<a href="www.kentcdodds.com" title="">:web:</a>',
+ )
+})
+
+test('be able to override existing types', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
options.types = {
- code: {
- symbol: ':smiley:'
+ code: {symbol: ':smiley:'},
}
- };
- expect((0, _formatContributionType.default)(options, contributor, 'code')).toBe('<a href="#code-kentcdodds" title="">:smiley:</a>');
- expect((0, _formatContributionType.default)(options, contributor, {
- type: 'code',
- url: 'www.foo.bar'
- })).toBe('<a href="www.foo.bar" title="">:smiley:</a>');
-});
-test('be able to override existing templates', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures9 = fixtures(),
- options = _fixtures9.options;
+ expect(formatContributionType(options, contributor, 'code')).toBe(
+ '<a href="#code-kentcdodds" title="">:smiley:</a>',
+ )
+ expect(
+ formatContributionType(options, contributor, {
+ type: 'code',
+ url: 'www.foo.bar',
+ }),
+ ).toBe('<a href="www.foo.bar" title="">:smiley:</a>')
+})
+
+test('be able to override existing templates', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
options.types = {
code: {
symbol: ':web:',
- link: 'www.<%= contributor.login %>.com'
+ link: 'www.<%= contributor.login %>.com',
+ },
}
- };
- expect((0, _formatContributionType.default)(options, contributor, 'code')).toBe('<a href="www.kentcdodds.com" title="">:web:</a>');
- expect((0, _formatContributionType.default)(options, contributor, {
+
+ expect(formatContributionType(options, contributor, 'code')).toBe(
+ '<a href="www.kentcdodds.com" title="">:web:</a>',
+ )
+ expect(
+ formatContributionType(options, contributor, {
type: 'code',
- url: 'www.foo.bar'
- })).toBe('<a href="www.foo.bar" title="">:web:</a>');
-});
-test('throw a helpful error on unknown type', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures10 = fixtures(),
- options = _fixtures10.options;
-
- expect(function () {
- return (0, _formatContributionType.default)(options, contributor, 'docs');
- }).toThrowError('Unknown contribution type docs for contributor kentcdodds');
-});
-test('throw a helpful error on unknown type and no login', function () {
- var contributor = _contributors.default.nologin_badrole;
-
- var _fixtures11 = fixtures(),
- options = _fixtures11.options;
-
- expect(function () {
- return (0, _formatContributionType.default)(options, contributor, 'docs');
- }).toThrowError('Unknown contribution type docs for contributor Wildly Misconfigured');
-});
\ No newline at end of file
+ url: 'www.foo.bar',
+ }),
+ ).toBe('<a href="www.foo.bar" title="">:web:</a>')
+})
+
+test('throw a helpful error on unknown type', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+ expect(() =>
+ formatContributionType(options, contributor, 'docs'),
+ ).toThrowError('Unknown contribution type docs for contributor kentcdodds')
+})
+
+test('throw a helpful error on unknown type and no login', () => {
+ const contributor = contributors.nologin_badrole
+ const {options} = fixtures()
+ expect(() =>
+ formatContributionType(options, contributor, 'docs'),
+ ).toThrowError(
+ 'Unknown contribution type docs for contributor Wildly Misconfigured',
+ )
+})

dist/generate/__tests__/format-contributor.js

@@ -1,76 +1,79 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _fp = _interopRequireDefault(require("lodash/fp"));
-
-var _formatContributor = _interopRequireDefault(require("../format-contributor"));
-
-var _contributors = _interopRequireDefault(require("./fixtures/contributors.json"));
+import _ from 'lodash/fp'
+import formatContributor from '../format-contributor'
+import contributors from './fixtures/contributors.json'
function fixtures() {
- return {
- options: {
+ const options = {
projectOwner: 'all-contributors',
projectName: 'all-contributors-cli',
repoType: 'github',
repoHost: 'https://github.com',
- imageSize: 150
+ imageSize: 150,
}
- };
+ return {options}
}
-test('format a simple contributor', function () {
- var contributor = _fp.default.assign(_contributors.default.kentcdodds, {
- contributions: ['review']
- });
-
- var _fixtures = fixtures(),
- options = _fixtures.options;
-
- expect((0, _formatContributor.default)(options, contributor)).toBe('<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>');
-});
-test('format contributor with complex contribution types', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures2 = fixtures(),
- options = _fixtures2.options;
-
- expect((0, _formatContributor.default)(options, contributor)).toBe('<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a> <a href="#question-kentcdodds" title="Answering Questions">💬</a>');
-});
-test('format contributor using custom template', function () {
- var contributor = _contributors.default.kentcdodds;
-
- var _fixtures3 = fixtures(),
- options = _fixtures3.options;
-
- options.contributorTemplate = '<%= contributor.name %> is awesome!';
- expect((0, _formatContributor.default)(options, contributor)).toBe('Kent C. Dodds is awesome!');
-});
-test('default image size to 100', function () {
- var contributor = _fp.default.assign(_contributors.default.kentcdodds, {
- contributions: ['review']
- });
-
- var _fixtures4 = fixtures(),
- options = _fixtures4.options;
-
- delete options.imageSize;
- expect((0, _formatContributor.default)(options, contributor)).toBe('<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>');
-});
-test('format contributor with pipes in their name', function () {
- var contributor = _contributors.default.pipey;
-
- var _fixtures5 = fixtures(),
- options = _fixtures5.options;
-
- expect((0, _formatContributor.default)(options, contributor)).toBe('<a href="http://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Who &#124; Needs &#124; Pipes?"/><br /><sub><b>Who &#124; Needs &#124; Pipes?</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pipey" title="Documentation">📖</a>');
-});
-test('format contributor with no github account', function () {
- var contributor = _contributors.default.nologin;
+test('format a simple contributor', () => {
+ const contributor = _.assign(contributors.kentcdodds, {
+ contributions: ['review'],
+ })
+ const {options} = fixtures()
+
+ const expected =
+ '<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>'
+
+ expect(formatContributor(options, contributor)).toBe(expected)
+})
+
+test('format contributor with complex contribution types', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+
+ const expected =
+ '<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=kentcdodds" title="Documentation">📖</a> <a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a> <a href="#question-kentcdodds" title="Answering Questions">💬</a>'
+
+ expect(formatContributor(options, contributor)).toBe(expected)
+})
+
+test('format contributor using custom template', () => {
+ const contributor = contributors.kentcdodds
+ const {options} = fixtures()
+ options.contributorTemplate = '<%= contributor.name %> is awesome!'
+
+ const expected = 'Kent C. Dodds is awesome!'
+
+ expect(formatContributor(options, contributor)).toBe(expected)
+})
+
+test('default image size to 100', () => {
+ const contributor = _.assign(contributors.kentcdodds, {
+ contributions: ['review'],
+ })
+ const {options} = fixtures()
+ delete options.imageSize
+
+ const expected =
+ '<a href="http://kentcdodds.com"><img src="https://avatars1.githubusercontent.com/u/1500684" width="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub></a><br /><a href="#review-kentcdodds" title="Reviewed Pull Requests">👀</a>'
+
+ expect(formatContributor(options, contributor)).toBe(expected)
+})
+
+test('format contributor with pipes in their name', () => {
+ const contributor = contributors.pipey
+ const {options} = fixtures()
+
+ const expected =
+ '<a href="http://github.com/chrisinajar"><img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="Who &#124; Needs &#124; Pipes?"/><br /><sub><b>Who &#124; Needs &#124; Pipes?</b></sub></a><br /><a href="https://github.com/all-contributors/all-contributors-cli/commits?author=pipey" title="Documentation">📖</a>'
+
+ expect(formatContributor(options, contributor)).toBe(expected)
+})
+
+test('format contributor with no github account', () => {
+ const contributor = contributors.nologin
+ const {options} = fixtures()
- var _fixtures6 = fixtures(),
- options = _fixtures6.options;
+ const expected =
+ '<img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="No Github Account"/><br /><sub><b>No Github Account</b></sub><br /><a href="#translation" title="Translation">🌍</a>'
- expect((0, _formatContributor.default)(options, contributor)).toBe('<img src="https://avatars1.githubusercontent.com/u/1500684" width="150px;" alt="No Github Account"/><br /><sub><b>No Github Account</b></sub><br /><a href="#translation" title="Translation">🌍</a>');
-});
\ No newline at end of file
+ expect(formatContributor(options, contributor)).toBe(expected)
+})

dist/generate/__tests__/index.js

@@ -1,102 +1,165 @@
-"use strict";
-
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _ = _interopRequireDefault(require("../"));
-
-var _contributors = _interopRequireDefault(require("./fixtures/contributors.json"));
+import generate from '../'
+import contributors from './fixtures/contributors.json'
function fixtures() {
- var content = ['# project', '', 'Description', '', '## Contributors', 'These people contributed to the project:', '<!-- ALL-CONTRIBUTORS-LIST:START -->FOO BAR BAZ<!-- ALL-CONTRIBUTORS-LIST:END -->', '', 'Thanks a lot everyone!'].join('\n');
- return {
- options: {
+ const options = {
projectOwner: 'kentcdodds',
projectName: 'all-contributors',
imageSize: 100,
contributorsPerLine: 5,
- contributors: _contributors.default,
- contributorTemplate: '<%= contributor.name %> is awesome!'
- },
- jfmengels: {
+ contributors,
+ contributorTemplate: '<%= contributor.name %> is awesome!',
+ }
+
+ const jfmengels = {
login: 'jfmengels',
name: 'Jeroen Engels',
html_url: 'https://github.com/jfmengels',
avatar_url: 'https://avatars.githubusercontent.com/u/3869412?v=3',
- contributions: ['doc']
- },
- content
- };
+ contributions: ['doc'],
+ }
+
+ const content = [
+ '# project',
+ '',
+ 'Description',
+ '',
+ '## Contributors',
+ 'These people contributed to the project:',
+ '<!-- ALL-CONTRIBUTORS-LIST:START -->FOO BAR BAZ<!-- ALL-CONTRIBUTORS-LIST:END -->',
+ '',
+ 'Thanks a lot everyone!',
+ ].join('\n')
+
+ return {options, jfmengels, content}
}
-test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of contributors', function () {
- var kentcdodds = _contributors.default.kentcdodds,
- bogas04 = _contributors.default.bogas04;
-
- var _fixtures = fixtures(),
- options = _fixtures.options,
- jfmengels = _fixtures.jfmengels,
- content = _fixtures.content;
-
- var result = (0, _.default)(options, [kentcdodds, bogas04, jfmengels], content);
- expect(result).toMatchSnapshot();
-});
-test('split contributors into multiples lines when there are too many', function () {
- var kentcdodds = _contributors.default.kentcdodds;
-
- var _fixtures2 = fixtures(),
- options = _fixtures2.options,
- content = _fixtures2.content;
-
- var result = (0, _.default)(options, [kentcdodds, kentcdodds, kentcdodds, kentcdodds, kentcdodds, kentcdodds, kentcdodds], content);
- expect(result).toMatchSnapshot();
-});
-test('not inject anything if there is no tags to inject content in', function () {
- var kentcdodds = _contributors.default.kentcdodds;
-
- var _fixtures3 = fixtures(),
- options = _fixtures3.options;
-
- var content = ['# project', '', 'Description', '', 'License: MIT'].join('\n');
- var result = (0, _.default)(options, [kentcdodds], content);
- expect(result).toBe(content);
-});
-test('not inject anything if start tag is malformed', function () {
- var kentcdodds = _contributors.default.kentcdodds;
-
- var _fixtures4 = fixtures(),
- options = _fixtures4.options;
-
- var content = ['# project', '', 'Description', '<!-- ALL-CONTRIBUTORS-LIST:SSSSSSSTART -->', '<!-- ALL-CONTRIBUTORS-LIST:END -->', '', 'License: MIT'].join('\n');
- var result = (0, _.default)(options, [kentcdodds], content);
- expect(result).toBe(content);
-});
-test('not inject anything if end tag is malformed', function () {
- var kentcdodds = _contributors.default.kentcdodds;
-
- var _fixtures5 = fixtures(),
- options = _fixtures5.options;
-
- var content = ['# project', '', 'Description', '<!-- ALL-CONTRIBUTORS-LIST:START -->', '<!-- ALL-CONTRIBUTORS-LIST:EEEEEEEND -->', '', 'License: MIT'].join('\n');
- var result = (0, _.default)(options, [kentcdodds], content);
- expect(result).toBe(content);
-});
-test('inject nothing if there are no contributors', function () {
- var _fixtures6 = fixtures(),
- options = _fixtures6.options,
- content = _fixtures6.content;
-
- var expected = ['# project', '', 'Description', '', '## Contributors', 'These people contributed to the project:', '<!-- ALL-CONTRIBUTORS-LIST:START -->', '<!-- prettier-ignore -->', '<!-- ALL-CONTRIBUTORS-LIST:END -->', '', 'Thanks a lot everyone!'].join('\n');
- var result = (0, _.default)(options, [], content);
- expect(result).toBe(expected);
-});
-test('replace all-contributors badge if present', function () {
- var kentcdodds = _contributors.default.kentcdodds;
-
- var _fixtures7 = fixtures(),
- options = _fixtures7.options;
-
- var content = ['# project', '', 'Badges', ['[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)', '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)', '[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)'].join(''), '', 'License: MIT'].join('\n');
- var expected = ['# project', '', 'Badges', ['[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)', '[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)', '[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)'].join(''), '', 'License: MIT'].join('\n');
- var result = (0, _.default)(options, [kentcdodds], content);
- expect(result).toBe(expected);
-});
\ No newline at end of file
+test('replace the content between the ALL-CONTRIBUTORS-LIST tags by a table of contributors', () => {
+ const {kentcdodds, bogas04} = contributors
+ const {options, jfmengels, content} = fixtures()
+ const contributorList = [kentcdodds, bogas04, jfmengels]
+ const result = generate(options, contributorList, content)
+
+ expect(result).toMatchSnapshot()
+})
+
+test('split contributors into multiples lines when there are too many', () => {
+ const {kentcdodds} = contributors
+ const {options, content} = fixtures()
+ const contributorList = [
+ kentcdodds,
+ kentcdodds,
+ kentcdodds,
+ kentcdodds,
+ kentcdodds,
+ kentcdodds,
+ kentcdodds,
+ ]
+ const result = generate(options, contributorList, content)
+
+ expect(result).toMatchSnapshot()
+})
+
+test('not inject anything if there is no tags to inject content in', () => {
+ const {kentcdodds} = contributors
+ const {options} = fixtures()
+ const contributorList = [kentcdodds]
+ const content = ['# project', '', 'Description', '', 'License: MIT'].join(
+ '\n',
+ )
+
+ const result = generate(options, contributorList, content)
+ expect(result).toBe(content)
+})
+
+test('not inject anything if start tag is malformed', () => {
+ const {kentcdodds} = contributors
+ const {options} = fixtures()
+ const contributorList = [kentcdodds]
+ const content = [
+ '# project',
+ '',
+ 'Description',
+ '<!-- ALL-CONTRIBUTORS-LIST:SSSSSSSTART -->',
+ '<!-- ALL-CONTRIBUTORS-LIST:END -->',
+ '',
+ 'License: MIT',
+ ].join('\n')
+
+ const result = generate(options, contributorList, content)
+ expect(result).toBe(content)
+})
+
+test('not inject anything if end tag is malformed', () => {
+ const {kentcdodds} = contributors
+ const {options} = fixtures()
+ const contributorList = [kentcdodds]
+ const content = [
+ '# project',
+ '',
+ 'Description',
+ '<!-- ALL-CONTRIBUTORS-LIST:START -->',
+ '<!-- ALL-CONTRIBUTORS-LIST:EEEEEEEND -->',
+ '',
+ 'License: MIT',
+ ].join('\n')
+
+ const result = generate(options, contributorList, content)
+ expect(result).toBe(content)
+})
+
+test('inject nothing if there are no contributors', () => {
+ const {options, content} = fixtures()
+ const contributorList = []
+ const expected = [
+ '# project',
+ '',
+ 'Description',
+ '',
+ '## Contributors',
+ 'These people contributed to the project:',
+ '<!-- ALL-CONTRIBUTORS-LIST:START -->',
+ '<!-- prettier-ignore -->',
+ '<!-- ALL-CONTRIBUTORS-LIST:END -->',
+ '',
+ 'Thanks a lot everyone!',
+ ].join('\n')
+
+ const result = generate(options, contributorList, content)
+
+ expect(result).toBe(expected)
+})
+
+test('replace all-contributors badge if present', () => {
+ const {kentcdodds} = contributors
+ const {options} = fixtures()
+ const contributorList = [kentcdodds]
+ const content = [
+ '# project',
+ '',
+ 'Badges',
+ [
+ '[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
+ '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)',
+ '[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
+ ].join(''),
+ '',
+ 'License: MIT',
+ ].join('\n')
+ const expected = [
+ '# project',
+ '',
+ 'Badges',
+ [
+ '[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
+ '[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)',
+ '[![version](https://img.shields.io/npm/v/all-contributors-cli.svg?style=flat-square)](http://npm.im/all-contributors-cli)',
+ ].join(''),
+ '',
+ 'License: MIT',
+ ].join('\n')
+
+ const result = generate(options, contributorList, content)
+
+ expect(result).toBe(expected)
+})

dist/init/commit-conventions.js

@@ -0,0 +1,44 @@
+"use strict";
+
+var conventions = {
+ angular: {
+ name: 'Angular',
+ msg: 'docs:',
+ lowercase: true,
+
+ transform(msg) {
+ return msg.replace(/(^.*?) ([A-Z][a-z]+) \w*/, function () {
+ for (var _len = arguments.length, words = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ words[_key - 1] = arguments[_key];
+ }
+
+ return `${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(function (style) {
+ conventions[style].value = style;
+});
+module.exports = conventions;
\ No newline at end of file

dist/init/prompt.js

@@ -6,6 +6,8 @@
var git = require('../util').git;
+var conventions = require('./commit-conventions');
+
var questions = [{
type: 'input',
name: 'projectName',
@@ -29,7 +31,7 @@
}, {
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 _default(answers) {
if (answers.repoType === 'github') {
return 'https://github.com';
@@ -67,6 +69,12 @@
name: 'commit',
message: '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'
}];
var uniqueFiles = _.flow(_.compact, _.uniq);
@@ -89,6 +97,7 @@
files: uniqueFiles([answers.contributorFile, answers.badgeFile]),
imageSize: answers.imageSize,
commit: answers.commit,
+ commitConvention: answers.commitConvention,
contributors: [],
contributorsPerLine: 7
},

dist/init/__tests__/add-badge.js

@@ -1,15 +1,29 @@
-"use strict";
+import {addBadge} from '../init-content'
-var _initContent = require("../init-content");
+test('insert badge under title', () => {
+ const content = ['# project', '', 'Description', '', 'Foo bar'].join('\n')
+ const expected = [
+ '# project',
+ '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)',
+ '',
+ 'Description',
+ '',
+ 'Foo bar',
+ ].join('\n')
-test('insert badge under title', function () {
- var content = ['# project', '', 'Description', '', 'Foo bar'].join('\n');
- var expected = ['# project', '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)', '', 'Description', '', 'Foo bar'].join('\n');
- var result = (0, _initContent.addBadge)(content);
- expect(result).toBe(expected);
-});
-test('add badge if content is empty', function () {
- var expected = ['', '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)'].join('\n');
- var result = (0, _initContent.addBadge)('');
- expect(result).toBe(expected);
-});
\ No newline at end of file
+ const result = addBadge(content)
+
+ expect(result).toBe(expected)
+})
+
+test('add badge if content is empty', () => {
+ const content = ''
+ const expected = [
+ '',
+ '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)',
+ ].join('\n')
+
+ const result = addBadge(content)
+
+ expect(result).toBe(expected)
+})

dist/init/__tests__/add-contributors-list.js

@@ -1,18 +1,29 @@
-"use strict";
+import {addContributorsList} from '../init-content'
-var _initContent = require("../init-content");
+test('insert list under contributors section', () => {
+ const content = [
+ '# project',
+ '',
+ 'Description',
+ '',
+ '## Contributors',
+ '',
+ ].join('\n')
+ const result = addContributorsList(content)
-test('insert list under contributors section', function () {
- var content = ['# project', '', 'Description', '', '## Contributors', ''].join('\n');
- var result = (0, _initContent.addContributorsList)(content);
- expect(result).toMatchSnapshot();
-});
-test('create contributors section if it is absent', function () {
- var content = ['# project', '', 'Description'].join('\n');
- var result = (0, _initContent.addContributorsList)(content);
- expect(result).toMatchSnapshot();
-});
-test('create contributors section if content is empty', function () {
- var result = (0, _initContent.addContributorsList)('');
- expect(result).toMatchSnapshot();
-});
\ No newline at end of file
+ expect(result).toMatchSnapshot()
+})
+
+test('create contributors section if it is absent', () => {
+ const content = ['# project', '', 'Description'].join('\n')
+ const result = addContributorsList(content)
+
+ expect(result).toMatchSnapshot()
+})
+
+test('create contributors section if content is empty', () => {
+ const content = ''
+ const result = addContributorsList(content)
+
+ expect(result).toMatchSnapshot()
+})

dist/repo/__tests__/github.js

@@ -1,389 +1,195 @@
-"use strict";
+import nock from 'nock'
+import githubAPI from '../github'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
+import allContributorsCliResponse from './github/all-contributors.response.json'
+import allContributorsCliTransformed from './github/all-contributors.transformed.json'
-var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
-
-var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
-
-var _nock = _interopRequireDefault(require("nock"));
-
-var _github = _interopRequireDefault(require("../github"));
-
-var _allContributorsResponse = _interopRequireDefault(require("./github/all-contributors.response.json"));
-
-var _allContributorsTransformed = _interopRequireDefault(require("./github/all-contributors.transformed.json"));
-
-var _reactNativeResponse = _interopRequireDefault(require("./github/react-native.response.1.json"));
-
-var _reactNativeResponse2 = _interopRequireDefault(require("./github/react-native.response.2.json"));
-
-var _reactNativeResponse3 = _interopRequireDefault(require("./github/react-native.response.3.json"));
-
-var _reactNativeResponse4 = _interopRequireDefault(require("./github/react-native.response.4.json"));
-
-var _reactNativeTransformed = _interopRequireDefault(require("./github/react-native.transformed.json"));
-
-var getUserInfo = _github.default.getUserInfo;
-var check = _github.default.getContributors;
-beforeAll(function () {
- (0, _nock.default)('https://api.github.com').persist().get('/repos/all-contributors/all-contributors-cli/contributors?per_page=100').reply(200, _allContributorsResponse.default).get('/repos/facebook/react-native/contributors?per_page=100').reply(200, _reactNativeResponse.default, {
- Link: '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=2>; rel="next", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="last"'
- }).get('/repositories/29028775/contributors?per_page=100&page=2').reply(200, _reactNativeResponse2.default, {
- Link: '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=3>; rel="next", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="last", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="first", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="prev"'
- }).get('/repositories/29028775/contributors?per_page=100&page=3').reply(200, _reactNativeResponse3.default, {
- Link: '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="next", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="last", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="first", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=2>; rel="prev"'
- }).get('/repositories/29028775/contributors?per_page=100&page=4').reply(200, _reactNativeResponse4.default, {
- Link: '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="first", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=3>; rel="prev"'
- });
-});
-test('Handle a single results page correctly',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee() {
- var transformed;
- return _regenerator.default.wrap(function (_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return check('all-contributors', 'all-contributors-cli');
-
- case 2:
- transformed = _context.sent;
- expect(transformed).toEqual(_allContributorsTransformed.default);
-
- case 4:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
-})));
-test('Handle multiple results pages correctly',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee2() {
- var transformed;
- return _regenerator.default.wrap(function (_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.next = 2;
- return check('facebook', 'react-native');
-
- case 2:
- transformed = _context2.sent;
- expect(transformed).toEqual(_reactNativeTransformed.default);
-
- case 4:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
-})));
-
-function rejects() {
- return _rejects.apply(this, arguments);
+import reactNativeResponse1 from './github/react-native.response.1.json'
+import reactNativeResponse2 from './github/react-native.response.2.json'
+import reactNativeResponse3 from './github/react-native.response.3.json'
+import reactNativeResponse4 from './github/react-native.response.4.json'
+import reactNativeTransformed from './github/react-native.transformed.json'
+
+const getUserInfo = githubAPI.getUserInfo
+const check = githubAPI.getContributors
+
+beforeAll(() => {
+ nock('https://api.github.com')
+ .persist()
+ .get(
+ '/repos/all-contributors/all-contributors-cli/contributors?per_page=100',
+ )
+ .reply(200, allContributorsCliResponse)
+ .get('/repos/facebook/react-native/contributors?per_page=100')
+ .reply(200, reactNativeResponse1, {
+ Link:
+ '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=2>; rel="next", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="last"',
+ })
+ .get('/repositories/29028775/contributors?per_page=100&page=2')
+ .reply(200, reactNativeResponse2, {
+ Link:
+ '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=3>; rel="next", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="last", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="first", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="prev"',
+ })
+ .get('/repositories/29028775/contributors?per_page=100&page=3')
+ .reply(200, reactNativeResponse3, {
+ Link:
+ '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="next", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=4>; rel="last", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="first", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=2>; rel="prev"',
+ })
+ .get('/repositories/29028775/contributors?per_page=100&page=4')
+ .reply(200, reactNativeResponse4, {
+ Link:
+ '<https://api.github.com/repositories/29028775/contributors?per_page=100&page=1>; rel="first", <https://api.github.com/repositories/29028775/contributors?per_page=100&page=3>; rel="prev"',
+ })
+})
+
+test('Handle a single results page correctly', async () => {
+ const transformed = await check('all-contributors', 'all-contributors-cli')
+ expect(transformed).toEqual(allContributorsCliTransformed)
+})
+
+test('Handle multiple results pages correctly', async () => {
+ const transformed = await check('facebook', 'react-native')
+ expect(transformed).toEqual(reactNativeTransformed)
+})
+
+async function rejects(promise) {
+ const error = await promise.catch(e => e)
+ expect(error).toBeTruthy()
}
-function _rejects() {
- _rejects = (0, _asyncToGenerator2.default)(
- /*#__PURE__*/
- _regenerator.default.mark(function _callee13(promise) {
- var error;
- return _regenerator.default.wrap(function (_context13) {
- while (1) {
- switch (_context13.prev = _context13.next) {
- case 0:
- _context13.next = 2;
- return promise.catch(function (e) {
- return e;
- });
-
- case 2:
- error = _context13.sent;
- expect(error).toBeTruthy();
-
- case 4:
- case "end":
- return _context13.stop();
- }
- }
- }, _callee13);
- }));
- return _rejects.apply(this, arguments);
-}
-
-test('handle errors',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee3() {
- return _regenerator.default.wrap(function (_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').replyWithError(404);
- _context3.next = 3;
- return rejects(getUserInfo('nodisplayname'));
-
- case 3:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
-})));
-test('Throw error when no username is provided', function () {
- expect(getUserInfo).toThrow('No login when adding a contributor. Please specify a username.');
-});
-test('Throw error when non existent username is provided',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee4() {
- var username;
- return _regenerator.default.wrap(function (_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- username = 'thisusernamedoesntexist';
- (0, _nock.default)('https://api.github.com').get(`/users/${username}`).reply(404, {
+test('handle errors', async () => {
+ nock('https://api.github.com')
+ .get('/users/nodisplayname')
+ .replyWithError(404)
+
+ 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'
- });
- _context4.prev = 2;
- _context4.next = 5;
- return getUserInfo(username);
-
- case 5:
- _context4.next = 10;
- break;
-
- case 7:
- _context4.prev = 7;
- _context4.t0 = _context4["catch"](2);
- expect(_context4.t0.message).toEqual(`Login not found when adding a contributor for username - ${username}.`);
-
- case 10:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, null, [[2, 7]]);
-})));
-test('handle github errors',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee5() {
- return _regenerator.default.wrap(function (_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {
- message: "API rate limit exceeded for 0.0.0.0. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
- documentation_url: 'https://developer.github.com/v3/#rate-limiting'
- });
- _context5.next = 3;
- return rejects(getUserInfo('nodisplayname'));
-
- case 3:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5);
-})));
-test('fill in the name when null is returned',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee6() {
- var info;
- return _regenerator.default.wrap(function (_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {
+ 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')
+ .reply(200, {
+ message:
+ "API rate limit exceeded for 0.0.0.0. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
+ documentation_url: 'https://developer.github.com/v3/#rate-limiting',
+ })
+
+ await rejects(getUserInfo('nodisplayname'))
+})
+
+test('fill in the name when null is returned', async () => {
+ nock('https://api.github.com')
+ .get('/users/nodisplayname')
+ .reply(200, {
login: 'nodisplayname',
name: null,
avatar_url: 'https://avatars2.githubusercontent.com/u/3869412?v=3&s=400',
- html_url: 'https://github.com/nodisplayname'
- });
- _context6.next = 3;
- return getUserInfo('nodisplayname');
-
- case 3:
- info = _context6.sent;
- expect(info.name).toBe('nodisplayname');
-
- case 5:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6);
-})));
-test('attaches token when supplied',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee7() {
- var mockAuthToken;
- return _regenerator.default.wrap(function (_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- mockAuthToken = 'myMock-token-adaskjda';
- (0, _nock.default)('https://api.github.com').matchHeader('authorization', `token ${mockAuthToken}`).get('/users/test-token').reply(200, {
- html_url: 'test-token'
- });
- _context7.next = 4;
- return getUserInfo('test-token', 'https://github.com', mockAuthToken);
-
- case 4:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7);
-})));
-test('attaches no token when supplied empty',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee8() {
- return _regenerator.default.wrap(function (_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- (0, _nock.default)('https://api.github.com').matchHeader('authorization', '').get('/users/test-token').reply(200, {
- html_url: 'test-token'
- });
- _context8.next = 3;
- return getUserInfo('test-token', 'https://github.com', '');
-
- case 3:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee8);
-})));
-test('attaches no token when not supplied',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee9() {
- return _regenerator.default.wrap(function (_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- (0, _nock.default)('https://api.github.com').matchHeader('authorization', '').get('/users/test-token').reply(200, {
- html_url: 'test-token'
- });
- _context9.next = 3;
- return getUserInfo('test-token');
-
- case 3:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee9);
-})));
-test('fill in the name when an empty string is returned',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee10() {
- var info;
- return _regenerator.default.wrap(function (_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {
+ html_url: 'https://github.com/nodisplayname',
+ })
+
+ const info = await getUserInfo('nodisplayname')
+ expect(info.name).toBe('nodisplayname')
+})
+
+test('attaches token when supplied', async () => {
+ const mockAuthToken = 'myMock-token-adaskjda'
+ nock('https://api.github.com')
+ .matchHeader('authorization', `token ${mockAuthToken}`)
+ .get('/users/test-token')
+ .reply(200, {
+ html_url: 'test-token',
+ })
+
+ await getUserInfo('test-token', 'https://github.com', mockAuthToken)
+})
+
+test('attaches no token when supplied empty', async () => {
+ nock('https://api.github.com')
+ .matchHeader('authorization', '')
+ .get('/users/test-token')
+ .reply(200, {
+ html_url: 'test-token',
+ })
+
+ await getUserInfo('test-token', 'https://github.com', '')
+})
+
+test('attaches no token when not supplied', async () => {
+ nock('https://api.github.com')
+ .matchHeader('authorization', '')
+ .get('/users/test-token')
+ .reply(200, {
+ html_url: 'test-token',
+ })
+
+ await getUserInfo('test-token')
+})
+
+test('fill in the name when an empty string is returned', async () => {
+ nock('https://api.github.com')
+ .get('/users/nodisplayname')
+ .reply(200, {
login: 'nodisplayname',
name: '',
avatar_url: 'https://avatars2.githubusercontent.com/u/3869412?v=3&s=400',
- html_url: 'https://github.com/nodisplayname'
- });
- _context10.next = 3;
- return getUserInfo('nodisplayname');
-
- case 3:
- info = _context10.sent;
- expect(info.name).toBe('nodisplayname');
-
- case 5:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee10);
-})));
-test('append http when no absolute link is provided',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee11() {
- var info;
- return _regenerator.default.wrap(function (_context11) {
- while (1) {
- switch (_context11.prev = _context11.next) {
- case 0:
- (0, _nock.default)('https://api.github.com').get('/users/nodisplayname').reply(200, {
+ html_url: 'https://github.com/nodisplayname',
+ })
+
+ const info = await getUserInfo('nodisplayname')
+ expect(info.name).toBe('nodisplayname')
+})
+
+test('append http when no absolute link is provided', async () => {
+ nock('https://api.github.com')
+ .get('/users/nodisplayname')
+ .reply(200, {
login: 'nodisplayname',
name: '',
avatar_url: 'https://avatars2.githubusercontent.com/u/3869412?v=3&s=400',
- html_url: 'www.github.com/nodisplayname'
- });
- _context11.next = 3;
- return getUserInfo('nodisplayname');
-
- case 3:
- info = _context11.sent;
- expect(info.profile).toBe('http://www.github.com/nodisplayname');
-
- case 5:
- case "end":
- return _context11.stop();
- }
- }
- }, _callee11);
-})));
-test('retrieve user from a different github registry',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee12() {
- var info;
- return _regenerator.default.wrap(function (_context12) {
- while (1) {
- switch (_context12.prev = _context12.next) {
- case 0:
- (0, _nock.default)('http://api.github.myhost.com:3000').get('/users/nodisplayname').reply(200, {
+ html_url: 'www.github.com/nodisplayname',
+ })
+
+ const info = await getUserInfo('nodisplayname')
+ expect(info.profile).toBe('http://www.github.com/nodisplayname')
+})
+
+test('retrieve user from a different github registry', async () => {
+ nock('http://api.github.myhost.com:3000')
+ .get('/users/nodisplayname')
+ .reply(200, {
login: 'nodisplayname',
name: 'No Display Name',
avatar_url: 'https://avatars2.githubusercontent.com/u/3869412?v=3&s=400',
- html_url: 'http://github.myhost.com:3000/nodisplayname'
- });
- _context12.next = 3;
- return getUserInfo('nodisplayname', 'http://github.myhost.com:3000');
-
- case 3:
- info = _context12.sent;
- expect(info.name).toBe('No Display Name');
-
- case 5:
- case "end":
- return _context12.stop();
- }
- }
- }, _callee12);
-})));
\ No newline at end of file
+ html_url: 'http://github.myhost.com:3000/nodisplayname',
+ })
+
+ const info = await getUserInfo(
+ 'nodisplayname',
+ 'http://github.myhost.com:3000',
+ )
+ expect(info.name).toBe('No Display Name')
+})

dist/repo/__tests__/gitlab.js

@@ -1,266 +1,136 @@
-"use strict";
+import nock from 'nock'
+import gitlabAPI from '../gitlab'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
+const getUserInfo = gitlabAPI.getUserInfo
-var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
-
-var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
-
-var _nock = _interopRequireDefault(require("nock"));
-
-var _gitlab = _interopRequireDefault(require("../gitlab"));
-
-var getUserInfo = _gitlab.default.getUserInfo;
-
-function rejects() {
- return _rejects.apply(this, arguments);
-}
-
-function _rejects() {
- _rejects = (0, _asyncToGenerator2.default)(
- /*#__PURE__*/
- _regenerator.default.mark(function _callee9(promise) {
- var error;
- return _regenerator.default.wrap(function (_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- _context9.next = 2;
- return promise.catch(function (e) {
- return e;
- });
-
- case 2:
- error = _context9.sent;
- expect(error).toBeTruthy();
-
- case 4:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee9);
- }));
- return _rejects.apply(this, arguments);
+async function rejects(promise) {
+ const error = await promise.catch(e => e)
+ expect(error).toBeTruthy()
}
-test('handle errors',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee() {
- return _regenerator.default.wrap(function (_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- (0, _nock.default)('https://gitlab.com').get('/api/v4/users?username=nodisplayname').reply(200, []);
- _context.next = 3;
- return rejects(getUserInfo('nodisplayname'));
-
- case 3:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
-})));
-test('fill in the name when it is returned',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee2() {
- var info;
- return _regenerator.default.wrap(function (_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- (0, _nock.default)('https://gitlab.com').get('/api/v4/users?username=nodisplayname').reply(200, [{
+test('handle errors', async () => {
+ nock('https://gitlab.com')
+ .get('/api/v4/users?username=nodisplayname')
+ .reply(200, [])
+
+ await rejects(getUserInfo('nodisplayname'))
+})
+
+test('fill in the name when it is returned', async () => {
+ nock('https://gitlab.com')
+ .get('/api/v4/users?username=nodisplayname')
+ .reply(200, [
+ {
username: 'nodisplayname',
name: 'No Display Name',
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- web_url: 'https://gitlab.com/nodisplayname'
- }]);
- _context2.next = 3;
- return getUserInfo('nodisplayname');
-
- case 3:
- info = _context2.sent;
- expect(info.name).toBe('No Display Name');
-
- case 5:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2);
-})));
-test('fill in the name when null is returned',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee3() {
- var info;
- return _regenerator.default.wrap(function (_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- (0, _nock.default)('https://gitlab.com').get('/api/v4/users?username=nodisplayname').reply(200, [{
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ web_url: 'https://gitlab.com/nodisplayname',
+ },
+ ])
+
+ const info = await getUserInfo('nodisplayname')
+ expect(info.name).toBe('No Display Name')
+})
+
+test('fill in the name when null is returned', async () => {
+ nock('https://gitlab.com')
+ .get('/api/v4/users?username=nodisplayname')
+ .reply(200, [
+ {
username: 'nodisplayname',
name: null,
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- web_url: 'https://gitlab.com/nodisplayname'
- }]);
- _context3.next = 3;
- return getUserInfo('nodisplayname');
-
- case 3:
- info = _context3.sent;
- expect(info.name).toBe('nodisplayname');
-
- case 5:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3);
-})));
-test('fill in the name when an empty string is returned',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee4() {
- var info;
- return _regenerator.default.wrap(function (_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- (0, _nock.default)('https://gitlab.com').get('/api/v4/users?username=nodisplayname').reply(200, [{
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ web_url: 'https://gitlab.com/nodisplayname',
+ },
+ ])
+
+ const info = await getUserInfo('nodisplayname')
+ expect(info.name).toBe('nodisplayname')
+})
+
+test('fill in the name when an empty string is returned', async () => {
+ nock('https://gitlab.com')
+ .get('/api/v4/users?username=nodisplayname')
+ .reply(200, [
+ {
username: 'nodisplayname',
name: '',
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- web_url: 'https://gitlab.com/nodisplayname'
- }]);
- _context4.next = 3;
- return getUserInfo('nodisplayname');
-
- case 3:
- info = _context4.sent;
- expect(info.name).toBe('nodisplayname');
-
- case 5:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4);
-})));
-test('append http when no absolute link is provided',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee5() {
- var info;
- return _regenerator.default.wrap(function (_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- (0, _nock.default)('https://gitlab.com').get('/api/v4/users?username=nodisplayname').reply(200, [{
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ web_url: 'https://gitlab.com/nodisplayname',
+ },
+ ])
+
+ const info = await getUserInfo('nodisplayname')
+ expect(info.name).toBe('nodisplayname')
+})
+
+test('append http when no absolute link is provided', async () => {
+ nock('https://gitlab.com')
+ .get('/api/v4/users?username=nodisplayname')
+ .reply(200, [
+ {
username: 'nodisplayname',
name: 'No Display Name',
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- web_url: 'www.gitlab.com/nodisplayname'
- }]);
- _context5.next = 3;
- return getUserInfo('nodisplayname');
-
- case 3:
- info = _context5.sent;
- expect(info.profile).toBe('http://www.gitlab.com/nodisplayname');
-
- case 5:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5);
-})));
-test('retrieve user from a different gitlab registry',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee6() {
- var info;
- return _regenerator.default.wrap(function (_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- (0, _nock.default)('http://gitlab.myhost.com:3000').get('/api/v4/users?username=nodisplayname').reply(200, [{
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ web_url: 'www.gitlab.com/nodisplayname',
+ },
+ ])
+
+ const info = await getUserInfo('nodisplayname')
+ expect(info.profile).toBe('http://www.gitlab.com/nodisplayname')
+})
+
+test('retrieve user from a different gitlab registry', async () => {
+ nock('http://gitlab.myhost.com:3000')
+ .get('/api/v4/users?username=nodisplayname')
+ .reply(200, [
+ {
username: 'nodisplayname',
name: 'No Display Name',
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- web_url: 'https://gitlab.com/nodisplayname'
- }]);
- _context6.next = 3;
- return getUserInfo('nodisplayname', 'http://gitlab.myhost.com:3000');
-
- case 3:
- info = _context6.sent;
- expect(info.name).toBe('No Display Name');
-
- case 5:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6);
-})));
-test('retrieve user from a gitlab registry that needs a token',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee7() {
- var info;
- return _regenerator.default.wrap(function (_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- (0, _nock.default)('http://gitlab.needtoken.com:3000').get('/api/v4/users?username=nodisplayname&private_token=faketoken').reply(200, [{
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ web_url: 'https://gitlab.com/nodisplayname',
+ },
+ ])
+
+ const info = await getUserInfo(
+ 'nodisplayname',
+ 'http://gitlab.myhost.com:3000',
+ )
+ expect(info.name).toBe('No Display Name')
+})
+
+test('retrieve user from a gitlab registry that needs a token', async () => {
+ nock('http://gitlab.needtoken.com:3000')
+ .get('/api/v4/users?username=nodisplayname&private_token=faketoken')
+ .reply(200, [
+ {
username: 'nodisplayname',
name: 'No Display Name',
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- web_url: 'https://gitlab.com/nodisplayname'
- }]);
- _context7.next = 3;
- return getUserInfo('nodisplayname', 'http://gitlab.needtoken.com:3000', 'faketoken');
-
- case 3:
- info = _context7.sent;
- expect(info.name).toBe('No Display Name');
-
- case 5:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7);
-})));
-test('handle error when no token is offered',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee8() {
- return _regenerator.default.wrap(function (_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- (0, _nock.default)('http://gitlab.needtoken.com:3000').get('/api/v4/users?username=nodisplayname').reply(200, []);
- _context8.next = 3;
- return rejects(getUserInfo('nodisplayname', 'http://gitlab.needtoken.com:3000', ''));
-
- case 3:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee8);
-})));
\ No newline at end of file
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ web_url: 'https://gitlab.com/nodisplayname',
+ },
+ ])
+
+ const info = await getUserInfo(
+ 'nodisplayname',
+ 'http://gitlab.needtoken.com:3000',
+ 'faketoken',
+ )
+ expect(info.name).toBe('No Display Name')
+})
+
+test('handle error when no token is offered', async () => {
+ nock('http://gitlab.needtoken.com:3000')
+ .get('/api/v4/users?username=nodisplayname')
+ .reply(200, [])
+
+ await rejects(
+ getUserInfo('nodisplayname', 'http://gitlab.needtoken.com:3000', ''),
+ )
+})

dist/repo/__tests__/index.js

@@ -1,65 +1,73 @@
-"use strict";
+import repo from '..'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
+jest.mock('../github')
+jest.mock('../gitlab')
-var _ = _interopRequireDefault(require(".."));
+const githubAPI = require('../github')
+const gitlabAPI = require('../gitlab')
-jest.mock('../github');
-jest.mock('../gitlab');
-
-var githubAPI = require('../github');
-
-var gitlabAPI = require('../gitlab');
-
-test('get choices for init command', function () {
- expect(_.default.getChoices()).toEqual([{
+test('get choices for init command', () => {
+ expect(repo.getChoices()).toEqual([
+ {
value: 'github',
- name: 'GitHub'
- }, {
+ name: 'GitHub',
+ },
+ {
value: 'gitlab',
- name: 'GitLab'
- }]);
-});
-test('get hostname for a given repo type', function () {
- expect(_.default.getHostname('github')).toEqual('https://github.com');
- expect(_.default.getHostname('github', 'http://my-github.com')).toEqual('http://my-github.com');
- expect(_.default.getHostname('gitlab')).toEqual('https://gitlab.com');
- expect(_.default.getHostname('gitlab', 'http://my-gitlab.com:3000')).toEqual('http://my-gitlab.com:3000');
- expect(_.default.getHostname('other')).toBe(null);
-});
-test('get repo name given a repo type', function () {
- expect(_.default.getTypeName('github')).toEqual('GitHub');
- expect(_.default.getTypeName('gitlab')).toEqual('GitLab');
- expect(_.default.getTypeName('other')).toBe(null);
-});
-test('get user info calls underlying APIs', function () {
- githubAPI.getUserInfo.mockImplementationOnce(function () {
+ name: 'GitLab',
+ },
+ ])
+})
+
+test('get hostname for a given repo type', () => {
+ expect(repo.getHostname('github')).toEqual('https://github.com')
+ expect(repo.getHostname('github', 'http://my-github.com')).toEqual(
+ 'http://my-github.com',
+ )
+ expect(repo.getHostname('gitlab')).toEqual('https://gitlab.com')
+ expect(repo.getHostname('gitlab', 'http://my-gitlab.com:3000')).toEqual(
+ 'http://my-gitlab.com:3000',
+ )
+ expect(repo.getHostname('other')).toBe(null)
+})
+
+test('get repo name given a repo type', () => {
+ expect(repo.getTypeName('github')).toEqual('GitHub')
+ expect(repo.getTypeName('gitlab')).toEqual('GitLab')
+ expect(repo.getTypeName('other')).toBe(null)
+})
+
+test('get user info calls underlying APIs', () => {
+ githubAPI.getUserInfo.mockImplementationOnce(() => {
return {
login: 'nodisplayname',
name: 'nodisplayname',
avatar_url: 'https://avatars2.githubusercontent.com/u/3869412?v=3&s=400',
- profile: 'https://github.com/nodisplayname'
- };
- });
- gitlabAPI.getUserInfo.mockImplementationOnce(function () {
+ profile: 'https://github.com/nodisplayname',
+ }
+ })
+ gitlabAPI.getUserInfo.mockImplementationOnce(() => {
return {
login: 'nodisplayname',
name: 'nodisplayname',
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- profile: 'https://gitlab.com/nodisplayname'
- };
- });
- expect(_.default.getUserInfo('nodisplayname', 'github')).toEqual({
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ profile: 'https://gitlab.com/nodisplayname',
+ }
+ })
+
+ expect(repo.getUserInfo('nodisplayname', 'github')).toEqual({
login: 'nodisplayname',
name: 'nodisplayname',
avatar_url: 'https://avatars2.githubusercontent.com/u/3869412?v=3&s=400',
- profile: 'https://github.com/nodisplayname'
- });
- expect(_.default.getUserInfo('nodisplayname', 'gitlab')).toEqual({
+ profile: 'https://github.com/nodisplayname',
+ })
+ expect(repo.getUserInfo('nodisplayname', 'gitlab')).toEqual({
login: 'nodisplayname',
name: 'nodisplayname',
- avatar_url: 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
- profile: 'https://gitlab.com/nodisplayname'
- });
- expect(_.default.getUserInfo('nodisplayname', 'other')).toBe(null);
-});
\ No newline at end of file
+ avatar_url:
+ 'http://www.gravatar.com/avatar/3186450a99d1641bf75a44baa23f0826?s=80\u0026d=identicon',
+ profile: 'https://gitlab.com/nodisplayname',
+ })
+ expect(repo.getUserInfo('nodisplayname', 'other')).toBe(null)
+})

dist/util/git.js

@@ -1,5 +1,9 @@
"use strict";
+var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
+
+var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
+
var path = require('path');
var spawn = require('child_process').spawn;
@@ -8,7 +12,12 @@
var pify = require('pify');
-var commitTemplate = '<%= (newContributor ? "Add" : "Update") %> @<%= username %> as a contributor';
+var conventions = require('../init/commit-conventions');
+
+var _require = require('./config-file'),
+ readConfig = _require.readConfig;
+
+var commitTemplate = '<%= prefix %> <%= (newContributor ? "Add" : "Update") %> @<%= username %> as a contributor';
var getRemoteOriginData = pify(function (cb) {
var output = '';
var git = spawn('git', 'config --get remote.origin.url'.split(' '));
@@ -59,9 +68,14 @@
var absolutePathFiles = files.map(function (file) {
return path.resolve(process.cwd(), file);
});
+ var config = readConfig(options.config);
+ var commitConvention = conventions[config.commitConvention];
return spawnGitCommand(['add'].concat(absolutePathFiles)).then(function () {
- var commitMessage = _.template(options.commitTemplate || commitTemplate)(data);
+ var commitMessage = _.template(options.commitTemplate || commitTemplate)((0, _extends2.default)({}, data, {
+ prefix: commitConvention.msg
+ }));
+ if (commitConvention.lowercase) commitMessage = commitConvention.transform(commitMessage);
return spawnGitCommand(['commit', '-m', commitMessage]);
});
}

dist/util/__tests__/config-file.js

@@ -1,82 +1,60 @@
-"use strict";
+import configFile from '../config-file'
-var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
-
-var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
-
-var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
-
-var _configFile = _interopRequireDefault(require("../config-file"));
-
-var absentFile = './abc';
-var absentConfileFileExpected = `Configuration file not found: ${absentFile}`;
-var incompleteConfigFilePath = './.all-contributorsrc';
-var NoOwnerConfigFile = {
+const absentFile = './abc'
+const absentConfileFileExpected = `Configuration file not found: ${absentFile}`
+const incompleteConfigFilePath = './.all-contributorsrc'
+const NoOwnerConfigFile = {
projectOwner: '',
projectName: 'all-contributors-cli',
imageSize: 100,
commit: false,
contributorsPerLine: 6,
- contributors: []
-};
-var NoNameConfigFile = {
+ contributors: [],
+}
+const NoNameConfigFile = {
projectOwner: 'all-contributors',
projectName: '',
imageSize: 100,
commit: false,
contributorsPerLine: 6,
- contributors: []
-};
-var NoFilesConfigFile = {
+ contributors: [],
+}
+const NoFilesConfigFile = {
projectOwner: 'all-contributors',
projectName: 'all-contributors-cli',
imageSize: 100,
commit: false,
contributorsPerLine: 6,
contributors: [],
- files: []
-};
-test('Reading an absent configuration file throws a helpful error', function () {
- expect(function () {
- return _configFile.default.readConfig(absentFile);
- }).toThrowError(absentConfileFileExpected);
-});
-test('Writing contributors in an absent configuration file throws a helpful error',
-/*#__PURE__*/
-(0, _asyncToGenerator2.default)(
-/*#__PURE__*/
-_regenerator.default.mark(function _callee() {
- var resolvedError;
- return _regenerator.default.wrap(function (_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _context.next = 2;
- return _configFile.default.writeContributors(absentFile, []).catch(function (e) {
- return e;
- });
-
- case 2:
- resolvedError = _context.sent;
- expect(resolvedError.message).toBe(absentConfileFileExpected);
+ files: [],
+}
- case 4:
- case "end":
- return _context.stop();
- }
- }
- }, _callee);
-})));
-test('Should throw error and not allow editing config file if project name or owner is not set', function () {
- expect(function () {
- return _configFile.default.writeConfig(incompleteConfigFilePath, NoOwnerConfigFile);
- }).toThrow(`Error! Project owner is not set in ${incompleteConfigFilePath}`);
- expect(function () {
- return _configFile.default.writeConfig(incompleteConfigFilePath, NoNameConfigFile);
- }).toThrow(`Error! Project name is not set in ${incompleteConfigFilePath}`);
-});
-test(`throws if 'files' was overridden in .all-contributorsrc and is empty`, function () {
- expect(function () {
- return _configFile.default.writeConfig(incompleteConfigFilePath, NoFilesConfigFile);
- }).toThrow(`Error! Project files was overridden and is empty in ${incompleteConfigFilePath}`);
-});
\ No newline at end of file
+test('Reading an absent configuration file throws a helpful error', () => {
+ expect(() => configFile.readConfig(absentFile)).toThrowError(
+ absentConfileFileExpected,
+ )
+})
+
+test('Writing contributors in an absent configuration file throws a helpful error', async () => {
+ const resolvedError = await configFile
+ .writeContributors(absentFile, [])
+ .catch(e => e)
+ expect(resolvedError.message).toBe(absentConfileFileExpected)
+})
+
+test('Should throw error and not allow editing config file if project name or owner is not set', () => {
+ expect(() =>
+ configFile.writeConfig(incompleteConfigFilePath, NoOwnerConfigFile),
+ ).toThrow(`Error! Project owner is not set in ${incompleteConfigFilePath}`)
+ expect(() =>
+ configFile.writeConfig(incompleteConfigFilePath, NoNameConfigFile),
+ ).toThrow(`Error! Project name is not set in ${incompleteConfigFilePath}`)
+})
+
+test(`throws if 'files' was overridden in .all-contributorsrc and is empty`, () => {
+ expect(() =>
+ configFile.writeConfig(incompleteConfigFilePath, NoFilesConfigFile),
+ ).toThrow(
+ `Error! Project files was overridden and is empty in ${incompleteConfigFilePath}`,
+ )
+})

package.json

@@ -1,6 +1,6 @@
{
"name": "all-contributors-cli",
- "version": "6.2.0",
+ "version": "6.3.0",
"description": "Tool to easily add recognition for new contributors",
"bin": {
"all-contributors": "dist/cli.js"
@@ -54,7 +54,7 @@
"devDependencies": {
"codecov": "^3.1.0",
"cz-conventional-changelog": "^2.1.0",
- "git-cz": "^2.0.0",
+ "git-cz": "^3.0.0",
"kcd-scripts": "^1.0.0",
"nock": "^10.0.6",
"semantic-release": "^15.13.2"

README.md

@@ -7,19 +7,31 @@
<hr />
-[![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/)
-
+<table>
+ <caption>Read this documentation in the following languages</caption>
+ <tbody>
+ <tr>
+ <td><a href="https://allcontributors.org/docs/ko/cli/overview">한국어</a></td>
+ <td><a href="https://allcontributors.org/docs/zh-CN/cli/overview">中文</a></td>
+ <td><a href="https://allcontributors.org/docs/id/cli/overview">Bahasa Indonesia</a></td>
+ <td><a href="https://allcontributors.org/docs/de/cli/overview">Deutsch</a></td>
+ <td><a href="https://allcontributors.org/docs/pl/cli/overview">Polskie</a></td>
+ </tr>
+ <tr>
+ <td><a href="https://allcontributors.org/docs/en/cli/overview">English</a></td>
+ <td><a href="https://allcontributors.org/docs/pt-BR/cli/overview">Português</a></td>
+ <td><a href="https://allcontributors.org/docs/es-ES/cli/overview">Español</a></td>
+ <td><a href="https://allcontributors.org/docs/fr/cli/overview">Français</a></td>
+ </tr>
+ </tbody>
+</table>
+
+[![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-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]
+[![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
@@ -54,30 +66,3 @@
## 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