write the main export
This commit is contained in:
Родитель
8be2fa9642
Коммит
189a22d6cd
|
@ -45,13 +45,13 @@ function finish () {
|
|||
new Report({
|
||||
title: 'Top Dependencies in Apps',
|
||||
description: 'npm packages that are used most often as `dependencies` in Electron apps',
|
||||
collection: topDeps.map(package => pick(package, desirablePackageProps))
|
||||
collection: topDeps.map(pkg => pick(pkg, desirablePackageProps))
|
||||
}).save()
|
||||
|
||||
new Report({
|
||||
title: 'Top Development Dependencies in Apps',
|
||||
description: 'npm packages that are used most often as `devDependencies` in Electron apps',
|
||||
collection: topDevDeps.map(package => pick(package, desirablePackageProps))
|
||||
collection: topDevDeps.map(pkg => pick(pkg, desirablePackageProps))
|
||||
}).save()
|
||||
|
||||
new Report({
|
||||
|
@ -64,7 +64,7 @@ function finish () {
|
|||
title: 'Electron-specific packages most-depended-on by other npm packages',
|
||||
description: 'Electron-specific npm packages that are depended on by other npm packages',
|
||||
collection: electronNpmPackages
|
||||
.map(package => pick(package, desirablePackageProps))
|
||||
.map(pkg => pick(pkg, desirablePackageProps))
|
||||
.map(utils.convertDepListToCount)
|
||||
.sort((a, b) => b.totalDeps - a.totalDeps)
|
||||
.slice(0, MAX_RESULTS)
|
||||
|
@ -74,7 +74,7 @@ function finish () {
|
|||
title: 'Most-downloaded Electron-specific npm Packages',
|
||||
description: 'Electron-specific npm packages that are depended on by other npm packages',
|
||||
collection: electronNpmPackages
|
||||
.map(package => pick(package, desirablePackageProps))
|
||||
.map(pkg => pick(pkg, desirablePackageProps))
|
||||
.map(utils.convertDepListToCount)
|
||||
.sort((a, b) => b.downloadsInLastMonth - a.downloadsInLastMonth)
|
||||
.slice(0, MAX_RESULTS)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const Report = require('./lib/report')
|
||||
const basepath = path.join(__dirname, 'reports')
|
||||
module.exports = fs.readdirSync(basepath)
|
||||
.map(basename => new Report(require(path.join(basepath, basename))))
|
12
lib/utils.js
12
lib/utils.js
|
@ -21,15 +21,15 @@ module.exports = {
|
|||
return tally(cleanNames(names), 'user', 'repos')
|
||||
},
|
||||
|
||||
convertDepListToCount: (package) => {
|
||||
if (Array.isArray(package.dependents)) {
|
||||
package.dependents = package.dependents.length
|
||||
convertDepListToCount: (pkg) => {
|
||||
if (Array.isArray(pkg.dependents)) {
|
||||
pkg.dependents = pkg.dependents.length
|
||||
}
|
||||
|
||||
if (Array.isArray(package.devDependents)) {
|
||||
package.devDependents = package.devDependents.length
|
||||
if (Array.isArray(pkg.devDependents)) {
|
||||
pkg.devDependents = pkg.devDependents.length
|
||||
}
|
||||
|
||||
return package
|
||||
return pkg
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче