-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm-script-research.js
42 lines (35 loc) · 1 KB
/
npm-script-research.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
const Promise = require("bluebird");
const R = require("ramda");
async function summarize()
{
const installScriptTypes = [
"preinstall",
"install",
"postinstall",
"prepublish",
"preprepare",
"prepare",
"postprepare",
"gyp",
];
const aggregations = await Promise.map(installScriptTypes, async (scriptType) =>
{
const query = {
where: { NOT: { state: { equals: 'disabled' } } },
_count: { name: true },
};
query.where[scriptType] = { equals: true };
const result = await prisma.npm_install_scripts_checker.aggregate(query);
const lens = R.lensPath(["_count", "name"]);
return [scriptType, R.view(lens, result)];
})
return R.fromPairs(aggregations);
}
async function npmScriptResearch()
{
const result = await summarize();
console.log(result);
}
npmScriptResearch();