deps: upgrade npm to 8.5.1 · nodejs/node@811f04b

25 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -78,11 +78,20 @@ into a tarball (b).

7878
7979

* `npm install <folder>`:

8080
81-

Install the package in the directory as a symlink in the current

82-

project. Its dependencies will be installed before it's linked. If

83-

`<folder>` sits inside the root of your project, its dependencies may

81+

If `<folder>` sits inside the root of your project, its dependencies will be installed and may

8482

be hoisted to the top-level `node_modules` as they would for other

85-

types of dependencies.

83+

types of dependencies. If `<folder>` sits outside the root of your project,

84+

*npm will not install the package dependencies* in the directory `<folder>`,

85+

but it will create a symlink to `<folder>`.

86+
87+

> NOTE: If you want to install the content of a directory like a package from the registry instead of creating a link, you would need to use [`npm pack`](/commands/npm-pack) while in the `<folder>` directory, and then install the resulting tarball instead of the `<folder>` using `npm install <tarball file>`

88+
89+

Example:

90+
91+

```bash

92+

npm install ../../other-package

93+

npm install ./sub-package

94+

```

8695
8796

* `npm install <tarball file>`:

8897
Original file line numberDiff line numberDiff line change

@@ -18,11 +18,14 @@ Ping the configured or given npm registry and verify authentication.

1818

If it works it will output something like:

1919
2020

```bash

21-

Ping success: {*Details about registry*}

21+

npm notice PING https://registry.npmjs.org/

22+

npm notice PONG 255ms

2223

```

23-

otherwise you will get:

24+

otherwise you will get an error:

2425

```bash

25-

Ping error: {*Detail about error}

26+

npm notice PING http://foo.com/

27+

npm ERR! code E404

28+

npm ERR! 404 Not Found - GET http://www.foo.com/-/ping?write=true

2629

```

2730
2831

### Configuration

Original file line numberDiff line numberDiff line change

@@ -30,24 +30,25 @@ Workspaces are usually defined via the `workspaces` property of the

3030

{

3131

"name": "my-workspaces-powered-project",

3232

"workspaces": [

33-

"workspace-a"

33+

"packages/a"

3434

]

3535

}

3636

```

3737
3838

Given the above `package.json` example living at a current working

39-

directory `.` that contains a folder named `workspace-a` that itself contains

39+

directory `.` that contains a folder named `packages/a` that itself contains

4040

a `package.json` inside it, defining a Node.js package, e.g:

4141
4242

```

4343

.

4444

+-- package.json

45-

`-- workspace-a

46-

`-- package.json

45+

`-- packages

46+

+-- a

47+

| `-- package.json

4748

```

4849
4950

The expected result once running `npm install` in this current working

50-

directory `.` is that the folder `workspace-a` will get symlinked to the

51+

directory `.` is that the folder `packages/a` will get symlinked to the

5152

`node_modules` folder of the current working dir.

5253
5354

Below is a post `npm install` example, given that same previous example

@@ -56,11 +57,12 @@ structure of files and folders:

5657

```

5758

.

5859

+-- node_modules

59-

| `-- workspace-a -> ../workspace-a

60+

| `-- packages/a -> ../packages/a

6061

+-- package-lock.json

6162

+-- package.json

62-

`-- workspace-a

63-

`-- package.json

63+

`-- packages

64+

+-- a

65+

| `-- package.json

6466

