Compare commits
	
		
			4 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a39687b70d | |||
| 950c2373f2 | |||
| 4cb8c71b41 | |||
| 7feafcfd49 | 
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							| @ -1,11 +1,13 @@ | |||||||
| # how-npm-am-i.js | # [how-npm-am-i.js](https://git.coolaj86.com/coolaj86/how-npm-am-i.js) | ||||||
| 
 | 
 | ||||||
| Shows how many downloads you get on npm each month, across all of your packages. | Shows how many downloads you get on npm each month, across all of your packages. | ||||||
| 
 | 
 | ||||||
|  | > npx how-npm-am-i <username> [--verbose] | ||||||
|  | 
 | ||||||
| # Usage | # Usage | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| npx how-npm-am-i isaacs --verbose | how-npm-am-i isaacs --verbose | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```txt | ```txt | ||||||
| @ -34,6 +36,6 @@ You're *very* npm. | |||||||
| npm install --global how-npm-am-i | npm install --global how-npm-am-i | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ```bash | # How I built this | ||||||
| how-npm-am-i <username> | 
 | ||||||
| ``` | See <https://coolaj86.com/articles/how-cool-you-are-on-npm/> | ||||||
| @ -29,6 +29,13 @@ hnai | |||||||
| 	.packages(username) | 	.packages(username) | ||||||
| 	.then(function(pkgnames) { | 	.then(function(pkgnames) { | ||||||
| 		console.info(''); | 		console.info(''); | ||||||
|  | 		if (!pkgnames.length) { | ||||||
|  | 			console.info("You've published " + pkgnames.length + ' packages to npm. Hmm.'); | ||||||
|  | 			console.info('Well, we all have to start somewhere.... except maybe you.... you just... keep doing you. 👍'); | ||||||
|  | 			console.info(''); | ||||||
|  | 			process.exit(1337); | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
| 		console.info("You've published " + pkgnames.length + ' packages to npm and you get...'); | 		console.info("You've published " + pkgnames.length + ' packages to npm and you get...'); | ||||||
| 		hnai.downloads(pkgnames).then(function(downloads) { | 		hnai.downloads(pkgnames).then(function(downloads) { | ||||||
| 			var total = downloads.reduce(function(sum, el) { | 			var total = downloads.reduce(function(sum, el) { | ||||||
| @ -56,7 +63,7 @@ hnai | |||||||
| function tabularize(downloads) { | function tabularize(downloads) { | ||||||
| 	console.info(''); | 	console.info(''); | ||||||
| 	var maxLen = 0; | 	var maxLen = 0; | ||||||
| 	var maxCount = 0; | 	var maxCount = "Downloads".length; | ||||||
| 	downloads.sort(function(a, b) { | 	downloads.sort(function(a, b) { | ||||||
| 		maxLen = Math.max(a.package.length, b.package.length, maxLen); | 		maxLen = Math.max(a.package.length, b.package.length, maxLen); | ||||||
| 		maxCount = Math.max(a.downloads.toLocaleString().length, b.downloads.toLocaleString().length, maxCount); | 		maxCount = Math.max(a.downloads.toLocaleString().length, b.downloads.toLocaleString().length, maxCount); | ||||||
|  | |||||||
| @ -1,7 +1,8 @@ | |||||||
| { | { | ||||||
| 	"name": "how-npm-am-i", | 	"name": "how-npm-am-i", | ||||||
| 	"version": "1.0.2", | 	"version": "1.0.5", | ||||||
| 	"description": "See how many downloads you get on npm each month, across all your packages", | 	"description": "See how many downloads you get on npm each month, across all your packages", | ||||||
|  | 	"homepage": "https://git.coolaj86.com/coolaj86/how-npm-am-i.js", | ||||||
| 	"main": "index.js", | 	"main": "index.js", | ||||||
| 	"scripts": { | 	"scripts": { | ||||||
| 		"test": "node test.js" | 		"test": "node test.js" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user