-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Description
I’d like to recommend an updated list of data we should collect for plugins and how we should collect it.
- Collect the target NPM
name
:process.argv[2]
, the first argument passed to the script.
- Collect
entry
data from NPM:https://registry.npmjs.org/${ name }/latest
:- Collect
author
, the primary author. - Collect
dependencies
, all/plugin dependencies. - Collect
keywords
, additional search terms. - Collect
categories
, plugin category terms:keywords.filter( (keyword) => /^postcss-plugin-(.+)/.test(keyword) ).map( (keyword) => keyword.replace( /^postcss-plugin-(.+)/, '$1' ) ).reduce( (categories, keyword) => categories.concat(keyword.split('-')), [] )
- Collect
repo
, the GitHub repository path:repository.url.replace( /^git\+https:\/\/github\.com\/(.+)\.git$/, '$1' )
- Collect
https://api.npmjs.org/downloads/range/1000-01-01:2100-01-01/${ name }
:- Collect
downloads
, the total number of downloads:downloads.reduce( (count, download) => count + download.downloads, 0 )
- Collect
- Collect
entry
data from GitHub:https://api.github.com/repos/${ repo }
:- Collect
stars
, the number of stars (fromstargazers_count
). - Collect
forks
, the number of forks. - Collect
issues
, the number of open issues (fromopen_issues_count
).
- Collect
https://api.github.com/repos/${ repo }/contributors
:- Collect
contributors
, the list of contributors:- Collect each
user
, a contributor’s username (fromlogin
). - Collect each
contributions
, a contributor’s number of contributions. - Collect each
avatar
, a contributor’s avatar (fromavatar_url
).
- Collect each
- Collect
- Read the database from the JSON file.
- Push the plugin
entry
data to the database byname
. - Sort the database by names.
- Write the database back to the JSON file.