```

6567
6668

### Getting started with workspaces

Original file line numberDiff line numberDiff line change

@@ -211,11 +211,18 @@ <h3 id="description">Description</h3>

211211

</li>

212212

<li>

213213

<p><code>npm install &lt;folder&gt;</code>:</p>

214-

<p>Install the package in the directory as a symlink in the current

215-

project. Its dependencies will be installed before it's linked. If

216-

<code>&lt;folder&gt;</code> sits inside the root of your project, its dependencies may

214+

<p>If <code>&lt;folder&gt;</code> sits inside the root of your project, its dependencies will be installed and may

217215

be hoisted to the top-level <code>node_modules</code> as they would for other

218-

types of dependencies.</p>

216+

types of dependencies. If <code>&lt;folder&gt;</code> sits outside the root of your project,

217+

<em>npm will not install the package dependencies</em> in the directory <code>&lt;folder&gt;</code>,

218+

but it will create a symlink to <code>&lt;folder&gt;</code>.</p>

219+

<blockquote>

220+

<p>NOTE: If you want to install the content of a directory like a package from the registry instead of creating a link, you would need to use <a href="../commands/npm-pack.html"><code>npm pack</code></a> while in the <code>&lt;folder&gt;</code> directory, and then install the resulting tarball instead of the <code>&lt;folder&gt;</code> using <code>npm install &lt;tarball file&gt;</code></p>

221+

</blockquote>

222+

<p>Example:</p>

223+

<pre lang="bash"><code>npm install ../../other-package

224+

npm install ./sub-package

225+

</code></pre>

219226

</li>

220227

<li>

221228

<p><code>npm install &lt;tarball file&gt;</code>:</p>

Original file line numberDiff line numberDiff line change

@@ -160,7 +160,7 @@ <h3 id="description">Description</h3>

160160

the results to only the paths to the packages named. Note that nested

161161

packages will <em>also</em> show the paths to the specified packages. For

162162

example, running <code>npm ls promzard</code> in npm's source tree will show:</p>

163-

<pre lang="bash"><code>npm@8.5.0 /path/to/npm

163+

<pre lang="bash"><code>npm@8.5.1 /path/to/npm

164164

└─┬ init-package-json@0.0.4

165165

└── promzard@0.1.5

166166

</code></pre>

Original file line numberDiff line numberDiff line change

@@ -152,10 +152,13 @@ <h2 id="table-of-contents">Table of contents</h2>

152152

<h3 id="description">Description</h3>

153153

<p>Ping the configured or given npm registry and verify authentication.

154154

If it works it will output something like:</p>

155-

<pre lang="bash"><code>Ping success: {*Details about registry*}

155+

<pre lang="bash"><code>npm notice PING https://registry.npmjs.org/

156+

npm notice PONG 255ms

156157

</code></pre>

157-

<p>otherwise you will get:</p>

158-

<pre lang="bash"><code>Ping error: {*Detail about error}

158+

<p>otherwise you will get an error:</p>

159+

<pre lang="bash"><code>npm notice PING http://foo.com/

160+

npm ERR! code E404

161+

npm ERR! 404 Not Found - GET http://www.foo.com/-/ping?write=true

159162

</code></pre>

160163

<h3 id="configuration">Configuration</h3>

161164

<!-- raw HTML omitted -->

Original file line numberDiff line numberDiff line change

@@ -149,7 +149,7 @@ <h2 id="table-of-contents">Table of contents</h2>

149149

<pre lang="bash"><code>npm &lt;command&gt; [args]

150150

</code></pre>

151151

<h3 id="version">Version</h3>

152-

<p>8.5.0</p>

152+

<p>8.5.1</p>

153153

<h3 id="description">Description</h3>

154154

<p>npm is the package manager for the Node JavaScript platform. It puts

155155

modules in place so that node can find them, and manages dependency

Original file line numberDiff line numberDiff line change

@@ -164,30 +164,32 @@ <h3 id="defining-workspaces">Defining workspaces</h3>

164164

<pre lang="json"><code>{

165165

"name": "my-workspaces-powered-project",

166166

"workspaces": [

167-

"workspace-a"

167+

"packages/a"

168168

]

169169

}

170170

</code></pre>

171171

<p>Given the above <code>package.json</code> example living at a current working

172-

directory <code>.</code> that contains a folder named <code>workspace-a</code> that itself contains

172+

directory <code>.</code> that contains a folder named <code>packages/a</code> that itself contains

173173

a <code>package.json</code> inside it, defining a Node.js package, e.g:</p>

174174

<pre><code>.

175175

+-- package.json

176-

`-- workspace-a

177-

`-- package.json

176+

`-- packages

177+

+-- a

178+

| `-- package.json

178179

</code></pre>

179180

<p>The expected result once running <code>npm install</code> in this current working

180-

directory <code>.</code> is that the folder <code>workspace-a</code> will get symlinked to the

181+

directory <code>.</code> is that the folder <code>packages/a</code> will get symlinked to the

181182

<code>node_modules</code> folder of the current working dir.</p>

182183

<p>Below is a post <code>npm install</code> example, given that same previous example

183184

structure of files and folders:</p>

184185

<pre><code>.

185186

+-- node_modules

186-

| `-- workspace-a -&gt; ../workspace-a

187+

| `-- packages/a -&gt; ../packages/a

187188

+-- package-lock.json

188189

+-- package.json

189-

`-- workspace-a

190-

`-- package.json

190+

`-- packages

191+

+-- a

192+

| `-- package.json

191193

</code></pre>

192194

<h3 id="getting-started-with-workspaces">Getting started with workspaces</h3>

193195

<p>You may automate the required steps to define a new workspace using

Original file line numberDiff line numberDiff line change

@@ -9,6 +9,8 @@ class Pkg extends BaseCommand {

99

'set <key>=<value> [<key>=<value> ...]',

1010

'get [<key> [<key> ...]]',

1111

'delete <key> [<key> ...]',

12+

'set [<array>[<index>].<key>=<value> ...]',

13+

'set [<array>[].<key>=<value> ...]',

1214

]

1315
1416

static params = [

Original file line numberDiff line numberDiff line change

@@ -87,11 +87,23 @@ NOTE: The \fB\-\-production\fP flag has no particular meaning when adding a

8787

.

8888

.IP \(bu 2

8989

\fBnpm install <folder>\fP:

90-

Install the package in the directory as a symlink in the current

91-

project\. Its dependencies will be installed before it's linked\. If

92-

\fB<folder>\fP sits inside the root of your project, its dependencies may

90+

If \fB<folder>\fP sits inside the root of your project, its dependencies will be installed and may

9391

be hoisted to the top\-level \fBnode_modules\fP as they would for other

94-

types of dependencies\.

92+

types of dependencies\. If \fB<folder>\fP sits outside the root of your project,

93+

\fInpm will not install the package dependencies\fR in the directory \fB<folder>\fP,

94+

but it will create a symlink to \fB<folder>\fP\|\.

95+

.QP

96+

NOTE: If you want to install the content of a directory like a package from the registry instead of creating a link, you would need to use npm help \fBpack\fP while in the \fB<folder>\fP directory, and then install the resulting tarball instead of the \fB<folder>\fP using \fBnpm install <tarball file>\fP

97+
98+

.

99+

Example:

100+

.P

101+

.RS 2

102+

.nf

103+

npm install \.\./\.\./other\-package

104+

npm install \./sub\-package

105+

.fi

106+

.RE

95107

.IP \(bu 2

96108

\fBnpm install <tarball file>\fP:

97109

Install a package that is sitting on the filesystem\. Note: if you just