Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More β†’
Socket
Sign inDemoInstall
Socket

all-contributors-cli

Package Overview
Dependencies
Maintainers
2
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

all-contributors-cli - npm Package Compare versions

Comparing version 4.10.2 to 4.11.0

dist/repo/github.js

24

dist/cli.js

@@ -14,2 +14,3 @@ #!/usr/bin/env node

var util = require('./util');
var repo = require('./repo');
var updateContributors = require('./contributors');

@@ -20,3 +21,3 @@

var yargv = yargs.help('help').alias('h', 'help').alias('v', 'version').version().command('generate', 'Generate the list of contributors').usage('Usage: $0 generate').command('add', 'add a new contributor').usage('Usage: $0 add <username> <contribution>').command('init', 'Prepare the project to be used with this tool').usage('Usage: $0 init').command('check', 'Compares contributors from GitHub with the ones credited in .all-contributorsrc').usage('Usage: $0 check').boolean('commit').default('files', ['README.md']).default('contributorsPerLine', 7).default('contributors', []).default('config', defaultRCFile).config('config', function (configPath) {
var yargv = yargs.help('help').alias('h', 'help').alias('v', 'version').version().command('generate', 'Generate the list of contributors').usage('Usage: $0 generate').command('add', 'add a new contributor').usage('Usage: $0 add <username> <contribution>').command('init', 'Prepare the project to be used with this tool').usage('Usage: $0 init').command('check', 'Compares contributors from the repository with the ones credited in .all-contributorsrc').usage('Usage: $0 check').boolean('commit').default('files', ['README.md']).default('contributorsPerLine', 7).default('contributors', []).default('config', defaultRCFile).config('config', function (configPath) {
try {

@@ -58,16 +59,17 @@ return util.configFile.readConfig(configPath);

return util.check(configData.projectOwner, configData.projectName).then(function (ghContributors) {
return repo.getContributors(configData.projectOwner, configData.projectName, configData.repoType, configData.repoHost).then(function (repoContributors) {
var checkKey = repo.getCheckKey(configData.repoType);
var knownContributions = configData.contributors.reduce(function (obj, item) {
obj[item.login] = item.contributions;
obj[item[checkKey]] = item.contributions;
return obj;
}, {});
var knownContributors = configData.contributors.map(function (contributor) {
return contributor.login;
return contributor[checkKey];
});
var missingInConfig = ghContributors.filter(function (login) {
return !knownContributors.includes(login);
var missingInConfig = repoContributors.filter(function (key) {
return !knownContributors.includes(key);
});
var missingFromGithub = knownContributors.filter(function (login) {
return !ghContributors.includes(login) && (knownContributions[login].includes('code') || knownContributions[login].includes('test'));
var missingFromRepo = knownContributors.filter(function (key) {
return !repoContributors.includes(key) && (knownContributions[key].includes('code') || knownContributions[key].includes('test'));
});

@@ -80,5 +82,5 @@

if (missingFromGithub.length) {
if (missingFromRepo.length) {
process.stdout.write(chalk.bold('Unknown contributors found in .all-contributorsrc:\n'));
process.stdout.write(`${missingFromGithub.join(', ')}\n`);
process.stdout.write(`${missingFromRepo.join(', ')}\n`);
}

@@ -108,3 +110,3 @@ });

}, {
name: 'Compare contributors from GitHub with the credited ones',
name: 'Compare contributors from the repository with the credited ones',
value: 'check'

@@ -111,0 +113,0 @@ }],

@@ -34,3 +34,3 @@ 'use strict';

function addNewContributor(options, username, contributions, infoFetcher) {
return infoFetcher(username).then(function (userData) {
return infoFetcher(username, options.repoType, options.repoHost).then(function (userData) {
var contributor = _.assign(userData, {

@@ -37,0 +37,0 @@ contributions: formatContributions(options, [], contributions)

@@ -5,4 +5,4 @@ 'use strict';

var util = require('../util');
var repo = require('../repo');
var add = require('./add');
var github = require('./github');
var prompt = require('./prompt');

@@ -17,3 +17,3 @@

var contributorsP = answersP.then(function (answers) {
return add(options, answers.username, answers.contributions, github);
return add(options, answers.username, answers.contributions, repo.getUserInfo);
});

@@ -20,0 +20,0 @@

@@ -6,2 +6,3 @@ 'use strict';

var util = require('../util');
var repo = require('../repo');

@@ -21,3 +22,3 @@ var contributionChoices = _.flow(util.contributionTypes, _.toPairs, _.sortBy(function (pair) {

name: 'username',
message: "What is the contributor's GitHub username?",
message: `What is the contributor's ${repo.getTypeName(options.repoType)} username?`,
when: !username

@@ -24,0 +25,0 @@ }, {

@@ -16,3 +16,26 @@ 'use strict';

}, {
type: 'list',
name: 'repoType',
message: 'What is the repository type?',
choices: [{
value: 'github',
name: 'GitHub'
}, {
value: 'gitlab',
name: 'GitLab'
}],
default: 'github'
}, {
type: 'input',
name: 'repoHost',
message: 'Where is the repository hosted?',
default: function _default(answers) {
if (answers.repoType === 'github') {
return 'https://github.com';
} else if (answers.repoType === 'gitlab') {
return 'https://gitlab.com';
}
}
}, {
type: 'input',
name: 'contributorFile',

@@ -62,2 +85,4 @@ message: 'In which file should contributors be listed?',

projectOwner: answers.projectOwner,
repoType: answers.repoType,
repoHost: answers.repoHost,
files: uniqueFiles([answers.contributorFile, answers.badgeFile]),

@@ -64,0 +89,0 @@ imageSize: answers.imageSize,

@@ -9,3 +9,7 @@ 'use strict';

try {
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
var config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
if (!('repoType' in config)) {
config.repoType = 'github';
}
return config;
} catch (error) {

@@ -12,0 +16,0 @@ if (error.code === 'ENOENT') {

'use strict';
var _ = require('lodash/fp');
var repo = require('../repo');
var linkToCommits = 'https://github.com/<%= options.projectOwner %>/<%= options.projectName %>/commits?author=<%= contributor.login %>';
var linkToIssues = 'https://github.com/<%= options.projectOwner %>/<%= options.projectName %>/issues?q=author%3A<%= contributor.login %>';
var defaultTypes = {
blog: {
symbol: 'πŸ“',
description: 'Blogposts'
},
bug: {
symbol: 'πŸ›',
description: 'Bug reports',
link: linkToIssues
},
code: {
symbol: 'πŸ’»',
description: 'Code',
link: linkToCommits
},
design: {
symbol: '🎨',
description: 'Design'
},
doc: {
symbol: 'πŸ“–',
description: 'Documentation',
link: linkToCommits
},
eventOrganizing: {
symbol: 'πŸ“‹',
description: 'Event Organizing'
},
example: {
symbol: 'πŸ’‘',
description: 'Examples'
},
financial: {
symbol: 'πŸ’΅',
description: 'Financial'
},
fundingFinding: {
symbol: 'πŸ”',
description: 'Funding Finding'
},
ideas: {
symbol: 'πŸ€”',
description: 'Ideas, Planning, & Feedback'
},
infra: {
symbol: 'πŸš‡',
description: 'Infrastructure (Hosting, Build-Tools, etc)'
},
platform: {
symbol: 'πŸ“¦',
description: 'Packaging/porting to new platform'
},
plugin: {
symbol: 'πŸ”Œ',
description: 'Plugin/utility libraries'
},
question: {
symbol: 'πŸ’¬',
description: 'Answering Questions'
},
review: {
symbol: 'πŸ‘€',
description: 'Reviewed Pull Requests'
},
talk: {
symbol: 'πŸ“’',
description: 'Talks'
},
test: {
symbol: '⚠️',
description: 'Tests',
link: linkToCommits
},
tool: {
symbol: 'πŸ”§',
description: 'Tools'
},
translation: {
symbol: '🌍',
description: 'Translation'
},
tutorial: {
symbol: 'βœ…',
description: 'Tutorials'
},
video: {
symbol: 'πŸ“Ή',
description: 'Videos'
}
var defaultTypes = function (repoType) {
return {
blog: {
symbol: 'πŸ“',
description: 'Blogposts'
},
bug: {
symbol: 'πŸ›',
description: 'Bug reports',
link: repo.getLinkToIssues(repoType)
},
code: {
symbol: 'πŸ’»',
description: 'Code',
link: repo.getLinkToCommits(repoType)
},
design: {
symbol: '🎨',
description: 'Design'
},
doc: {
symbol: 'πŸ“–',
description: 'Documentation',
link: repo.getLinkToCommits(repoType)
},
eventOrganizing: {
symbol: 'πŸ“‹',
description: 'Event Organizing'
},
example: {
symbol: 'πŸ’‘',
description: 'Examples'
},
financial: {
symbol: 'πŸ’΅',
description: 'Financial'
},
fundingFinding: {
symbol: 'πŸ”',
description: 'Funding Finding'
},
ideas: {
symbol: 'πŸ€”',
description: 'Ideas, Planning, & Feedback'
},
infra: {
symbol: 'πŸš‡',
description: 'Infrastructure (Hosting, Build-Tools, etc)'
},
platform: {
symbol: 'πŸ“¦',
description: 'Packaging/porting to new platform'
},
plugin: {
symbol: 'πŸ”Œ',
description: 'Plugin/utility libraries'
},
question: {
symbol: 'πŸ’¬',
description: 'Answering Questions'
},
review: {
symbol: 'πŸ‘€',
description: 'Reviewed Pull Requests'
},
talk: {
symbol: 'πŸ“’',
description: 'Talks'
},
test: {
symbol: '⚠️',
description: 'Tests',
link: repo.getLinkToCommits(repoType)
},
tool: {
symbol: 'πŸ”§',
description: 'Tools'
},
translation: {
symbol: '🌍',
description: 'Translation'
},
tutorial: {
symbol: 'βœ…',
description: 'Tutorials'
},
video: {
symbol: 'πŸ“Ή',
description: 'Videos'
}
};
};
module.exports = function (options) {
return _.assign(defaultTypes, options.types);
return _.assign(defaultTypes(options.repoType), options.types);
};

@@ -7,4 +7,3 @@ 'use strict';

git: require('./git'),
markdown: require('./markdown'),
check: require('./check')
markdown: require('./markdown')
};

@@ -1,1 +0,1 @@

{"name":"all-contributors-cli","version":"4.10.2","description":"Tool to easily add recognition for new contributors","bin":{"all-contributors":"dist/cli.js"},"files":["dist"],"engines":{"node":">=4"},"scripts":{"add-contributor":"kcd-scripts contributors add","build":"kcd-scripts build","lint":"kcd-scripts lint","test":"kcd-scripts test","validate":"kcd-scripts validate","precommit":"kcd-scripts precommit"},"repository":{"type":"git","url":"https://github.com/jfmengels/all-contributors-cli.git"},"keywords":["all-contributors","contributors"],"author":"Jeroen Engels <jfm.engels@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/jfmengels/all-contributors-cli/issues"},"homepage":"https://github.com/jfmengels/all-contributors-cli#readme","dependencies":{"async":"^2.0.0-rc.1","chalk":"^2.3.0","inquirer":"^4.0.0","lodash":"^4.11.2","pify":"^3.0.0","request":"^2.72.0","yargs":"^10.0.3"},"devDependencies":{"kcd-scripts":"^0.29.0","nock":"^9.1.0"},"eslintIgnore":["node_modules","coverage","dist"],"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js","rules":{"camelcase":"off","no-process-exit":"off","import/extensions":"off","func-names":"off","consistent-return":"off"}}}
{"name":"all-contributors-cli","version":"4.11.0","description":"Tool to easily add recognition for new contributors","bin":{"all-contributors":"dist/cli.js"},"files":["dist"],"engines":{"node":">=4"},"scripts":{"add-contributor":"kcd-scripts contributors add","build":"kcd-scripts build","lint":"kcd-scripts lint","test":"kcd-scripts test","validate":"kcd-scripts validate","precommit":"kcd-scripts precommit"},"repository":{"type":"git","url":"https://github.com/jfmengels/all-contributors-cli.git"},"keywords":["all-contributors","contributors"],"author":"Jeroen Engels <jfm.engels@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/jfmengels/all-contributors-cli/issues"},"homepage":"https://github.com/jfmengels/all-contributors-cli#readme","dependencies":{"async":"^2.0.0-rc.1","chalk":"^2.3.0","inquirer":"^4.0.0","lodash":"^4.11.2","pify":"^3.0.0","request":"^2.72.0","yargs":"^10.0.3"},"devDependencies":{"kcd-scripts":"^0.29.0","nock":"^9.1.0"},"eslintIgnore":["node_modules","coverage","dist"],"eslintConfig":{"extends":"./node_modules/kcd-scripts/eslint.js","rules":{"camelcase":"off","no-process-exit":"off","import/extensions":"off","func-names":"off","consistent-return":"off"}}}

@@ -13,3 +13,3 @@ <h1 align="center">

[![All Contributors](https://img.shields.io/badge/all_contributors-19-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc]

@@ -29,3 +29,3 @@ [![Watch on GitHub][github-watch-badge]][github-watch]

the [all-contributors](https://github.com/kentcdodds/all-contributors)
specification.
specification for your GitHub or GitLab repository.

@@ -109,3 +109,3 @@ ## Table of Contents

Where `username` is the user's GitHub username, and `contribution` is a
Where `username` is the user's GitHub or Gitlab username, and `contribution` is a
`,`-separated list of ways to contribute, from the following list

@@ -162,2 +162,4 @@ ([see the specs](https://github.com/kentcdodds/all-contributors#emoji-key)):

--> `all-contributors-cli`. Mandatory.
* `repoType`: Type of repository. Must be either `github` or `gitlab`. Default: `github`.
* `repoHost`: Points to the repository hostname. Change it if you use a self hosted repository. Default: `https://github.com` if `repoType` is `github`, and `https://gitlab.com` if `repoType` is `gitlab`.
* `types`: Specify custom symbols or link templates for contribution types. Can

@@ -183,4 +185,3 @@ override the documented types.

| [<img src="https://avatars2.githubusercontent.com/u/1026002?v=4" width="100px;"/><br /><sub><b>Bryce Reynolds</b></sub>](https://github.com/brycereynolds)<br />[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=brycereynolds "Code") | [<img src="https://avatars3.githubusercontent.com/u/2322305?v=4" width="100px;"/><br /><sub><b>James, please</b></sub>](http://www.jmeas.com)<br />[πŸ€”](#ideas-jmeas "Ideas, Planning, & Feedback") [πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=jmeas "Code") | [<img src="https://avatars3.githubusercontent.com/u/1057324?v=4" width="100px;"/><br /><sub><b>Spyros Ioakeimidis</b></sub>](http://www.spyros.io)<br />[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=spirosikmd "Code") | [<img src="https://avatars3.githubusercontent.com/u/12335761?v=4" width="100px;"/><br /><sub><b>Fernando Costa</b></sub>](https://github.com/fadc80)<br />[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=fadc80 "Code") | [<img src="https://avatars0.githubusercontent.com/u/197404?v=4" width="100px;"/><br /><sub><b>snipe</b></sub>](https://snipe.net)<br />[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=snipe "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/997157?v=4" width="100px;"/><br /><sub><b>Gant Laborde</b></sub>](http://gantlaborde.com/)<br />[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=GantMan "Code") |
| [<img src="https://avatars2.githubusercontent.com/u/17708702?v=4" width="100px;"/><br /><sub><b>Md Zubair Ahmed</b></sub>](https://in.linkedin.com/in/mzubairahmed)<br />[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=M-ZubairAhmed "Documentation") [πŸ›](https://github.com/jfmengels/all-contributors-cli/issues?q=author%3AM-ZubairAhmed "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/6177621?v=4" width="100px;"/><br /><sub><b>Divjot Singh</b></sub>](http://bogas04.github.io)<br />[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=bogas04 "Documentation") |
| [<img src="https://avatars2.githubusercontent.com/u/17708702?v=4" width="100px;"/><br /><sub><b>Md Zubair Ahmed</b></sub>](https://in.linkedin.com/in/mzubairahmed)<br />[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=M-ZubairAhmed "Documentation") [πŸ›](https://github.com/jfmengels/all-contributors-cli/issues?q=author%3AM-ZubairAhmed "Bug reports") | [<img src="https://avatars3.githubusercontent.com/u/6177621?v=4" width="100px;"/><br /><sub><b>Divjot Singh</b></sub>](http://bogas04.github.io)<br />[πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=bogas04 "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/15315098?v=4" width="100px;"/><br /><sub><b>JoΓ£o Marques</b></sub>](https://github.com/tigermarques)<br />[πŸ’»](https://github.com/jfmengels/all-contributors-cli/commits?author=tigermarques "Code") [πŸ“–](https://github.com/jfmengels/all-contributors-cli/commits?author=tigermarques "Documentation") [πŸ€”](#ideas-tigermarques "Ideas, Planning, & Feedback") |
<!-- ALL-CONTRIBUTORS-LIST:END -->

@@ -187,0 +188,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc