@code-pushup/js-packages-plugin 0.121.0 → 0.122.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/binding.d.ts +82 -0
- package/src/lib/binding.js +136 -0
- package/src/lib/binding.js.map +1 -0
- package/src/lib/config.js +3 -3
- package/src/lib/config.js.map +1 -1
- package/src/lib/constants.d.ts +2 -0
- package/src/lib/constants.js +2 -0
- package/src/lib/constants.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-pushup/js-packages-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.122.1",
|
|
4
4
|
"description": "Code PushUp plugin for JavaScript packages 🛡️",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-js-packages#readme",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"type": "module",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@code-pushup/models": "0.
|
|
41
|
-
"@code-pushup/utils": "0.
|
|
40
|
+
"@code-pushup/models": "0.122.1",
|
|
41
|
+
"@code-pushup/utils": "0.122.1",
|
|
42
42
|
"ansis": "^3.3.2",
|
|
43
43
|
"build-md": "^0.4.1",
|
|
44
44
|
"semver": "^7.6.0",
|
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,eAAe,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,eAAe,gBAAgB,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { PluginAnswer } from '@code-pushup/models';
|
|
2
|
+
export declare const jsPackagesSetupBinding: {
|
|
3
|
+
slug: string;
|
|
4
|
+
title: string;
|
|
5
|
+
packageName: string;
|
|
6
|
+
isRecommended: typeof isRecommended;
|
|
7
|
+
prompts: (targetDir: string) => Promise<({
|
|
8
|
+
key: string;
|
|
9
|
+
message: string;
|
|
10
|
+
type: "select";
|
|
11
|
+
choices: ({
|
|
12
|
+
readonly name: "npm";
|
|
13
|
+
readonly value: "npm";
|
|
14
|
+
} | {
|
|
15
|
+
readonly name: "yarn (classic)";
|
|
16
|
+
readonly value: "yarn-classic";
|
|
17
|
+
} | {
|
|
18
|
+
readonly name: "yarn (modern)";
|
|
19
|
+
readonly value: "yarn-modern";
|
|
20
|
+
} | {
|
|
21
|
+
readonly name: "pnpm";
|
|
22
|
+
readonly value: "pnpm";
|
|
23
|
+
})[];
|
|
24
|
+
default: "npm" | "yarn-classic" | "yarn-modern" | "pnpm";
|
|
25
|
+
} | {
|
|
26
|
+
key: string;
|
|
27
|
+
message: string;
|
|
28
|
+
type: "checkbox";
|
|
29
|
+
choices: ({
|
|
30
|
+
readonly name: "audit (security vulnerabilities)";
|
|
31
|
+
readonly value: "audit";
|
|
32
|
+
} | {
|
|
33
|
+
readonly name: "outdated (outdated dependencies)";
|
|
34
|
+
readonly value: "outdated";
|
|
35
|
+
})[];
|
|
36
|
+
default: ("audit" | "outdated")[];
|
|
37
|
+
} | {
|
|
38
|
+
key: string;
|
|
39
|
+
message: string;
|
|
40
|
+
type: "checkbox";
|
|
41
|
+
choices: ({
|
|
42
|
+
readonly name: "production";
|
|
43
|
+
readonly value: "prod";
|
|
44
|
+
} | {
|
|
45
|
+
readonly name: "development";
|
|
46
|
+
readonly value: "dev";
|
|
47
|
+
} | {
|
|
48
|
+
readonly name: "optional";
|
|
49
|
+
readonly value: "optional";
|
|
50
|
+
})[];
|
|
51
|
+
default: ("prod" | "dev")[];
|
|
52
|
+
} | {
|
|
53
|
+
key: string;
|
|
54
|
+
message: string;
|
|
55
|
+
type: "confirm";
|
|
56
|
+
default: true;
|
|
57
|
+
choices?: undefined;
|
|
58
|
+
})[]>;
|
|
59
|
+
generateConfig: (answers: Record<string, PluginAnswer>) => {
|
|
60
|
+
categories?: {
|
|
61
|
+
slug: string;
|
|
62
|
+
refs: {
|
|
63
|
+
slug: string;
|
|
64
|
+
weight: number;
|
|
65
|
+
type: "audit" | "group";
|
|
66
|
+
plugin: string;
|
|
67
|
+
}[];
|
|
68
|
+
title: string;
|
|
69
|
+
description?: string | undefined;
|
|
70
|
+
docsUrl?: string | undefined;
|
|
71
|
+
isSkipped?: boolean | undefined;
|
|
72
|
+
scoreTarget?: number | undefined;
|
|
73
|
+
}[] | undefined;
|
|
74
|
+
imports: {
|
|
75
|
+
moduleSpecifier: string;
|
|
76
|
+
defaultImport: string;
|
|
77
|
+
}[];
|
|
78
|
+
pluginInit: string[];
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
declare function isRecommended(targetDir: string): Promise<boolean>;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { answerArray, answerBoolean, answerString, fileExists, singleQuote, } from '@code-pushup/utils';
|
|
4
|
+
import { DEFAULT_CHECKS, DEFAULT_DEPENDENCY_GROUPS, JS_PACKAGES_PLUGIN_SLUG, JS_PACKAGES_PLUGIN_TITLE, } from './constants.js';
|
|
5
|
+
import { derivePackageManager } from './package-managers/derive-package-manager.js';
|
|
6
|
+
const { name: PACKAGE_NAME } = createRequire(import.meta.url)('../../package.json');
|
|
7
|
+
const DEFAULT_PACKAGE_MANAGER = 'npm';
|
|
8
|
+
const PACKAGE_MANAGERS = [
|
|
9
|
+
{ name: 'npm', value: DEFAULT_PACKAGE_MANAGER },
|
|
10
|
+
{ name: 'yarn (classic)', value: 'yarn-classic' },
|
|
11
|
+
{ name: 'yarn (modern)', value: 'yarn-modern' },
|
|
12
|
+
{ name: 'pnpm', value: 'pnpm' },
|
|
13
|
+
];
|
|
14
|
+
const CHECKS = [
|
|
15
|
+
{ name: 'audit (security vulnerabilities)', value: 'audit' },
|
|
16
|
+
{ name: 'outdated (outdated dependencies)', value: 'outdated' },
|
|
17
|
+
];
|
|
18
|
+
const DEPENDENCY_GROUPS = [
|
|
19
|
+
{ name: 'production', value: 'prod' },
|
|
20
|
+
{ name: 'development', value: 'dev' },
|
|
21
|
+
{ name: 'optional', value: 'optional' },
|
|
22
|
+
];
|
|
23
|
+
const CATEGORIES = [
|
|
24
|
+
{
|
|
25
|
+
check: 'audit',
|
|
26
|
+
slug: 'security',
|
|
27
|
+
title: 'Security',
|
|
28
|
+
description: 'Finds known **vulnerabilities** in third-party packages.',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
check: 'outdated',
|
|
32
|
+
slug: 'updates',
|
|
33
|
+
title: 'Updates',
|
|
34
|
+
description: 'Finds **outdated** third-party packages.',
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
export const jsPackagesSetupBinding = {
|
|
38
|
+
slug: JS_PACKAGES_PLUGIN_SLUG,
|
|
39
|
+
title: JS_PACKAGES_PLUGIN_TITLE,
|
|
40
|
+
packageName: PACKAGE_NAME,
|
|
41
|
+
isRecommended,
|
|
42
|
+
prompts: async (targetDir) => {
|
|
43
|
+
const packageManager = await detectPackageManager(targetDir);
|
|
44
|
+
return [
|
|
45
|
+
{
|
|
46
|
+
key: 'js-packages.packageManager',
|
|
47
|
+
message: 'Package manager',
|
|
48
|
+
type: 'select',
|
|
49
|
+
choices: [...PACKAGE_MANAGERS],
|
|
50
|
+
default: packageManager,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
key: 'js-packages.checks',
|
|
54
|
+
message: 'Checks to run',
|
|
55
|
+
type: 'checkbox',
|
|
56
|
+
choices: [...CHECKS],
|
|
57
|
+
default: [...DEFAULT_CHECKS],
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
key: 'js-packages.dependencyGroups',
|
|
61
|
+
message: 'Dependency groups',
|
|
62
|
+
type: 'checkbox',
|
|
63
|
+
choices: [...DEPENDENCY_GROUPS],
|
|
64
|
+
default: [...DEFAULT_DEPENDENCY_GROUPS],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
key: 'js-packages.categories',
|
|
68
|
+
message: 'Add JS packages categories?',
|
|
69
|
+
type: 'confirm',
|
|
70
|
+
default: true,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
},
|
|
74
|
+
generateConfig: (answers) => {
|
|
75
|
+
const options = parseAnswers(answers);
|
|
76
|
+
return {
|
|
77
|
+
imports: [
|
|
78
|
+
{ moduleSpecifier: PACKAGE_NAME, defaultImport: 'jsPackagesPlugin' },
|
|
79
|
+
],
|
|
80
|
+
pluginInit: formatPluginInit(options),
|
|
81
|
+
...(options.categories ? { categories: createCategories(options) } : {}),
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
function parseAnswers(answers) {
|
|
86
|
+
return {
|
|
87
|
+
packageManager: answerString(answers, 'js-packages.packageManager') ||
|
|
88
|
+
DEFAULT_PACKAGE_MANAGER,
|
|
89
|
+
checks: answerArray(answers, 'js-packages.checks'),
|
|
90
|
+
dependencyGroups: answerArray(answers, 'js-packages.dependencyGroups'),
|
|
91
|
+
categories: answerBoolean(answers, 'js-packages.categories'),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function formatPluginInit(options) {
|
|
95
|
+
const { packageManager, checks, dependencyGroups } = options;
|
|
96
|
+
const hasNonDefaultChecks = checks.length > 0 && checks.length < DEFAULT_CHECKS.length;
|
|
97
|
+
const hasNonDefaultDepGroups = dependencyGroups.length !== DEFAULT_DEPENDENCY_GROUPS.length ||
|
|
98
|
+
!DEFAULT_DEPENDENCY_GROUPS.every(g => dependencyGroups.includes(g));
|
|
99
|
+
const body = [
|
|
100
|
+
`packageManager: ${singleQuote(packageManager)},`,
|
|
101
|
+
hasNonDefaultChecks
|
|
102
|
+
? `checks: [${checks.map(singleQuote).join(', ')}],`
|
|
103
|
+
: '',
|
|
104
|
+
hasNonDefaultDepGroups
|
|
105
|
+
? `dependencyGroups: [${dependencyGroups.map(singleQuote).join(', ')}],`
|
|
106
|
+
: '',
|
|
107
|
+
].filter(Boolean);
|
|
108
|
+
return ['await jsPackagesPlugin({', ...body.map(line => ` ${line}`), '}),'];
|
|
109
|
+
}
|
|
110
|
+
function createCategories({ packageManager, checks, }) {
|
|
111
|
+
return CATEGORIES.filter(({ check }) => checks.includes(check)).map(({ check, slug, title, description }) => ({
|
|
112
|
+
slug,
|
|
113
|
+
title,
|
|
114
|
+
description,
|
|
115
|
+
refs: [
|
|
116
|
+
{
|
|
117
|
+
type: 'group',
|
|
118
|
+
plugin: JS_PACKAGES_PLUGIN_SLUG,
|
|
119
|
+
slug: `${packageManager}-${check}`,
|
|
120
|
+
weight: 1,
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
async function isRecommended(targetDir) {
|
|
126
|
+
return fileExists(path.join(targetDir, 'package.json'));
|
|
127
|
+
}
|
|
128
|
+
async function detectPackageManager(targetDir) {
|
|
129
|
+
try {
|
|
130
|
+
return await derivePackageManager(targetDir);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return DEFAULT_PACKAGE_MANAGER;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.js","sourceRoot":"","sources":["../../../src/lib/binding.ts"],"names":[],"mappings":"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} from '@code-pushup/models';
|
|
3
|
-
import { defaultAuditLevelMapping } from './constants.js';
|
|
3
|
+
import { DEFAULT_CHECKS, DEFAULT_DEPENDENCY_GROUPS, defaultAuditLevelMapping, } from './constants.js';
|
|
4
4
|
export const dependencyGroups = ['prod', 'dev', 'optional'];
|
|
5
5
|
const dependencyGroupSchema = z.enum(dependencyGroups);
|
|
6
6
|
const packageCommandSchema = z.enum(['audit', 'outdated']).meta({
|
|
@@ -41,7 +41,7 @@ export const jsPackagesPluginConfigSchema = z
|
|
|
41
41
|
checks: z
|
|
42
42
|
.array(packageCommandSchema)
|
|
43
43
|
.min(1)
|
|
44
|
-
.default([
|
|
44
|
+
.default([...DEFAULT_CHECKS])
|
|
45
45
|
.meta({
|
|
46
46
|
description: 'Package manager commands to be run. Defaults to both audit and outdated.',
|
|
47
47
|
}),
|
|
@@ -51,7 +51,7 @@ export const jsPackagesPluginConfigSchema = z
|
|
|
51
51
|
dependencyGroups: z
|
|
52
52
|
.array(dependencyGroupSchema)
|
|
53
53
|
.min(1)
|
|
54
|
-
.default([
|
|
54
|
+
.default([...DEFAULT_DEPENDENCY_GROUPS]),
|
|
55
55
|
auditLevelMapping: z
|
|
56
56
|
.partialRecord(packageAuditLevelSchema, issueSeveritySchema)
|
|
57
57
|
.default(defaultAuditLevelMapping)
|
package/src/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAEL,mBAAmB,EACnB,wBAAwB,GACzB,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E,OAAO,CAAC,QAAQ,IAAI,wBAAwB,CAAC,QAAQ;QAC/D,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,wBAAwB,CAAC,GAAG;QAChD,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,wBAAwB,CAAC,IAAI;KACpD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC1C,MAAM,CAAC;IACN,MAAM,EAAE,CAAC;SACN,KAAK,CAAC,oBAAoB,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC;SACN,OAAO,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC;SAC5B,IAAI,CAAC;QACJ,WAAW,EACT,0EAA0E;KAC7E,CAAC;IACJ,cAAc,EAAE,sBAAsB;SACnC,IAAI,CAAC,EAAE,WAAW,EAAE,6BAA6B,EAAE,CAAC;SACpD,QAAQ,EAAE;IACb,gBAAgB,EAAE,CAAC;SAChB,KAAK,CAAC,qBAAqB,CAAC;SAC5B,GAAG,CAAC,CAAC,CAAC;SACN,OAAO,CAAC,CAAC,GAAG,yBAAyB,CAAC,CAAC;IAC1C,iBAAiB,EAAE,CAAC;SACjB,aAAa,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;SAC3D,OAAO,CAAC,wBAAwB,CAAC;SACjC,SAAS,CAAC,qBAAqB,CAAC;SAChC,QAAQ,CACP,iIAAiI,CAClI;IACH,eAAe,EAAE,qBAAqB;IACtC,YAAY,EAAE,wBAAwB;CACvC,CAAC;KACD,IAAI,CAAC,EAAE,KAAK,EAAE,wBAAwB,EAAE,CAAC,CAAC"}
|
package/src/lib/constants.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { DependencyGroup, PackageAuditLevel } from './config.js';
|
|
|
3
3
|
import type { DependencyGroupLong } from './runner/outdated/types.js';
|
|
4
4
|
export declare const JS_PACKAGES_PLUGIN_SLUG = "js-packages";
|
|
5
5
|
export declare const JS_PACKAGES_PLUGIN_TITLE = "JS packages";
|
|
6
|
+
export declare const DEFAULT_CHECKS: readonly ["audit", "outdated"];
|
|
7
|
+
export declare const DEFAULT_DEPENDENCY_GROUPS: readonly ["prod", "dev"];
|
|
6
8
|
export declare const defaultAuditLevelMapping: Record<PackageAuditLevel, IssueSeverity>;
|
|
7
9
|
export declare const dependencyGroupToLong: Record<DependencyGroup, DependencyGroupLong>;
|
|
8
10
|
export declare const dependencyGroupWeights: Record<DependencyGroup, number>;
|
package/src/lib/constants.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export const JS_PACKAGES_PLUGIN_SLUG = 'js-packages';
|
|
2
2
|
export const JS_PACKAGES_PLUGIN_TITLE = 'JS packages';
|
|
3
|
+
export const DEFAULT_CHECKS = ['audit', 'outdated'];
|
|
4
|
+
export const DEFAULT_DEPENDENCY_GROUPS = ['prod', 'dev'];
|
|
3
5
|
export const defaultAuditLevelMapping = {
|
|
4
6
|
critical: 'error',
|
|
5
7
|
high: 'error',
|
package/src/lib/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AACrD,MAAM,CAAC,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAEtD,MAAM,CAAC,MAAM,wBAAwB,GAGjC;IACF,QAAQ,EAAE,OAAO;IACjB,IAAI,EAAE,OAAO;IACb,QAAQ,EAAE,SAAS;IACnB,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAG9B;IACF,IAAI,EAAE,cAAc;IACpB,GAAG,EAAE,iBAAiB;IACtB,QAAQ,EAAE,sBAAsB;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAoC;IACrE,wDAAwD;IACxD,IAAI,EAAE,EAAE;IACR,GAAG,EAAE,EAAE;IACP,QAAQ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