-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[plugin-npm-cli]: Add ability to exclude packages, or ignore specific…
… advisories in `yarn npm audit` (#4356) * [plugin-npm-cli]: Add ability to exclude packages from `yarn npm audit` This patch adds a `--exclude` flag to the `yarn npm audit` command in the `nmp-cli` plugin. This flag can be passed multiple times, and any package listed will be removed from the list of packages audited. * [plugin-npm-cli] Add ability to ignore advisories in `yarn npm audit` This patch adds a `--ignore` flag to `yarn npm audit`, which is an array of ID's to ignore from the audit report. In addition, the ID is presented in the tree output (as well as the JSON). * Version bump * chore: Fix types * [plugin-npm-cli] Add configuration options for --exclude and --ignore Adds configuration options to specify packages to exclude from `yarn npm audit` and to specify advisories to ignore from the results. * Update audit.ts * Update audit.ts * [plugin-npm-cli] Update docs * [plugin-npm-cli] Add support for glob patterns in --exclude and --ignore * [plugin-npm-cli] Add some unit tests and stubs for integration tests Co-authored-by: Maël Nison <[email protected]>
- Loading branch information
1 parent
cc7caeb
commit 0a2261d
Showing
11 changed files
with
392 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
releases: | ||
"@yarnpkg/cli": patch | ||
"@yarnpkg/plugin-npm-cli": patch | ||
|
||
declined: | ||
- "@yarnpkg/plugin-compat" | ||
- "@yarnpkg/plugin-constraints" | ||
- "@yarnpkg/plugin-dlx" | ||
- "@yarnpkg/plugin-essentials" | ||
- "@yarnpkg/plugin-init" | ||
- "@yarnpkg/plugin-interactive-tools" | ||
- "@yarnpkg/plugin-nm" | ||
- "@yarnpkg/plugin-pack" | ||
- "@yarnpkg/plugin-patch" | ||
- "@yarnpkg/plugin-pnp" | ||
- "@yarnpkg/plugin-pnpm" | ||
- "@yarnpkg/plugin-stage" | ||
- "@yarnpkg/plugin-typescript" | ||
- "@yarnpkg/plugin-version" | ||
- "@yarnpkg/plugin-workspace-tools" | ||
- "@yarnpkg/builder" | ||
- "@yarnpkg/core" | ||
- "@yarnpkg/doctor" |
25 changes: 25 additions & 0 deletions
25
packages/acceptance-tests/pkg-tests-specs/sources/commands/npm/audit.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export {}; | ||
|
||
describe(`Commands`, () => { | ||
describe(`npm audit`, () => { | ||
// TODO | ||
// test ignore as flag | ||
// test exclude as flag | ||
// test ignore as config | ||
// test exclude as config | ||
// test combinations | ||
// test json | ||
// test environment | ||
// test severity | ||
// test recursive | ||
test.todo(`it should report vulnerable packages`); | ||
test.todo(`it should exclude packages`); | ||
test.todo(`it should only exclude excluded packages`); | ||
test.todo(`it should ignore advisories`); | ||
test.todo(`it should only ignore ignored advisories`); | ||
test.todo(`it should return results as JSON`); | ||
test.todo(`it should only use the specified environment`); | ||
test.todo(`it should only use the specified severity level`); | ||
test.todo(`it should recurse packages to audit`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.