| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1765e32 commit 608d0e1
28 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,21 @@ | |||
| 1 | + ## v7.13.0 (2021-05-13) | ||
| 2 | + | ||
| 3 | + * [`076420c14`](https://github.com/npm/cli/commit/076420c149d097056f687e44e21744b743b86e4e) | ||
| 4 | + [#3231](https://github.com/npm/cli/issues/3231) | ||
| 5 | + feat(publish): add workspace support | ||
| 6 | + ([@wraithgar](https://github.com/wraithgar)) | ||
| 7 | + * [`370b36a36`](https://github.com/npm/cli/commit/370b36a36ca226840761e4214cbccaf2a1a90e3c) | ||
| 8 | + [#3241](https://github.com/npm/cli/issues/3241) | ||
| 9 | + feat(fund): add workspaces support | ||
| 10 | + ([@ruyadorno](https://github.com/ruyadorno)) | ||
| 11 | + | ||
| 12 | + ### DEPENDENCIES | ||
| 13 | + | ||
| 14 | + * [`0c18e4f77`](https://github.com/npm/cli/commit/0c18e4f774562fa054fedf323bea25805ebf39b3) | ||
| 15 | + `@npmcli/arborist@2.5.0` | ||
| 16 | + * [`b551c6811`](https://github.com/npm/cli/commit/b551c6811251dbc901f47fea3c137f93e205a9e4) | ||
| 17 | + `libnpmfund@1.1.0` | ||
| 18 | + | ||
| 1 | 19 | ## v7.12.1 (2021-05-10) | |
| 2 | 20 | ||
| 3 | 21 | ### BUG FIXES | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,7 @@ description: Retrieve funding information | |||
| 8 | 8 | ||
| 9 | 9 | ```bash | |
| 10 | 10 | npm fund [<pkg>] | |
| 11 | + npm fund [-w <workspace-name>] | ||
| 11 | 12 | ``` | |
| 12 | 13 | ||
| 13 | 14 | ### Description | |
@@ -24,6 +25,43 @@ The list will avoid duplicated entries and will stack all packages that | |||
| 24 | 25 | share the same url as a single entry. Thus, the list does not have the same | |
| 25 | 26 | shape of the output from `npm ls`. | |
| 26 | 27 | ||
| 28 | + #### Example | ||
| 29 | + | ||
| 30 | + ### Workspaces support | ||
| 31 | + | ||
| 32 | + It's possible to filter the results to only include a single workspace and its | ||
| 33 | + dependencies using the `workspace` config option. | ||
| 34 | + | ||
| 35 | + #### Example: | ||
| 36 | + | ||
| 37 | + Here's an example running `npm fund` in a project with a configured | ||
| 38 | + workspace `a`: | ||
| 39 | + | ||
| 40 | + ```bash | ||
| 41 | + $ npm fund | ||
| 42 | + test-workspaces-fund@1.0.0 | ||
| 43 | + +-- https://example.com/a | ||
| 44 | + | | `-- a@1.0.0 | ||
| 45 | + | `-- https://example.com/maintainer | ||
| 46 | + | `-- foo@1.0.0 | ||
| 47 | + +-- https://example.com/npmcli-funding | ||
| 48 | + | `-- @npmcli/test-funding | ||
| 49 | + `-- https://example.com/org | ||
| 50 | + `-- bar@2.0.0 | ||
| 51 | + ``` | ||
| 52 | + | ||
| 53 | + And here is an example of the expected result when filtering only by | ||
| 54 | + a specific workspace `a` in the same project: | ||
| 55 | + | ||
| 56 | + ```bash | ||
| 57 | + $ npm fund -w a | ||
| 58 | + test-workspaces-fund@1.0.0 | ||
| 59 | + `-- https://example.com/a | ||
| 60 | + | `-- a@1.0.0 | ||
| 61 | + `-- https://example.com/maintainer | ||
| 62 | + `-- foo@2.0.0 | ||
| 63 | + ``` | ||
| 64 | + | ||
| 27 | 65 | ### Configuration | |
| 28 | 66 | ||
| 29 | 67 | #### browser | |
@@ -48,6 +86,23 @@ Show information in JSON format. | |||
| 48 | 86 | Whether to represent the tree structure using unicode characters. | |
| 49 | 87 | Set it to `false` in order to use all-ansi output. | |
| 50 | 88 | ||
| 89 | + #### `workspace` | ||
| 90 | + | ||
| 91 | + * Default: | ||
| 92 | + * Type: String (can be set multiple times) | ||
| 93 | + | ||
| 94 | + Enable running a command in the context of the configured workspaces of the | ||
| 95 | + current project while filtering by running only the workspaces defined by | ||
| 96 | + this configuration option. | ||
| 97 | + | ||
| 98 | + Valid values for the `workspace` config are either: | ||
| 99 | + * Workspace names | ||
| 100 | + * Path to a workspace directory | ||
| 101 | + * Path to a parent workspace directory (will result to selecting all of the | ||
| 102 | + nested workspaces) | ||
| 103 | + | ||
| 104 | + This value is not exported to the environment for child processes. | ||
| 105 | + | ||
| 51 | 106 | #### which | |
| 52 | 107 | ||
| 53 | 108 | * Type: Number | |
@@ -61,3 +116,4 @@ If there are multiple funding sources, which 1-indexed source URL to open. | |||
| 61 | 116 | * [npm docs](/commands/npm-docs) | |
| 62 | 117 | * [npm ls](/commands/npm-ls) | |
| 63 | 118 | * [npm config](/commands/npm-config) | |
| 119 | + * [npm workspaces](/using-npm/workspaces) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,13 @@ by specifying a different default registry or using a | |||
| 47 | 47 | actually publishing to the registry. Reports the details of what would | |
| 48 | 48 | have been published. | |
| 49 | 49 | ||
| 50 | + * `[--workspaces]`: Enables workspace context while publishing. All | ||
| 51 | + workspace packages will be published. | ||
| 52 | + | ||
| 53 | + * `[--workspace]`: Enables workspaces context and limits results to only | ||
| 54 | + those specified by this config item. Only the packages in the | ||
| 55 | + workspaces given will be published. | ||
| 56 | + | ||
| 50 | 57 | The publish will fail if the package name and version combination already | |
| 51 | 58 | exists in the specified registry. | |
| 52 | 59 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -146,6 +146,7 @@ <h2 id="table-of-contents">Table of contents</h2> | |||
| 146 | 146 | ||
| 147 | 147 | <div id="_content"><h3 id="synopsis">Synopsis</h3> | |
| 148 | 148 | <pre lang="bash"><code>npm fund [<pkg>] | |
| 149 | + npm fund [-w <workspace-name>] | ||
| 149 | 150 | </code></pre> | |
| 150 | 151 | <h3 id="description">Description</h3> | |
| 151 | 152 | <p>This command retrieves information on how to fund the dependencies of a | |
@@ -158,6 +159,33 @@ <h3 id="description">Description</h3> | |||
| 158 | 159 | <p>The list will avoid duplicated entries and will stack all packages that | |
| 159 | 160 | share the same url as a single entry. Thus, the list does not have the same | |
| 160 | 161 | shape of the output from <code>npm ls</code>.</p> | |
| 162 | + <h4 id="example">Example</h4> | ||
| 163 | + <h3 id="workspaces-support">Workspaces support</h3> | ||
| 164 | + <p>It’s possible to filter the results to only include a single workspace and its | ||
| 165 | + dependencies using the <code>workspace</code> config option.</p> | ||
| 166 | + <h4 id="example2">Example:</h4> | ||
| 167 | + <p>Here’s an example running <code>npm fund</code> in a project with a configured | ||
| 168 | + workspace <code>a</code>:</p> | ||
| 169 | + <pre lang="bash"><code>$ npm fund | ||
| 170 | + test-workspaces-fund@1.0.0 | ||
| 171 | + +-- https://example.com/a | ||
| 172 | + | | `-- a@1.0.0 | ||
| 173 | + | `-- https://example.com/maintainer | ||
| 174 | + | `-- foo@1.0.0 | ||
| 175 | + +-- https://example.com/npmcli-funding | ||
| 176 | + | `-- @npmcli/test-funding | ||
| 177 | + `-- https://example.com/org | ||
| 178 | + `-- bar@2.0.0 | ||
| 179 | + </code></pre> | ||
| 180 | + <p>And here is an example of the expected result when filtering only by | ||
| 181 | + a specific workspace <code>a</code> in the same project:</p> | ||
| 182 | + <pre lang="bash"><code>$ npm fund -w a | ||
| 183 | + test-workspaces-fund@1.0.0 | ||
| 184 | + `-- https://example.com/a | ||
| 185 | + | `-- a@1.0.0 | ||
| 186 | + `-- https://example.com/maintainer | ||
| 187 | + `-- foo@2.0.0 | ||
| 188 | + </code></pre> | ||
| 161 | 189 | <h3 id="configuration">Configuration</h3> | |
| 162 | 190 | <h4 id="browser">browser</h4> | |
| 163 | 191 | <ul> | |
@@ -178,6 +206,22 @@ <h4 id="unicode">unicode</h4> | |||
| 178 | 206 | </ul> | |
| 179 | 207 | <p>Whether to represent the tree structure using unicode characters. | |
| 180 | 208 | Set it to <code>false</code> in order to use all-ansi output.</p> | |
| 209 | + <h4 id="workspace"><code>workspace</code></h4> | ||
| 210 | + <ul> | ||
| 211 | + <li>Default:</li> | ||
| 212 | + <li>Type: String (can be set multiple times)</li> | ||
| 213 | + </ul> | ||
| 214 | + <p>Enable running a command in the context of the configured workspaces of the | ||
| 215 | + current project while filtering by running only the workspaces defined by | ||
| 216 | + this configuration option.</p> | ||
| 217 | + <p>Valid values for the <code>workspace</code> config are either:</p> | ||
| 218 | + <ul> | ||
| 219 | + <li>Workspace names</li> | ||
| 220 | + <li>Path to a workspace directory</li> | ||
| 221 | + <li>Path to a parent workspace directory (will result to selecting all of the | ||
| 222 | + nested workspaces)</li> | ||
| 223 | + </ul> | ||
| 224 | + <p>This value is not exported to the environment for child processes.</p> | ||
| 181 | 225 | <h4 id="which">which</h4> | |
| 182 | 226 | <ul> | |
| 183 | 227 | <li>Type: Number</li> | |
@@ -190,6 +234,7 @@ <h2 id="see-also">See Also</h2> | |||
| 190 | 234 | <li><a href="../commands/npm-docs.html">npm docs</a></li> | |
| 191 | 235 | <li><a href="../commands/npm-ls.html">npm ls</a></li> | |
| 192 | 236 | <li><a href="../commands/npm-config.html">npm config</a></li> | |
| 237 | + <li><a href="../using-npm/workspaces.html">npm workspaces</a></li> | ||
| 193 | 238 | </ul> | |
| 194 | 239 | </div> | |
| 195 | 240 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -159,7 +159,7 @@ <h3 id="description">Description</h3> | |||
| 159 | 159 | the results to only the paths to the packages named. Note that nested | |
| 160 | 160 | packages will <em>also</em> show the paths to the specified packages. For | |
| 161 | 161 | example, running <code>npm ls promzard</code> in npm’s source tree will show:</p> | |
| 162 | - <pre lang="bash"><code>npm@7.12.1 /path/to/npm | ||
| 162 | + <pre lang="bash"><code>npm@7.13.0 /path/to/npm | ||
| 163 | 163 | └─┬ init-package-json@0.0.4 | |
| 164 | 164 | └── promzard@0.1.5 | |
| 165 | 165 | </code></pre> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -188,6 +188,15 @@ <h3 id="description">Description</h3> | |||
| 188 | 188 | actually publishing to the registry. Reports the details of what would | |
| 189 | 189 | have been published.</p> | |
| 190 | 190 | </li> | |
| 191 | + <li> | ||
| 192 | + <p><code>[--workspaces]</code>: Enables workspace context while publishing. All | ||
| 193 | + workspace packages will be published.</p> | ||
| 194 | + </li> | ||
| 195 | + <li> | ||
| 196 | + <p><code>[--workspace]</code>: Enables workspaces context and limits results to only | ||
| 197 | + those specified by this config item. Only the packages in the | ||
| 198 | + workspaces given will be published.</p> | ||
| 199 | + </li> | ||
| 191 | 200 | </ul> | |
| 192 | 201 | <p>The publish will fail if the package name and version combination already | |
| 193 | 202 | exists in the specified registry.</p> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2> | |||
| 148 | 148 | <pre lang="bash"><code>npm <command> [args] | |
| 149 | 149 | </code></pre> | |
| 150 | 150 | <h3 id="version">Version</h3> | |
| 151 | - <p>7.12.1</p> | ||
| 151 | + <p>7.13.0</p> | ||
| 152 | 152 | <h3 id="description">Description</h3> | |
| 153 | 153 | <p>npm is the package manager for the Node JavaScript platform. It puts | |
| 154 | 154 | modules in place so that node can find them, and manages dependency | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,15 +13,14 @@ const { | |||
| 13 | 13 | ||
| 14 | 14 | const completion = require('./utils/completion/installed-deep.js') | |
| 15 | 15 | const openUrl = require('./utils/open-url.js') | |
| 16 | + const ArboristWorkspaceCmd = require('./workspaces/arborist-cmd.js') | ||
| 16 | 17 | ||
| 17 | 18 | const getPrintableName = ({ name, version }) => { | |
| 18 | 19 | const printableVersion = version ? `@${version}` : '' | |
| 19 | 20 | return `${name}${printableVersion}` | |
| 20 | 21 | } | |
| 21 | 22 | ||
| 22 | - const BaseCommand = require('./base-command.js') | ||
| 23 | - | ||
| 24 | - class Fund extends BaseCommand { | ||
| 23 | + class Fund extends ArboristWorkspaceCmd { | ||
| 25 | 24 | /* istanbul ignore next - see test/lib/load-all-commands.js */ | |
| 26 | 25 | static get description () { | |
| 27 | 26 | return 'Retrieve funding information' | |
@@ -38,6 +37,7 @@ class Fund extends BaseCommand { | |||
| 38 | 37 | 'json', | |
| 39 | 38 | 'browser', | |
| 40 | 39 | 'unicode', | |
| 40 | + 'workspace', | ||
| 41 | 41 | 'which', | |
| 42 | 42 | ] | |
| 43 | 43 | } | |
@@ -92,10 +92,16 @@ class Fund extends BaseCommand { | |||
| 92 | 92 | return | |
| 93 | 93 | } | |
| 94 | 94 | ||
| 95 | + const fundingInfo = getFundingInfo(tree, { | ||
| 96 | + ...this.flatOptions, | ||
| 97 | + log: this.npm.log, | ||
| 98 | + workspaces: this.workspaces, | ||
| 99 | + }) | ||
| 100 | + | ||
| 95 | 101 | if (this.npm.config.get('json')) | |
| 96 | - this.npm.output(this.printJSON(getFundingInfo(tree))) | ||
| 102 | + this.npm.output(this.printJSON(fundingInfo)) | ||
| 97 | 103 | else | |
| 98 | - this.npm.output(this.printHuman(getFundingInfo(tree))) | ||
| 104 | + this.npm.output(this.printHuman(fundingInfo)) | ||
| 99 | 105 | } | |
| 100 | 106 | ||
| 101 | 107 | printJSON (fundingInfo) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments