-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workspaces support to `npm fund` - Add ability to filter fund results to a specific set of workspaces - Added tests and docs Fixes: npm/statusboard#301
- Loading branch information
Showing
4 changed files
with
179 additions
and
3 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 |
---|---|---|
|
@@ -8,6 +8,7 @@ description: Retrieve funding information | |
|
||
```bash | ||
npm fund [<pkg>] | ||
npm fund [-w <workspace-name>] | ||
``` | ||
|
||
### Description | ||
|
@@ -24,6 +25,43 @@ The list will avoid duplicated entries and will stack all packages that | |
share the same url as a single entry. Thus, the list does not have the same | ||
shape of the output from `npm ls`. | ||
|
||
#### Example | ||
|
||
### Workspaces support | ||
|
||
It's possible to filter the results to only include a single workspace and its | ||
dependencies using the `workspace` config option. | ||
|
||
#### Example: | ||
|
||
Here's an example running `npm fund` in a project with a configured | ||
workspace `a`: | ||
|
||
```bash | ||
$ npm fund | ||
[email protected] | ||
+-- https://example.com/a | ||
| | `-- [email protected] | ||
| `-- https://example.com/maintainer | ||
| `-- [email protected] | ||
+-- https://example.com/npmcli-funding | ||
| `-- @npmcli/test-funding | ||
`-- https://example.com/org | ||
`-- [email protected] | ||
``` | ||
|
||
And here is an example of the expected result when filtering only by | ||
a specific workspace `a` in the same project: | ||
|
||
```bash | ||
$ npm fund -w a | ||
[email protected] | ||
`-- https://example.com/a | ||
| `-- [email protected] | ||
`-- https://example.com/maintainer | ||
`-- [email protected] | ||
``` | ||
|
||
### Configuration | ||
|
||
#### browser | ||
|
@@ -48,6 +86,21 @@ Show information in JSON format. | |
Whether to represent the tree structure using unicode characters. | ||
Set it to `false` in order to use all-ansi output. | ||
|
||
#### workspace | ||
|
||
* Alias: `-w` | ||
* Type: Array | ||
* Default: `[]` | ||
|
||
Enable filtering funding info results for `npm fund` to dependencies of a | ||
set of configured **workspaces**. | ||
|
||
Valid values for the `workspace` config are either: | ||
- Workspace names | ||
- Path to a workspace directory | ||
- Path to a parent workspace directory (will result to selecting all of the | ||
children workspaces) | ||
|
||
#### which | ||
|
||
* Type: Number | ||
|
@@ -61,3 +114,4 @@ If there are multiple funding sources, which 1-indexed source URL to open. | |
* [npm docs](/commands/npm-docs) | ||
* [npm ls](/commands/npm-ls) | ||
* [npm config](/commands/npm-config) | ||
* [npm workspaces](/using-npm/workspaces) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,3 +92,23 @@ [email protected] | |
` | ||
|
||
exports[`test/lib/fund.js TAP workspaces filter funding info by a specific workspace > should display only filtered workspace name and its deps 1`] = ` | ||
[email protected] | ||
\`-- https://example.com/a | ||
| \`-- [email protected] | ||
\`-- http://example.com/c | ||
\`-- [email protected] | ||
` | ||
|
||
exports[`test/lib/fund.js TAP workspaces filter funding info by a specific workspace > should display only filtered workspace path and its deps 1`] = ` | ||
[email protected] | ||
\`-- https://example.com/a | ||
| \`-- [email protected] | ||
\`-- http://example.com/c | ||
\`-- [email protected] | ||
` |
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