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'
)
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
entry data from GitHub:
https://api.github.com/repos/${ repo }:
- Collect
stars, the number of stars (from stargazers_count).
- Collect
forks, the number of forks.
- Collect
issues, the number of open issues (from open_issues_count).
https://api.github.com/repos/${ repo }/contributors:
- Collect
contributors, the list of contributors:
- Collect each
user, a contributor’s username (from login).
- Collect each
contributions, a contributor’s number of contributions.
- Collect each
avatar, a contributor’s avatar (from avatar_url).
- Read the database from the JSON file.
- Push the plugin
entry data to the database by name.
- Sort the database by names.
- Write the database back to the JSON file.
I’d like to recommend an updated list of data we should collect for plugins and how we should collect it.
name:process.argv[2], the first argument passed to the script.entrydata from NPM:https://registry.npmjs.org/${ name }/latest:author, the primary author.dependencies, all/plugin dependencies.keywords, additional search terms.categories, plugin category terms:repo, the GitHub repository path:https://api.npmjs.org/downloads/range/1000-01-01:2100-01-01/${ name }:downloads, the total number of downloads:entrydata from GitHub:https://api.github.com/repos/${ repo }:stars, the number of stars (fromstargazers_count).forks, the number of forks.issues, the number of open issues (fromopen_issues_count).https://api.github.com/repos/${ repo }/contributors:contributors, the list of contributors:user, a contributor’s username (fromlogin).contributions, a contributor’s number of contributions.avatar, a contributor’s avatar (fromavatar_url).entrydata to the database byname.