-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f0ac2d4
Showing
3 changed files
with
784 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require('fs') | ||
const path = require('path') | ||
const readmePath = path.join(__dirname, 'readme.md') | ||
const names = require('all-the-package-names') | ||
const lower = names.filter(name => name.toLowerCase() === name) | ||
const mixed = names.filter(name => name.toLowerCase() !== name) | ||
|
||
// do this silliness to get a list of mixed case overlappers, | ||
// SORTED in the order of the lowercase names (which are sorted by average downloads) | ||
const flattenedMixed = mixed.map(name => name.toLowerCase()) | ||
const overlaps = lower | ||
.filter(name => flattenedMixed.includes(name)) | ||
.map(name => mixed.find(n => n.toLowerCase() === name)) | ||
|
||
let output = ` | ||
# Mixed Case Package Names | ||
There are ${names.length} packages in the npm registry. | ||
${mixed.length} of them have mixed-case names. | ||
${overlaps.length} of them have **overlapping names**, for which both a mixed-case and lowercase package exist. | ||
:warning: Use caution when installing packages :warning: | ||
## Overlaps | ||
(Sorted by average daily download count of the lowercase package) | ||
` | ||
|
||
overlaps.forEach(name => { | ||
output += (`- [${name.toLowerCase()}](https://ghub.io/${name.toLowerCase()}) vs [${name}](https://ghub.io/${name})\n`) | ||
}) | ||
|
||
console.log(output) | ||
fs.writeFileSync(readmePath, output) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "mixed-case-package-names", | ||
"version": "1.0.0", | ||
"description": "A study of existing mixed-case packages in the npm registry", | ||
"main": "index.js", | ||
"repository": "https://github.com/nice-registry/mixed-case-package-names", | ||
"author": "zeke", | ||
"license": "MIT", | ||
"dependencies": { | ||
"all-the-package-names": "^1.3440.0", | ||
"dedent": "^0.7.0" | ||
} | ||
} |
Oops, something went wrong.