new report names
This commit is contained in:
Родитель
f593a2b340
Коммит
a77b3da3fc
24
bin/build.js
24
bin/build.js
|
@ -30,42 +30,48 @@ function finish () {
|
|||
topDevDeps.forEach(pkg => Object.assign(pkg, registryData[pkg.name]))
|
||||
|
||||
new Report({
|
||||
title: 'Popular App Dependencies',
|
||||
description: 'A list of the top npm packages most often listed as `dependencies` in Electron apps.',
|
||||
slug: 'dependencies',
|
||||
title: 'App Dependencies',
|
||||
description: 'We searched every public repository on GitHub to compile this list of npm packages that are most often listed as `dependencies` in apps that also depend on `electron` or `electron-prebuilt`.',
|
||||
collectionType: 'Package',
|
||||
collection: topDeps
|
||||
}).save()
|
||||
|
||||
new Report({
|
||||
title: 'Popular App Development Dependencies',
|
||||
description: 'A list of the top npm packages most often listed as `devDependencies` in Electron apps.',
|
||||
slug: 'dev_dependencies',
|
||||
title: 'App Development Dependencies',
|
||||
description: 'This list highlights npm packages that are most often listed as `devDependencies` in apps that also depend on `electron` or `electron-prebuilt`.',
|
||||
collectionType: 'Package',
|
||||
collection: topDevDeps
|
||||
}).save()
|
||||
|
||||
new Report({
|
||||
title: 'Prolific GitHub Contributors',
|
||||
description: 'GitHub users that have contributed to the most Electron-related repositories.',
|
||||
slug: 'github_contributors',
|
||||
title: 'GitHub Contributors',
|
||||
description: 'GitHub users who have contributed to numerous Electron-related repositories.',
|
||||
collectionType: 'GithubUser',
|
||||
collection: utils.getTopContributors(repos)
|
||||
}).save()
|
||||
|
||||
new Report({
|
||||
title: 'Popular Low-level Dependencies',
|
||||
slug: 'package_dependencies',
|
||||
title: 'Package Dependencies',
|
||||
description: 'Electron-related npm packages that are frequently depended on by other npm packages.',
|
||||
collectionType: 'Package',
|
||||
collection: electronNpmPackages.sort((a, b) => b.totalDeps - a.totalDeps)
|
||||
}).save()
|
||||
|
||||
new Report({
|
||||
title: 'Most-downloaded npm Packages',
|
||||
slug: 'most_downloaded_packages',
|
||||
title: 'Most Downloaded Packages',
|
||||
description: 'Electron-related npm packages that are downloaded a lot.',
|
||||
collectionType: 'Package',
|
||||
collection: electronNpmPackages.sort((a, b) => b.downloadsInLastMonth - a.downloadsInLastMonth)
|
||||
}).save()
|
||||
|
||||
new Report({
|
||||
title: 'Prolific Package Authors',
|
||||
slug: 'package_authors',
|
||||
title: 'Package Authors',
|
||||
description: 'npm users who maintain numerous Electron-related packages.',
|
||||
collectionType: 'npmUser',
|
||||
collection: utils.getTopPackageAuthors(electronNpmPackages)
|
||||
|
|
|
@ -7,10 +7,6 @@ module.exports = class Report {
|
|||
constructor (props) {
|
||||
Object.assign(this, props)
|
||||
|
||||
if (this.title) {
|
||||
this.basename = this.title.toLowerCase().replace(/[\s-]/g, '_')
|
||||
}
|
||||
|
||||
switch (this.collectionType) {
|
||||
case 'Package':
|
||||
this.cleanPackages()
|
||||
|
@ -34,7 +30,7 @@ module.exports = class Report {
|
|||
if (!this.valid) return console.error(this.validationErrors)
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(__dirname, `../reports/${this.basename}.json`),
|
||||
path.join(__dirname, `../reports/${this.slug}.json`),
|
||||
JSON.stringify(this, null, 2)
|
||||
)
|
||||
}
|
||||
|
@ -78,6 +74,11 @@ module.exports = class Report {
|
|||
|
||||
const schema = {
|
||||
properties: {
|
||||
slug: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
allowEmpty: false
|
||||
},
|
||||
title: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"title": "Popular App Dependencies",
|
||||
"description": "A list of the top npm packages most often listed as `dependencies` in Electron apps.",
|
||||
"slug": "dependencies",
|
||||
"title": "App Dependencies",
|
||||
"description": "We searched every public repository on GitHub to compile this list of npm packages that are most often listed as `dependencies` in apps that also depend on `electron` or `electron-prebuilt`.",
|
||||
"collectionType": "Package",
|
||||
"collection": [
|
||||
{
|
||||
|
@ -18858,6 +18859,5 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"basename": "popular_app_dependencies"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"title": "Popular App Development Dependencies",
|
||||
"description": "A list of the top npm packages most often listed as `devDependencies` in Electron apps.",
|
||||
"slug": "dev_dependencies",
|
||||
"title": "App Development Dependencies",
|
||||
"description": "This list highlights npm packages that are most often listed as `devDependencies` in apps that also depend on `electron` or `electron-prebuilt`.",
|
||||
"collectionType": "Package",
|
||||
"collection": [
|
||||
{
|
||||
|
@ -19679,6 +19680,5 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"basename": "popular_app_development_dependencies"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"title": "Prolific GitHub Contributors",
|
||||
"description": "GitHub users that have contributed to the most Electron-related repositories.",
|
||||
"slug": "github_contributors",
|
||||
"title": "GitHub Contributors",
|
||||
"description": "GitHub users who have contributed to numerous Electron-related repositories.",
|
||||
"collectionType": "GithubUser",
|
||||
"collection": [
|
||||
{
|
||||
|
@ -2003,6 +2004,5 @@
|
|||
"user": "ruiming",
|
||||
"repos": 3
|
||||
}
|
||||
],
|
||||
"basename": "prolific_github_contributors"
|
||||
]
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"title": "Most-downloaded npm Packages",
|
||||
"slug": "most_downloaded_packages",
|
||||
"title": "Most Downloaded Packages",
|
||||
"description": "Electron-related npm packages that are downloaded a lot.",
|
||||
"collectionType": "Package",
|
||||
"collection": [
|
||||
|
@ -19143,6 +19144,5 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"basename": "most_downloaded_npm_packages"
|
||||
]
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"title": "Prolific Package Authors",
|
||||
"slug": "package_authors",
|
||||
"title": "Package Authors",
|
||||
"description": "npm users who maintain numerous Electron-related packages.",
|
||||
"collectionType": "npmUser",
|
||||
"collection": [
|
||||
|
@ -1587,6 +1588,5 @@
|
|||
"freenode": null,
|
||||
"gravatar": "https://gravatar.com/avatar/98014649279dcef04f67ee307e3b9597?size=200&default=https%3A%2F%2Fcldup.com%2FFIjisumbxl.png"
|
||||
}
|
||||
],
|
||||
"basename": "prolific_package_authors"
|
||||
]
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"title": "Popular Low-level Dependencies",
|
||||
"slug": "package_dependencies",
|
||||
"title": "Package Dependencies",
|
||||
"description": "Electron-related npm packages that are frequently depended on by other npm packages.",
|
||||
"collectionType": "Package",
|
||||
"collection": [
|
||||
|
@ -18540,6 +18541,5 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"basename": "popular_low_level_dependencies"
|
||||
]
|
||||
}
|
|
@ -3,6 +3,7 @@ const expect = require('chai').expect
|
|||
|
||||
describe('Report class', () => {
|
||||
const goodParams = {
|
||||
slug: 'githubbers',
|
||||
title: 'Prolific GitHubbers',
|
||||
description: 'Users on GitHub who work on lots of Electron apps.',
|
||||
collection: ['sally', 'bob', 'haxor'],
|
||||
|
@ -14,6 +15,13 @@ describe('Report class', () => {
|
|||
expect(report.valid).to.equal(true)
|
||||
})
|
||||
|
||||
it('requires a slug', () => {
|
||||
const report = new Report(Object.assign({}, goodParams, {slug: null}))
|
||||
expect(report.valid).to.equal(false)
|
||||
expect(report.validationErrors.length).to.equal(1)
|
||||
expect(report.validationErrors[0].property).to.equal('slug')
|
||||
})
|
||||
|
||||
it('requires a title', () => {
|
||||
const report = new Report(Object.assign({}, goodParams, {title: null}))
|
||||
expect(report.valid).to.equal(false)
|
||||
|
|
Загрузка…
Ссылка в новой задаче