Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #20

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
schedule:
- cron: "0 */8 * * *"

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
with:
token: ${{ secrets.GITHUB_PAT_FROM_ZEKE }}
- name: npm ci
run: npm ci
- name: release
run: |
git checkout master
git config --global user.name "github-actions"
git config --global user.email "[email protected]"

node update
npm test
[[ `git status --porcelain` ]] || exit

echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc

git add .
npm version patch -f -m "Update all-the-package-names to %s"

git push origin master --follow-tags
npm publish
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
skimdb.json
yarn.lock
package-lock.json
24 changes: 11 additions & 13 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
const names = require('./')
const names = require('all-the-package-names')

// Most-depended-on names are first. See what's popular!
names.slice(0,5)
// [
// 'mocha',
// 'chai',
// 'lodash',
// 'grunt',
// 'eslint'
// ]
names.slice(0, 5)
/*
[
'mocha',
'chai',
'lodash',
'grunt',
'eslint'
]
*/

names.includes('superagent')
// => true

// Check if a given package name exists
names.includes('crazy-new-package-name')
// => false

Expand All @@ -22,6 +23,3 @@ names.length

names.filter(name => name.includes('banana'))
// => [ 'banana', 'banana-banana', 'banana-split', ...]

// Note: This example requires node 4 or greater because it uses
// const, arrow functions, and the `includes` array/string helper.
21 changes: 21 additions & 0 deletions license
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2015 - 2020 nice-registry

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 19 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "all-the-package-names",
"version": "1.3904.0",
"description": "A list of all the public package names on npm. Updated daily.",
"description": "A list of all the public package names on npm. Updated every 8 hours.",
"main": "names.json",
"bin": "cli.js",
"files": [
"names.json",
"cli.js"
],
"scripts": {
"build": "script/build",
"release": "script/release",
"test": "node test/index.js | tap-spec"
"test": "standard && mocha"
},
"repository": "https://github.com/zeke/all-the-package-names",
"repository": "https://github.com/nice-registry/all-the-package-names",
"keywords": [
"npm",
"registry",
Expand All @@ -24,12 +26,18 @@
"author": "zeke",
"license": "MIT",
"devDependencies": {
"chai": "^4.2.0",
"dependent-counts": "^2.0.0",
"is-number": "^4.0.0",
"lodash": "^3.10.0",
"ora": "^0.4.0",
"package-stream": "^1.0.2",
"tap-spec": "^4.1.1",
"tape": "^4.5.1"
"mocha": "^8.0.1",
"num-sort": "^2.1.0",
"ora": "^4.0.4",
"package-stream": "^3.1.0",
"standard": "^14.3.4",
"write-json-file": "^4.3.0"
},
"standard": {
"ignore": [
"example.js"
]
}
}
90 changes: 32 additions & 58 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,40 @@
# all-the-package-names

A list of all the public package names on npm.
A list of all the public package names on npm. The list is just a JSON file and can be used wherever.

- Includes scoped packages
- Sorted by [dependent count](https://github.com/zeke/dependent-counts)
- Uses npm's [replicate.npmjs.com](https://github.com/npm/registry/blob/198b449e5ec11f0cc3e424ce2721dd66e8111589/docs/follower.md) service.
- Updated [daily](http://zeke.sikelianos.com/npm-and-github-automation-with-heroku/)
## Highlights

## Installation
- Includes scoped packages.
- Sorted by [dependent count](https://github.com/zeke/dependent-counts).
- Uses npm's [replicate.npmjs.com](https://github.com/npm/registry/blob/198b449e5ec11f0cc3e424ce2721dd66e8111589/docs/follower.md) service.
- Updated every 8 hours.

## Install

```sh
npm install all-the-package-names --save
npm install all-the-package-names
```

## Usage

The module exports a big flat array of package names:

```js
const names = require("all-the-package-names")
const names = require('all-the-package-names')

// Most-depended-on names are first. See what's popular!
names.slice(0,5)
// [
// 'mocha',
// 'chai',
// 'lodash',
// 'grunt',
// 'eslint'
// ]
names.slice(0, 5)
/*
[
'mocha',
'chai',
'lodash',
'grunt',
'eslint'
]
*/

names.includes('superagent')
// => true

// Check if a given package name exists
names.includes('crazy-new-package-name')
// => false

Expand All @@ -42,57 +43,30 @@ names.length

names.filter(name => name.includes('banana'))
// => [ 'banana', 'banana-banana', 'banana-split', ...]

// Note: This example requires node 4 or greater because it uses
// const, arrow functions, and the `includes` array/string helper.

```

## CLI Usage

You can also use it on the command line. Newline-delimited names are piped to
STDOUT:

```sh
npm i -g all-the-package-names
all-the-package-names | grep spell
$ npm i -g all-the-package-names
$ all-the-package-names
mocha
chai
lodash
grunt
eslint
...
```

## ⚠️ Gotchas
## Common pitfalls

Note that while mixed-case package names are no longer allowed to be published
to the npm registry, there are over 2800 legacy mixed-case packages, many of
which have the same spelling as other existing lowercase packages. See [nice-registry/mixed-case-package-names](https://github.com/nice-registry/mixed-case-package-names)
for the the full list.
for the full list.

To avoid the mixed-case names when working with this data,
just filter them out:
To avoid the mixed-case names when working with this data, just filter them out:

```js
const names = require('all-the-package-names')
.filter(name => name === name.toLowerCase())
const names = require('all-the-package-names').filter(name => name === name.toLowerCase())
```

## Tests

```sh
npm install
npm test
```

## Dependencies

None

## Dev Dependencies

- [dependent-counts](https://github.com/zeke/dependent-counts): Get counts of how many packages depend on the given package. Works offline.
- [lodash](https://github.com/lodash/lodash): The modern build of lodash modular utilities.
- [ora](https://github.com/sindresorhus/ora): Elegant terminal spinner
- [package-stream](https://github.com/zeke/package-stream): An endless stream of clean package data from the npm registry.
- [tap-spec](https://github.com/scottcorgan/tap-spec): Formatted TAP output like Mocha's spec reporter
- [tape](https://github.com/substack/tape): tap-producing test harness for node and browsers

## License

MIT
42 changes: 0 additions & 42 deletions script/build

This file was deleted.

28 changes: 0 additions & 28 deletions script/release

This file was deleted.

9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { describe, it } = require('mocha')
const { expect } = require('chai')
const packageNames = require('.')

describe('names', () => {
it('is an array', () => {
expect(packageNames).to.be.an('array')
})
})
9 changes: 0 additions & 9 deletions test/index.js

This file was deleted.

Loading