Skip to content

Commit

Permalink
mvp
Browse files Browse the repository at this point in the history
  • Loading branch information
zeke committed Jan 11, 2018
0 parents commit f0ac2d4
Show file tree
Hide file tree
Showing 3 changed files with 784 additions and 0 deletions.
37 changes: 37 additions & 0 deletions index.js
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)
13 changes: 13 additions & 0 deletions package.json
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"
}
}
Loading

0 comments on commit f0ac2d4

Please sign in to comment.