├── test ├── fixtures │ ├── node_modules │ │ ├── bar │ │ │ ├── package.json │ │ │ └── node_modules │ │ │ │ └── boom │ │ │ │ └── package.json │ │ ├── foo │ │ │ └── package.json │ │ └── baz │ │ │ ├── node_modules │ │ │ └── boing │ │ │ │ └── package.json │ │ │ └── package.json │ ├── package.json │ ├── test.txt │ └── credits.spec.json ├── minimal.spec.js ├── markdown.spec.js ├── credits.spec.js ├── extended.spec.js └── cli.spec.js ├── screenshot.png ├── .travis.yml ├── .editorconfig ├── .gitignore ├── .all-contributorsrc ├── .eslintrc ├── reporters ├── minimal.js ├── markdown.js ├── extended.js └── credits.js ├── LICENSE ├── package.json ├── cli.js ├── README.md └── THANKS.md /test/fixtures/node_modules/bar/package.json: -------------------------------------------------------------------------------- 1 | {"author":"Alice Bobson"} -------------------------------------------------------------------------------- /test/fixtures/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | {"author":"Bob Calsow"} -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanjudis/credits-cli/HEAD/screenshot.png -------------------------------------------------------------------------------- /test/fixtures/node_modules/bar/node_modules/boom/package.json: -------------------------------------------------------------------------------- 1 | {"author":{"name":"Alice Bobson"}} -------------------------------------------------------------------------------- /test/fixtures/node_modules/baz/node_modules/boing/package.json: -------------------------------------------------------------------------------- 1 | {"author":"Bob Calsow "} -------------------------------------------------------------------------------- /test/fixtures/node_modules/baz/package.json: -------------------------------------------------------------------------------- 1 | {"author":"Alice Bobson","maintainers":["Randy Ran",{"name":"Bobby Bob","email":"bobby@bob.io"}]} -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "4" 4 | - "5" 5 | 6 | branches: 7 | only: 8 | - master 9 | 10 | after_success: npm run coveralls 11 | -------------------------------------------------------------------------------- /test/fixtures/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "credits-cli-test", 3 | "version": "1.0.0", 4 | "dependencies": { 5 | "foo": "*", 6 | "bar": "*", 7 | "baz": "*" 8 | } 9 | } -------------------------------------------------------------------------------- /test/fixtures/test.txt: -------------------------------------------------------------------------------- 1 | Credits for fixtures 2 | fixtures relies on the work of 4 people: 3 | 4 | 5 | npm 6 | Alice Bobson (3 packages) 7 | Bob Calsow bob@calsow.io (2 packages) 8 | Randy Ran (1 package) 9 | Bobby Bob bobby@bob.io (1 package) 10 | 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # .editorconfig for grunt-phantomas 2 | # 3 | # More info inside CONTRIBUTING.md 4 | 5 | # For all files in this project: 6 | # - 2-space soft tabs 7 | # - All files end with a line-break 8 | # - Trim trailing whitespace 9 | [*] 10 | indent_style = space 11 | indent_size = 2 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | -------------------------------------------------------------------------------- /test/minimal.spec.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import minimal from '../reporters/minimal'; 3 | import credits from './fixtures/credits.spec.json'; 4 | import chalk from 'chalk'; 5 | 6 | chalk.enabled = false; 7 | 8 | test( 'minimal reporter', t => { 9 | let result = minimal( 'foo', credits ).split( '\n' ); 10 | 11 | t.deepEqual( result[ 0 ], 'Credits for foo' ); 12 | t.deepEqual( result[ 1 ], 'foo relies on the work of 9 people:' ); 13 | t.deepEqual( result[ 4 ], 'npm' ); 14 | t.deepEqual( result[ 5 ], 'Alice Bobson (3 packages)' ); 15 | t.deepEqual( result[ 6 ], 'Bob Calsow bob@calsow.io (2 packages)' ); 16 | t.deepEqual( result[ 7 ], 'Jonny John (1 package)' ); 17 | } ); 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | /node_modules 28 | 29 | # coverage files 30 | .nyc_output 31 | .coveralls.yml 32 | -------------------------------------------------------------------------------- /test/markdown.spec.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import markdown from '../reporters/markdown'; 3 | import credits from './fixtures/credits.spec.json'; 4 | import chalk from 'chalk'; 5 | 6 | chalk.enabled = false; 7 | 8 | test( 'markdown reporter', t => { 9 | let result = markdown( 'foo', credits ).split( '\n' ); 10 | 11 | t.deepEqual( result[ 0 ], '# Credits for foo' ); 12 | t.deepEqual( result[ 1 ], '## foo relies on the work of 9 people:' ); 13 | t.deepEqual( result[ 4 ], '## npm' ); 14 | t.deepEqual( result[ 6 ], '- **Alice Bobson** (3 packages)' ); 15 | t.deepEqual( result[ 7 ], '- **Bob Calsow** *bob@calsow.io* (2 packages)' ); 16 | t.deepEqual( result[ 8 ], '- **Jonny John** (1 package)' ); 17 | } ); 18 | -------------------------------------------------------------------------------- /test/credits.spec.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import minimal from '../reporters/credits'; 3 | import credits from './fixtures/credits.spec.json'; 4 | import chalk from 'chalk'; 5 | 6 | chalk.enabled = false; 7 | 8 | test( 'minimal reporter', t => { 9 | let result = minimal( 'foo', credits ).split( '\n' ); 10 | 11 | t.deepEqual( result[ 0 ].trim(), 'Credits for foo' ); 12 | t.deepEqual( result[ 1 ].trim(), 'foo relies on the work of 9 people' ); 13 | t.deepEqual( result[ 3 ].trim(), 'npm' ); 14 | t.deepEqual( result[ 5 ].trim(), 'Alice Bobson 3 packages' ); 15 | t.deepEqual( result[ 6 ].trim(), 'Bob Calsow bob@calsow.io 2 packages' ); 16 | t.deepEqual( result[ 7 ].trim(), 'Jonny John 1 package' ); 17 | } ); 18 | -------------------------------------------------------------------------------- /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "credits-cli", 3 | "projectOwner": "stefanjudis", 4 | "files": [ 5 | "README.md" 6 | ], 7 | "imageSize": 75, 8 | "commit": false, 9 | "contributors": [ 10 | { 11 | "login": "Hypercubed", 12 | "name": "Jayson Harshbarger", 13 | "avatar_url": "https://avatars.githubusercontent.com/u/509946?v=3", 14 | "profile": "http://www.hypercubed.com", 15 | "contributions": [ 16 | "doc", 17 | "code" 18 | ] 19 | }, 20 | { 21 | "login": "sindresorhus", 22 | "name": "Sindre Sorhus", 23 | "avatar_url": "https://avatars.githubusercontent.com/u/170270?v=3", 24 | "profile": "https://twitter.com/sindresorhus", 25 | "contributions": [ 26 | "code" 27 | ] 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "ecmaVersion": 6, 4 | "sourceType": "module" 5 | }, 6 | "rules": { 7 | "indent": [ 8 | 2, 9 | 2 10 | ], 11 | "quotes": [ 12 | 2, 13 | "single" 14 | ], 15 | "linebreak-style": [ 16 | 2, 17 | "unix" 18 | ], 19 | "semi": [ 20 | 2, 21 | "always" 22 | ], 23 | "no-multi-spaces": 0, 24 | "no-underscore-dangle": 0, 25 | "no-use-before-define": 0, 26 | "key-spacing": [ 27 | 2, 28 | { 29 | "align": "colon", 30 | "beforeColon": true, 31 | "afterColon": true 32 | } 33 | ], 34 | "object-curly-spacing": [2, "always"], 35 | "array-bracket-spacing": [2, "always"], 36 | "computed-property-spacing": [2, "always"], 37 | "space-in-parens": [2, "always" ] 38 | }, 39 | "env": { 40 | "es6": true, 41 | "node": true 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /reporters/minimal.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let chalk = require( 'chalk' ); 4 | let plur = require( 'plur' ); 5 | 6 | module.exports = function( name, credits ) { 7 | let report = chalk.blue( `Credits for ${name}\n` ); 8 | 9 | let len = 0; 10 | for ( let pack in credits ) { 11 | len += credits[ pack ].length; 12 | } 13 | 14 | report += `${name} relies on the work of ${len} people:\n\n`; 15 | 16 | for ( let pack in credits ) { 17 | if ( credits[ pack ].length > 0 ) { 18 | report += `\n${pack}\n`; 19 | } 20 | credits[ pack ].forEach( function( credit ) { 21 | var columns = [ 22 | chalk.blue( credit.name ) 23 | ]; 24 | 25 | if ( credit.email ) { 26 | columns.push( chalk.red( credit.email || '' ) ); 27 | } 28 | 29 | var pkgCount = credit.packages.length; 30 | 31 | columns.push( `(${pkgCount } ${plur( 'package', pkgCount )})` ); 32 | 33 | report += `${columns.join( ' ' )}\n`; 34 | } ); 35 | } 36 | 37 | return report; 38 | }; 39 | -------------------------------------------------------------------------------- /test/extended.spec.js: -------------------------------------------------------------------------------- 1 | import test from 'ava'; 2 | import extended from '../reporters/extended'; 3 | import credits from './fixtures/credits.spec.json'; 4 | import chalk from 'chalk'; 5 | 6 | chalk.enabled = false; 7 | 8 | test( 'extended reporter', t => { 9 | 10 | let result = extended( 'foo', credits ).split( '\n' ); 11 | 12 | t.deepEqual( result[ 0 ], 'Credits for foo' ); 13 | t.deepEqual( result[ 1 ], 'foo relies on the work of 9 people:' ); 14 | t.deepEqual( result[ 3 ], 'npm' ); 15 | t.deepEqual( result[ 5 ], 'Alice Bobson' ); 16 | t.deepEqual( result[ 6 ], '3 packages: foo, bar, baz' ); 17 | t.deepEqual( result[ 7 ], '' ); 18 | t.deepEqual( result[ 8 ], 'Bob Calsow' ); 19 | t.deepEqual( result[ 9 ], 'Mail: bob@calsow.io' ); 20 | t.deepEqual( result[ 10 ], '2 packages: foo, bar' ); 21 | t.deepEqual( result[ 11 ], '' ); 22 | t.deepEqual( result[ 12 ], 'Jonny John' ); 23 | t.deepEqual( result[ 13 ], 'GitHub: johnyjohn Twitter: @johnnyjohn' ); 24 | t.deepEqual( result[ 14 ], '1 package: foo' ); 25 | } ); 26 | -------------------------------------------------------------------------------- /reporters/markdown.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let plur = require( 'plur' ); 4 | 5 | module.exports = function( name, credits ) { 6 | let report = `# Credits for ${name}\n`; 7 | 8 | let len = 0; 9 | for ( let pack in credits ) { 10 | len += credits[ pack ].length; 11 | } 12 | 13 | report += `## ${name} relies on the work of ${len} people:\n\n`; 14 | 15 | for ( let pack in credits ) { 16 | if ( credits[ pack ].length > 0 ) { 17 | report += `\n## ${pack}\n\n`; 18 | } 19 | credits[ pack ].forEach( function( credit ) { 20 | let columns = [ '-' ]; 21 | 22 | if ( credit.name ) { 23 | columns.push( `**${ credit.name || '' }**` ); 24 | } 25 | 26 | if ( credit.email ) { 27 | columns.push( `*${ credit.email || '' }*` ); 28 | } 29 | 30 | if ( columns.length === 1 ) { 31 | columns.push( 'Unknown' ); 32 | } 33 | 34 | let pkgCount = credit.packages.length; 35 | 36 | columns.push( `(${pkgCount} ${plur( 'package', pkgCount )})` ); 37 | 38 | report += `${columns.join( ' ' )}\n`; 39 | 40 | } ); 41 | } 42 | 43 | return report; 44 | }; 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Stefan Judis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /test/cli.spec.js: -------------------------------------------------------------------------------- 1 | // eslint "sourceType": "module" 2 | 3 | import childProcess from 'child_process'; 4 | import test from 'ava'; 5 | import tmp from 'tmp'; 6 | import fs from 'fs'; 7 | import nodePath from 'path'; 8 | import execa from 'execa'; 9 | 10 | // import it so that 11 | // nyc gets it for code coverage check 12 | // import credits from '../cli.js'; 13 | 14 | const path = nodePath.resolve( './fixtures' ); 15 | 16 | test( 'credits - folder exists', t => { 17 | return execa( '../cli.js', [ path ] ).then( res => { 18 | const result = res.stdout.split( '\n' ); 19 | t.deepEqual( result[ 0 ], 'Credits for credits-cli-test' ); 20 | t.deepEqual( result[ 4 ], 'npm' ); 21 | t.deepEqual( result[ 5 ], 'Alice Bobson (3 packages)' ); 22 | t.deepEqual( result[ 6 ], 'Bob Calsow bob@calsow.io (2 packages)' ); 23 | t.deepEqual( result[ 7 ], 'Randy Ran (1 package)' ); 24 | } ); 25 | } ); 26 | 27 | // for some reason that makes travis crash??? 28 | // test( 'credits - folder does not exists', t => { 29 | // try { 30 | // childProcess.execSync( 31 | // `./cli.js /path/does/not/exist > /dev/null 2>&1`, 32 | // { cwd : __dirname } 33 | // ); 34 | // } catch( error ) { 35 | // t.end(); 36 | // } 37 | // } ); 38 | -------------------------------------------------------------------------------- /test/fixtures/credits.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "npm": [ 3 | { 4 | "name" : "Alice Bobson", 5 | "packages" : [ "foo", "bar", "baz" ] 6 | }, 7 | { 8 | "name" : "Bob Calsow", 9 | "email" : "bob@calsow.io", 10 | "packages" : [ "foo", "bar" ] 11 | }, 12 | { 13 | "name" : "Jonny John", 14 | "github" : "johnyjohn", 15 | "twitter" : "johnnyjohn", 16 | "packages" : [ "foo" ] 17 | } 18 | ], 19 | "jspm": [ 20 | { 21 | "name" : "Alice Bobson", 22 | "packages" : [ "foo", "bar", "baz" ] 23 | }, 24 | { 25 | "name" : "Bob Calsow", 26 | "email" : "bob@calsow.io", 27 | "packages" : [ "foo", "bar" ] 28 | }, 29 | { 30 | "name" : "Jonny John", 31 | "github" : "johnyjohn", 32 | "twitter" : "johnnyjohn", 33 | "packages" : [ "foo" ] 34 | } 35 | ], 36 | "bower": [ 37 | { 38 | "name" : "Alice Bobson", 39 | "packages" : [ "foo", "bar", "baz" ] 40 | }, 41 | { 42 | "name" : "Bob Calsow", 43 | "email" : "bob@calsow.io", 44 | "packages" : [ "foo", "bar" ] 45 | }, 46 | { 47 | "name" : "Jonny John", 48 | "github" : "johnyjohn", 49 | "twitter" : "johnnyjohn", 50 | "packages" : [ "foo" ] 51 | } 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "credits-cli", 3 | "version": "3.1.0", 4 | "description": "https://github.com/stefanjudis/credits-cli", 5 | "bin": { 6 | "credits": "cli.js" 7 | }, 8 | "files": [ 9 | "reporters", 10 | "cli.js" 11 | ], 12 | "scripts": { 13 | "add": "all-contributors add", 14 | "lint": "eslint *.js reporters/*.js test/*.js", 15 | "test": "npm run lint && nyc ava", 16 | "coveralls": "nyc report --reporter=text-lcov | coveralls" 17 | }, 18 | "repository": { 19 | "type": "git", 20 | "url": "git+https://github.com/stefanjudis/credits-cli.git" 21 | }, 22 | "author": "Stefan Judis ", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/stefanjudis/credits-cli/issues" 26 | }, 27 | "engines": { 28 | "node": ">=4" 29 | }, 30 | "homepage": "https://github.com/stefanjudis/credits-cli#readme", 31 | "dependencies": { 32 | "chalk": "^1.1.3", 33 | "credits": "^2.1.0", 34 | "meow": "^3.5.0", 35 | "plur": "^2.0.0", 36 | "slice-ansi": "0.0.4", 37 | "string-width": "^2.0.0" 38 | }, 39 | "devDependencies": { 40 | "all-contributors-cli": "^3.0.6", 41 | "ava": "^0.16.0", 42 | "coveralls": "^2.11.14", 43 | "eslint": "^3.8.0", 44 | "execa": "^0.5.0", 45 | "nyc": "^8.3.1", 46 | "tmp": "0.0.29" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /reporters/extended.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let chalk = require( 'chalk' ); 4 | let plur = require( 'plur' ); 5 | 6 | module.exports = function( name, credits ) { 7 | 8 | let report = chalk.blue( `Credits for ${name}\n` ); 9 | 10 | let len = 0; 11 | for ( let pack in credits ) { 12 | len += credits[ pack ].length; 13 | } 14 | 15 | report += `${name} relies on the work of ${len} people:\n\n`; 16 | 17 | for ( let pack in credits ) { 18 | report += `${pack}\n\n`; 19 | credits[ pack ].forEach( function( credit ) { 20 | let columns = [ 21 | [ chalk.blue( credit.name ) ], 22 | [], 23 | [] 24 | ]; 25 | 26 | if ( credit.email ) { 27 | columns[ 1 ].push( 'Mail: ' + chalk.red( credit.email ) ); 28 | } 29 | 30 | if ( credit.github ) { 31 | columns[ 1 ].push( 'GitHub: ' + chalk.red( credit.github ) ); 32 | } 33 | 34 | if ( credit.twitter ) { 35 | columns[ 1 ].push( 'Twitter: ' + chalk.red( '@' + credit.twitter ) ); 36 | } 37 | 38 | let pkgCount = credit.packages.length; 39 | 40 | columns[ 2 ].push( `${pkgCount } ${plur( 'package', pkgCount )}:` ); 41 | columns[ 2 ].push( credit.packages.join( ', ' ) ); 42 | 43 | columns = columns.reduce( ( columns, column ) => { 44 | if ( column.length ) { 45 | columns.push( column.join( ' ' ) ); 46 | } 47 | 48 | return columns; 49 | }, [] ); 50 | 51 | report += `${columns.join( '\n' )}\n\n`; 52 | } ); 53 | } 54 | 55 | return report; 56 | }; 57 | -------------------------------------------------------------------------------- /reporters/credits.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const chalk = require( 'chalk' ); 4 | const plur = require( 'plur' ); 5 | const stringWidth = require( 'string-width' ); 6 | const sliceAnsi = require( 'slice-ansi' ); 7 | 8 | const padding = Array( 60 ).join( ' ' ); 9 | 10 | module.exports = function( name, credits ) { 11 | let report = center( chalk.blue.bold( `Credits for ${name}` ) ) + '\n'; 12 | 13 | let len = 0; 14 | for ( let pack in credits ) { 15 | len += credits[ pack ].length; 16 | } 17 | 18 | report += center( `${name} relies on the work of ${len} people` ); 19 | 20 | for ( let pack in credits ) { 21 | if ( credits[ pack ].length > 0 ) { 22 | report += `\n\n${center( chalk.underline( pack ) )}\n\n`; 23 | } 24 | report += credits[ pack ].map( credit => { 25 | const lhs = chalk.blue( credit.name || 'Unknown' ); 26 | let rhs = ' '; 27 | rhs += chalk.red( credit.email ? credit.email + ' ' : '' ); 28 | 29 | const pkgCount = credit.packages.length; 30 | 31 | rhs += `${pkgCount} ${plur( 'package', pkgCount )}`; 32 | return pad( padding, lhs, true ) + pad( padding, rhs, false ); 33 | } ).join( '\n' ); 34 | } 35 | 36 | return report; 37 | }; 38 | 39 | function center ( str ) { 40 | const p = padding + padding.slice( 0, Math.floor( stringWidth( str ) / 2 ) + 2 ); 41 | return pad( p, str, true ); 42 | } 43 | 44 | function pad( pad, str, padLeft ) { 45 | if ( typeof str === 'undefined' ) 46 | return pad; 47 | if ( padLeft ) { 48 | str = pad + str; 49 | return sliceAnsi( str, stringWidth( str ) - pad.length ); 50 | } else { 51 | return sliceAnsi( str + pad, 0, pad.length ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict'; 3 | 4 | let credits = require( 'credits' ); 5 | let path = require( 'path' ); 6 | let meow = require( 'meow' ); 7 | let fs = require( 'fs' ); 8 | let cli = meow( ` 9 | Usage 10 | $ credits 11 | 12 | Options 13 | -r, --reporter Choose reporter to format output [ minimal, extended, markdown ] 14 | 15 | Examples 16 | $ credits /projects/foo 17 | $ credits /projects/foo --reporter extended 18 | $ credits /projects/foo --reporter markdown > THANKS.md`, 19 | { 20 | alias : { 21 | r : 'reporter' 22 | } 23 | } 24 | ); 25 | 26 | let reporters = fs.readdirSync( path.resolve( __dirname, 'reporters' ) ).reduce( 27 | function( reporters, reporter ) { 28 | if ( ! /spec.js/.test( reporter ) ) { 29 | reporter = reporter.replace( '.js', '' ); 30 | reporters[ reporter ] = require( './reporters/' + reporter ); 31 | } 32 | 33 | return reporters; 34 | }, 35 | {} 36 | ); 37 | 38 | let reporter = reporters[ cli.flags.reporter ] || reporters.minimal; 39 | 40 | let creditPath = path.resolve( process.cwd(), cli.input[ 0 ] || '.' ); 41 | 42 | credits( creditPath ) 43 | .then( printCredits ) 44 | .catch( function( error ) { 45 | console.log( 'error', error ); 46 | process.exit( 1 ); 47 | } ); 48 | 49 | 50 | /** 51 | * Print the credits in a nice way 52 | * 53 | * @param {Array} credits credits 54 | */ 55 | function printCredits( credits ) { 56 | let projectName = ''; 57 | try { 58 | projectName = require( path.join( creditPath, '/package.json' ) ).name; 59 | } catch( err ) { 60 | projectName = creditPath.split( path.sep ).pop(); 61 | } 62 | console.log( reporter( projectName, credits ) ); 63 | } 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](http://img.shields.io/travis/stefanjudis/credits-cli.svg?style=flat)](https://travis-ci.org/stefanjudis/credits-cli) [![npm version](http://img.shields.io/npm/v/credits-cli.svg?style=flat)](https://www.npmjs.org/package/credits-cli) [![npm downloads](http://img.shields.io/npm/dm/credits-cli.svg?style=flat)](https://www.npmjs.org/package/credits-cli) [![Coverage Status](http://img.shields.io/coveralls/stefanjudis/credits-cli.svg?style=flat)](https://coveralls.io/r/stefanjudis/credits-cli?branch=master) [![Uses greenkeeper.io](https://img.shields.io/badge/Uses-greenkeeper.io-green.svg)](http://greenkeeper.io/) 2 | [![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors) 3 | 4 | # credits-cli 5 | > Find out on whose work your project is based on 6 | 7 | ![Screenshot](./screenshot.png) 8 | 9 | We all use a lot of open source projects. Really often we don't even know who is responsible for all the well done projects. You want to see who to thank for hard work? 10 | 11 | **Use `credits` and find out on whose work your projects are based on.** 12 | 13 | ## Install 14 | 15 | ``` 16 | npm install -g credits-cli 17 | ``` 18 | 19 | Also you can use `credits` without global installation, using [`npx`](https://blog.npmjs.org/post/162869356040/introducing-npx-an-npm-package-runner): 20 | 21 | ``` 22 | npx credits-cli 23 | ``` 24 | 25 | ## Basic usage 26 | 27 | `credits` will check all `node_modules` recursively and evaluate the **Author** and **Maintainers** of the **installed** dependencies included in the set path. 28 | 29 | ``` 30 | Usage 31 | $ credits 32 | 33 | Options 34 | -r, --reporter Choose reporter to format output [ minimal, extended, markdown ] 35 | 36 | Examples 37 | $ credits /projects/foo 38 | $ credits /projects/foo --reporter extended 39 | $ credits /projects/foo --reporter markdown > THANKS.md 40 | ``` 41 | 42 | ### Examples 43 | 44 | You can use `credits` to generate a `THANKS.md` files easily by running: 45 | 46 | ``` 47 | $ credits . --reporter markdown > THANKS.md 48 | ``` 49 | 50 | *************** 51 | 52 | #### I want to thank all these [people](./THANKS.md) for their great work!!! 53 | 54 | ## Contributors 55 | 56 | Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)): 57 | 58 | 59 | | [
Jayson Harshbarger](http://www.hypercubed.com)
[📖](https://github.com/stefanjudis/credits-cli/commits?author=Hypercubed) [💻](https://github.com/stefanjudis/credits-cli/commits?author=Hypercubed) | [
Sindre Sorhus](https://twitter.com/sindresorhus)
[💻](https://github.com/stefanjudis/credits-cli/commits?author=sindresorhus) | 60 | | :---: | :---: | 61 | 62 | 63 | This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome! 64 | -------------------------------------------------------------------------------- /THANKS.md: -------------------------------------------------------------------------------- 1 | # Credits for credits-cli 2 | ## credits-cli relies on the work of 216 people: 3 | 4 | 5 | ## npm 6 | 7 | - **Sindre Sorhus** *sindresorhus@gmail.com* (112 packages) 8 | - **Jon Schlinkert** *github@sellside.com* (38 packages) 9 | - **John-David Dalton** *john.david.dalton@gmail.com* (32 packages) 10 | - **Isaac Z. Schlueter** *isaacs@npmjs.com* (30 packages) 11 | - **Mathias Bynens** *mathias@qiwi.be* (30 packages) 12 | - **Blaine Bublitz** *blaine@iceddev.com* (27 packages) 13 | - **Benjamin Tan** *demoneaux@gmail.com* (22 packages) 14 | - **Kit Cambridge** *github@kitcambridge.be* (22 packages) 15 | - **Takuto Wada** *takuto.wada@gmail.com* (22 packages) 16 | - **doowb** *brian.woodward@gmail.com* (20 packages) 17 | - **Sebastian McKenzie** *sebmck@gmail.com* (19 packages) 18 | - **James Halliday** *mail@substack.net* (17 packages) 19 | - **Benjamin Coe** *ben@npmjs.com* (11 packages) 20 | - **Forrest L Norvell** *forrest@npmjs.com* (10 packages) 21 | - **jamestalmage** *james@talmage.io* (10 packages) 22 | - **Olov Lassus** *olov.lassus@gmail.com* (9 packages) 23 | - **Mariusz Nowak** *medyk@medikoo.com* (8 packages) 24 | - **Vsevolod Strukchinsky** *floatdrop@gmail.com* (8 packages) 25 | - **nzakas** *nicholas@nczconsulting.com* (7 packages) 26 | - **Mathias Buus** *mathiasbuus@gmail.com* (7 packages) 27 | - **Joshua Appelman** *jappelman@xebia.com* (7 packages) 28 | - **Mikeal Rogers** *mikeal.rogers@gmail.com* (7 packages) 29 | - **Yusuke SUZUKI** *utatane.tea@gmail.com* (6 packages) 30 | - **Elan Shanker** *elan.shanker+npm@gmail.com* (6 packages) 31 | - **James Nylen** *jnylen@gmail.com* (6 packages) 32 | - **Eran Hammer** *eran@hammer.io* (6 packages) 33 | - **Michael Ficarra** *github.public.email@michael.ficarra.me* (5 packages) 34 | - **arekinath** *alex@cooperi.net* (5 packages) 35 | - **Simon Boudrias** *admin@simonboudrias.com* (5 packages) 36 | - **Shinnosuke Watanabe** *snnskwtnb@gmail.com* (5 packages) 37 | - **Simeon Velichkov** *simeonvelichkov@gmail.com* (5 packages) 38 | - **Rebecca Turner** *me@re-becca.org* (5 packages) 39 | - **Kat Marchaán** *kzm@sykosomatic.org* (5 packages) 40 | - **Ben Newman** *bn@cs.stanford.edu* (5 packages) 41 | - **George Zahariev** *z@georgezahariev.com* (4 packages) 42 | - **Rod Vagg** *r@va.gg* (4 packages) 43 | - **Kevin Mårtensson** *kevinmartensson@gmail.com* (4 packages) 44 | - **qix** *i.am.qix@gmail.com* (4 packages) 45 | - **Kyle E. Mitchell** *kyle@kemitchell.com* (4 packages) 46 | - **Andrew Goode** *andrewbgoode@gmail.com* (4 packages) 47 | - **Calvin Metcalf** *calvin.metcalf@gmail.com* (3 packages) 48 | - **Felix Geisendörfer** *felix@debuggable.com* (3 packages) 49 | - **Julian Gruber** *julian@juliangruber.com* (3 packages) 50 | - **dap** *dap@cs.brown.edu* (3 packages) 51 | - **Jonathan Ong** *jonathanrichardong@gmail.com* (3 packages) 52 | - **loganfsmyth** *loganfsmyth@gmail.com* (3 packages) 53 | - **Nathan Rajlich** *nathan@tootallnate.net* (3 packages) 54 | - **Jesse McCarthy** *npm-public@jessemccarthy.net* (3 packages) 55 | - **vdemedes** *vdemedes@gmail.com* (3 packages) 56 | - **Alex Indigo** *iam@alexindigo.com* (3 packages) 57 | - **Forbes Lindesay** *forbes@lindesay.co.uk* (3 packages) 58 | - **pfmooney** *patrick.f.mooney@gmail.com* (3 packages) 59 | - **Mark Cavage** *mcavage@gmail.com* (3 packages) 60 | - **hzoo** *hi@henryzoo.com* (3 packages) 61 | - **amasad** *amjad.masad@gmail.com* (3 packages) 62 | - **apechimp** *apeherder@gmail.com* (2 packages) 63 | - **TJ Holowaychuk** *tj@vision-media.ca* (2 packages) 64 | - **Ariya Hidayat** *ariya.hidayat@gmail.com* (2 packages) 65 | - **Zhiye Li** *github@zhiye.li* (2 packages) 66 | - **Nicholas C. Zakas** *nicholas+npm@nczconsulting.com* (2 packages) 67 | - **Vitaly Puzrin** *vitaly@rcdesign.ru* (2 packages) 68 | - **Ingvar Stepanyan** *me@rreverser.com* (2 packages) 69 | - **Jordan Harband** *ljharb@gmail.com* (2 packages) 70 | - **thejameskyle** *me@thejameskyle.com* (2 packages) 71 | - **Roy Riojas** (2 packages) 72 | - **royriojas** *royriojas@gmail.com* (2 packages) 73 | - **Addy Osmani** *addyosmani@gmail.com* (2 packages) 74 | - **Nathan LaFreniere** *quitlahok@gmail.com* (2 packages) 75 | - **Pascal Hartig** *passy@twitter.com* (2 packages) 76 | - **Wyatt Preul** *wpreul@gmail.com* (2 packages) 77 | - **Eddie Monge** *eddie+npm@eddiemonge.com* (2 packages) 78 | - **Joyent, Inc** (2 packages) 79 | - **Jake Verbaten** *raynos2@gmail.com* (2 packages) 80 | - **Dav Glass** *davglass@gmail.com* (2 packages) 81 | - **Thorsten Lorenz** *thlorenz@gmx.de* (2 packages) 82 | - **cainus** *gregg@caines.ca* (2 packages) 83 | - **IndigoUnited** *hello@indigounited.com* (2 packages) 84 | - **André Cruz** *amdfcruz@gmail.com* (2 packages) 85 | - **Douglas Wilson** *doug@somethingdoug.com* (2 packages) 86 | - **Robert Kieffer** *robert@broofa.com* (2 packages) 87 | - **Michael Hart** *michael.hart.au@gmail.com* (2 packages) 88 | - **matatbread** (2 packages) 89 | - **Domenic Denicola** *domenic@domenicdenicola.com* (2 packages) 90 | - **Dominic Tarr** *dominic.tarr@gmail.com* (2 packages) 91 | - **Fred K. Schott** *fkschott@gmail.com* (2 packages) 92 | - **ult_combo** *ultcombo@gmail.com* (1 package) 93 | - **Andres Suarez** *zertosh@gmail.com* (1 package) 94 | - **webreflection** *andrea.giammarchi@gmail.com* (1 package) 95 | - **Ilya Radchenko** *ilya@burstcreations.com* (1 package) 96 | - **Stefan Duberg** *stefanduberg@gmail.com* (1 package) 97 | - **Masaki Komagata** (1 package) 98 | - **komagata** *komagata@gmail.com* (1 package) 99 | - **Jeremie Miller** *jeremie@jabber.org* (1 package) 100 | - **rynomad** *nomad.ry@gmail.com* (1 package) 101 | - **Yehuda Katz, Tom Dale, Stefan Penner and contributors** (1 package) 102 | - **Jake Archibald** * jaffathecake@gmail.com* (1 package) 103 | - **Stefan Penner** *stefan.penner@gmail.com* (1 package) 104 | - **Caolan McMahon** *caolan.mcmahon@gmail.com* (1 package) 105 | - **Beau Gunderson** *beau@beaugunderson.com* (1 package) 106 | - **celer** *dtyree77@gmail.com* (1 package) 107 | - **Ramesh Nair** *ram@hiddentao.com* (1 package) 108 | - **byk** *ben@byk.im* (1 package) 109 | - **lo1tuma** *schreck.mathias@gmail.com* (1 package) 110 | - **Vladimir Zapparov** *dervus.grim@gmail.com* (1 package) 111 | - **Petka Antonov** *petka.antonov@gmail.com* (1 package) 112 | - **ivolodin** *ivolodin@gmail.com* (1 package) 113 | - **Jeff Morrison** *jeff@anafx.com* (1 package) 114 | - **Paul O’Shannessy** *paul@oshannessy.com* (1 package) 115 | - **marijn** *marijnh@gmail.com* (1 package) 116 | - **Nick Fitzgerald** *nfitzgerald@mozilla.com* (1 package) 117 | - **Stefan Thomas** *justmoon@members.fsf.org* (1 package) 118 | - **Randall Koutnik** *@rkoutnik* (1 package) 119 | - **mozilla-devtools** *mozilla-developer-tools@googlegroups.com* (1 package) 120 | - **mozilla** *dherman@mozilla.com* (1 package) 121 | - **Max Ogden** *max@maxogden.com* (1 package) 122 | - **dylanpiercey** *pierceydylan@gmail.com* (1 package) 123 | - **nickfitzgerald** *fitzgen@gmail.com* (1 package) 124 | - **coderhaoxin** *coderhaoxin@outlook.com* (1 package) 125 | - **fengmk2** *fengmk2@gmail.com* (1 package) 126 | - **dead_horse** *dead_horse@qq.com* (1 package) 127 | - **swatinem** *arpad.borsos@googlemail.com* (1 package) 128 | - **Alex Wilson** *alex.wilson@joyent.com* (1 package) 129 | - **Yehuda Katz** *wycats@gmail.com* (1 package) 130 | - **Kevin Decker** *kpdecker@gmail.com* (1 package) 131 | - **Ahmad Nassri** *ahmad@ahmadnassri.com* (1 package) 132 | - Unknown (1 package) 133 | - **evanw** *evan.exe@gmail.com* (1 package) 134 | - **Alexander Early** *alexander.early@gmail.com* (1 package) 135 | - **Adam Bretz** *arbretz@gmail.com* (1 package) 136 | - **Arthur Verschaeve** *arthur.versch@gmail.com* (1 package) 137 | - **Alexander Shtuchkin** *ashtuchkin@gmail.com* (1 package) 138 | - **Jens Taylor** *jensyt@gmail.com* (1 package) 139 | - **Qix** (1 package) 140 | - **Feross Aboukhadijeh** *feross@feross.org* (1 package) 141 | - **Parsha Pourkhomami** (1 package) 142 | - **parshap** *supster+npm@gmail.com* (1 package) 143 | - **emilbay** *github@tixz.dk* (1 package) 144 | - **freeall** *freeall@gmail.com* (1 package) 145 | - **watson** *w@tson.dk* (1 package) 146 | - **yoshuawuyts** *i@yoshuawuyts.com* (1 package) 147 | - **Mikola Lysenko** (1 package) 148 | - **mikolalysenko** *mikolalysenko@gmail.com* (1 package) 149 | - **Hugh Kennedy** *hughskennedy@gmail.com* (1 package) 150 | - **segmentio** *friends@segment.io* (1 package) 151 | - **Zeke Sikelianos** *zeke@sikelianos.com* (1 package) 152 | - **wayfind** (1 package) 153 | - **Michele Bini, Ron Garret, Guy K. Kloss** (1 package) 154 | - **Simon Lydell** (1 package) 155 | - **lydell** *simon.lydell@gmail.com* (1 package) 156 | - **Tom Wu** (1 package) 157 | - **andyperlitch** *andyperlitch@gmail.com* (1 package) 158 | - **zloirock** *zloirock@zloirock.ru* (1 package) 159 | - **Kris Zyp** (1 package) 160 | - **kriszyp** *kriszyp@gmail.com* (1 package) 161 | - **moll** *andri@dot.ee* (1 package) 162 | - **Aseem Kishore** *aseem.kishore@gmail.com* (1 package) 163 | - **Douglas Crockford** (1 package) 164 | - **Jan Lehnardt** *jan@apache.org* (1 package) 165 | - **marcbachmann** *marc.brookman@gmail.com* (1 package) 166 | - **Graeme Yeates** *yeatesgraeme@gmail.com* (1 package) 167 | - **Gregg Caines** (1 package) 168 | - **dubban** *stefanduberg@me.com* (1 package) 169 | - **nickmerwin** *n@mer.fm* (1 package) 170 | - **Stefan Judis** *stefanjudis@gmail.com* (1 package) 171 | - **James Burke** *jrburke@gmail.com* (1 package) 172 | - **Jeremiah Senkpiel** *fishrock123@rocketmail.com* (1 package) 173 | - **Guillermo Rauch** *rauchg@gmail.com* (1 package) 174 | - **Matt Lavin** *matt.lavin@gmail.com* (1 package) 175 | - **mhernandez** *michael.hernandez1988@gmail.com* (1 package) 176 | - **AJ ONeal** *awesome@coolaj86.com* (1 package) 177 | - **Meryn Stol** *merynstol@gmail.com* (1 package) 178 | - **mklabs** (1 package) 179 | - **Alex Ford** *alex.ford@codetunnel.com* (1 package) 180 | - **Mihai Bazon** *mihai.bazon@gmail.com* (1 package) 181 | - **Caires Vinicius** *cairesvs@gmail.com* (1 package) 182 | - **Mathias Pettersson** *mape@ma.pe* (1 package) 183 | - **Alexandru Marasteanu** *hello@alexei.ro* (1 package) 184 | - **Krishnan Anantheswaran** *kananthmail-github@yahoo.com* (1 package) 185 | - **Trent Millar** (1 package) 186 | - **tmillar** *trent.millar@gmail.com* (1 package) 187 | - **Paul Miller** *paul+gh@paulmillr.com* (1 package) 188 | - **ceejbot** *ceejceej@gmail.com* (1 package) 189 | - **Andrea Giammarchi** (1 package) 190 | - **The Linux Foundation** (1 package) 191 | - **DC** *threedeecee@gmail.com* (1 package) 192 | - **Ben Alpert** *ben@benalpert.com* (1 package) 193 | - **Sean McArthur** *sean.monstar@gmail.com* (1 package) 194 | - **robertkowalski** *rok@kowalski.gd* (1 package) 195 | - **Trent Mick** *trentm@gmail.com* (1 package) 196 | - Unknown (1 package) 197 | - **Kris Kowal** *kris@cixar.com* (1 package) 198 | - **Viacheslav Lotsmanov** *lotsmanov89@gmail.com* (1 package) 199 | - **'Julian Viereck'** *julian.viereck@gmail.com* (1 package) 200 | - **schnittstabil** *michael@schnittstabil.de* (1 package) 201 | - **Cloud Programmability Team** (1 package) 202 | - **mattpodwysocki** *matthew.podwysocki@gmail.com* (1 package) 203 | - **Artur Adib** *arturadib@gmail.com* (1 package) 204 | - **julien-f** *julien.fontanet@isonoe.net* (1 package) 205 | - **linusu** *linus@folkdatorn.se* (1 package) 206 | - **Angry Bytes** *info@angrybytes.com* (1 package) 207 | - **stephank** *stephan@kochen.nl* (1 package) 208 | - **Joakim Carlstein** *joakim@klei.se* (1 package) 209 | - **KARASZI István** *github@spam.raszi.hu* (1 package) 210 | - **raszi** *npm@spam.raszi.hu* (1 package) 211 | - **Jeremy Stashewsky** *jstashewsky@salesforce.com* (1 package) 212 | - **jstash** *jstash@gmail.com* (1 package) 213 | - **nexxy** *emily@contactvibe.com* (1 package) 214 | - **Henrik Joreteg** *henrik@andyet.net* (1 package) 215 | - **TweetNaCl-js contributors** (1 package) 216 | - **dchest** *dmitry@codingrobots.com* (1 package) 217 | - **rvanvelzen1** *rvanvelzen1@gmail.com* (1 package) 218 | - **Tim** *tim@fostle.com* (1 package) 219 | - **Vincent Voyer** *vincent.voyer@gmail.com* (1 package) 220 | - **Roman Shtylman** *shtylman@gmail.com* (1 package) 221 | - **Michael Hernandez - michael.hernandez1988@gmail.com** (1 package) 222 | - **gabelevi** *gabelevi@gmail.com* (1 package) 223 | 224 | --------------------------------------------------------------------------------