@code-pushup/js-packages-plugin
Version:
Code PushUp plugin for JavaScript packages 🛡️
44 lines • 1.5 kB
JavaScript
import { yarnBerryToAuditResult } from './audit-result.js';
import { yarnBerryToOutdatedResult } from './outdated-result.js';
// see https://github.com/yarnpkg/berry/blob/master/packages/plugin-npm-cli/sources/npmAuditTypes.ts#L5
const yarnModernEnvironmentOptions = {
prod: 'production',
dev: 'development',
optional: '',
};
export const yarnModernPackageManager = {
slug: 'yarn-modern',
name: 'Yarn v2+',
command: 'yarn',
icon: 'yarn',
docs: {
homepage: 'https://yarnpkg.com/getting-started',
audit: 'https://yarnpkg.com/cli/npm/audit',
outdated: 'https://github.com/mskelton/yarn-plugin-outdated',
},
audit: {
getCommandArgs: groupDep => {
const environment = yarnModernEnvironmentOptions[groupDep];
return [
'npm',
'audit',
'--recursive',
...(environment ? [`--environment=${environment}`] : []),
'--json',
];
},
supportedDepGroups: ['prod', 'dev'], // Yarn v2 does not support audit for optional dependencies
unifyResult: yarnBerryToAuditResult,
ignoreExitCode: true,
},
outdated: {
commandArgs: [
'outdated',
'--workspace=.', // filter out other packages in case of Yarn workspaces
'--url',
'--json',
],
unifyResult: yarnBerryToOutdatedResult,
},
};
//# sourceMappingURL=yarn-modern.js.map