| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -78,11 +78,20 @@ into a tarball (b). | |||
| 78 | 78 | ||
| 79 | 79 | * `npm install <folder>`: | |
| 80 | 80 | ||
| 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 | ||
| 84 | 82 | 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 | + ``` | ||
| 86 | 95 | ||
| 87 | 96 | * `npm install <tarball file>`: | |
| 88 | 97 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,11 +18,14 @@ Ping the configured or given npm registry and verify authentication. | |||
| 18 | 18 | If it works it will output something like: | |
| 19 | 19 | ||
| 20 | 20 | ```bash | |
| 21 | - Ping success: {*Details about registry*} | ||
| 21 | + npm notice PING https://registry.npmjs.org/ | ||
| 22 | + npm notice PONG 255ms | ||
| 22 | 23 | ``` | |
| 23 | - otherwise you will get: | ||
| 24 | + otherwise you will get an error: | ||
| 24 | 25 | ```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 | ||
| 26 | 29 | ``` | |
| 27 | 30 | ||
| 28 | 31 | ### Configuration | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,24 +30,25 @@ Workspaces are usually defined via the `workspaces` property of the | |||
| 30 | 30 | { | |
| 31 | 31 | "name": "my-workspaces-powered-project", | |
| 32 | 32 | "workspaces": [ | |
| 33 | - "workspace-a" | ||
| 33 | + "packages/a" | ||
| 34 | 34 | ] | |
| 35 | 35 | } | |
| 36 | 36 | ``` | |
| 37 | 37 | ||
| 38 | 38 | 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 | ||
| 40 | 40 | a `package.json` inside it, defining a Node.js package, e.g: | |
| 41 | 41 | ||
| 42 | 42 | ``` | |
| 43 | 43 | . | |
| 44 | 44 | +-- package.json | |
| 45 | - `-- workspace-a | ||
| 46 | - `-- package.json | ||
| 45 | + `-- packages | ||
| 46 | + +-- a | ||
| 47 | + | `-- package.json | ||
| 47 | 48 | ``` | |
| 48 | 49 | ||
| 49 | 50 | 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 | ||
| 51 | 52 | `node_modules` folder of the current working dir. | |
| 52 | 53 | ||
| 53 | 54 | Below is a post `npm install` example, given that same previous example | |
@@ -56,11 +57,12 @@ structure of files and folders: | |||
| 56 | 57 | ``` | |
| 57 | 58 | . | |
| 58 | 59 | +-- node_modules | |
| 59 | - | `-- workspace-a -> ../workspace-a | ||
| 60 | + | `-- packages/a -> ../packages/a | ||
| 60 | 61 | +-- package-lock.json | |
| 61 | 62 | +-- package.json | |
| 62 | - `-- workspace-a | ||
| 63 | - `-- package.json | ||
| 63 | + `-- packages | ||
| 64 | + +-- a | ||
| 65 | + | `-- package.json | ||
| 64 | 66 | ``` | |
| 65 | 67 | ||
| 66 | 68 | ### Getting started with workspaces | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -211,11 +211,18 @@ <h3 id="description">Description</h3> | |||
| 211 | 211 | </li> | |
| 212 | 212 | <li> | |
| 213 | 213 | <p><code>npm install <folder></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><folder></code> sits inside the root of your project, its dependencies may | ||
| 214 | + <p>If <code><folder></code> sits inside the root of your project, its dependencies will be installed and may | ||
| 217 | 215 | 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><folder></code> sits outside the root of your project, | ||
| 217 | + <em>npm will not install the package dependencies</em> in the directory <code><folder></code>, | ||
| 218 | + but it will create a symlink to <code><folder></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><folder></code> directory, and then install the resulting tarball instead of the <code><folder></code> using <code>npm install <tarball file></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> | ||
| 219 | 226 | </li> | |
| 220 | 227 | <li> | |
| 221 | 228 | <p><code>npm install <tarball file></code>:</p> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -160,7 +160,7 @@ <h3 id="description">Description</h3> | |||
| 160 | 160 | the results to only the paths to the packages named. Note that nested | |
| 161 | 161 | packages will <em>also</em> show the paths to the specified packages. For | |
| 162 | 162 | 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 | ||
| 164 | 164 | └─┬ init-package-json@0.0.4 | |
| 165 | 165 | └── promzard@0.1.5 | |
| 166 | 166 | </code></pre> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -152,10 +152,13 @@ <h2 id="table-of-contents">Table of contents</h2> | |||
| 152 | 152 | <h3 id="description">Description</h3> | |
| 153 | 153 | <p>Ping the configured or given npm registry and verify authentication. | |
| 154 | 154 | 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 | ||
| 156 | 157 | </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 | ||
| 159 | 162 | </code></pre> | |
| 160 | 163 | <h3 id="configuration">Configuration</h3> | |
| 161 | 164 | <!-- raw HTML omitted --> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,7 +149,7 @@ <h2 id="table-of-contents">Table of contents</h2> | |||
| 149 | 149 | <pre lang="bash"><code>npm <command> [args] | |
| 150 | 150 | </code></pre> | |
| 151 | 151 | <h3 id="version">Version</h3> | |
| 152 | - <p>8.5.0</p> | ||
| 152 | + <p>8.5.1</p> | ||
| 153 | 153 | <h3 id="description">Description</h3> | |
| 154 | 154 | <p>npm is the package manager for the Node JavaScript platform. It puts | |
| 155 | 155 | modules in place so that node can find them, and manages dependency | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,30 +164,32 @@ <h3 id="defining-workspaces">Defining workspaces</h3> | |||
| 164 | 164 | <pre lang="json"><code>{ | |
| 165 | 165 | "name": "my-workspaces-powered-project", | |
| 166 | 166 | "workspaces": [ | |
| 167 | - "workspace-a" | ||
| 167 | + "packages/a" | ||
| 168 | 168 | ] | |
| 169 | 169 | } | |
| 170 | 170 | </code></pre> | |
| 171 | 171 | <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 | ||
| 173 | 173 | a <code>package.json</code> inside it, defining a Node.js package, e.g:</p> | |
| 174 | 174 | <pre><code>. | |
| 175 | 175 | +-- package.json | |
| 176 | - `-- workspace-a | ||
| 177 | - `-- package.json | ||
| 176 | + `-- packages | ||
| 177 | + +-- a | ||
| 178 | + | `-- package.json | ||
| 178 | 179 | </code></pre> | |
| 179 | 180 | <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 | ||
| 181 | 182 | <code>node_modules</code> folder of the current working dir.</p> | |
| 182 | 183 | <p>Below is a post <code>npm install</code> example, given that same previous example | |
| 183 | 184 | structure of files and folders:</p> | |
| 184 | 185 | <pre><code>. | |
| 185 | 186 | +-- node_modules | |
| 186 | - | `-- workspace-a -> ../workspace-a | ||
| 187 | + | `-- packages/a -> ../packages/a | ||
| 187 | 188 | +-- package-lock.json | |
| 188 | 189 | +-- package.json | |
| 189 | - `-- workspace-a | ||
| 190 | - `-- package.json | ||
| 190 | + `-- packages | ||
| 191 | + +-- a | ||
| 192 | + | `-- package.json | ||
| 191 | 193 | </code></pre> | |
| 192 | 194 | <h3 id="getting-started-with-workspaces">Getting started with workspaces</h3> | |
| 193 | 195 | <p>You may automate the required steps to define a new workspace using | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,8 @@ class Pkg extends BaseCommand { | |||
| 9 | 9 | 'set <key>=<value> [<key>=<value> ...]', | |
| 10 | 10 | 'get [<key> [<key> ...]]', | |
| 11 | 11 | 'delete <key> [<key> ...]', | |
| 12 | + 'set [<array>[<index>].<key>=<value> ...]', | ||
| 13 | + 'set [<array>[].<key>=<value> ...]', | ||
| 12 | 14 | ] | |
| 13 | 15 | ||
| 14 | 16 | static params = [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,11 +87,23 @@ NOTE: The \fB\-\-production\fP flag has no particular meaning when adding a | |||
| 87 | 87 | . | |
| 88 | 88 | .IP \(bu 2 | |
| 89 | 89 | \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 | ||
| 93 | 91 | 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 | ||
| 95 | 107 | .IP \(bu 2 | |
| 96 | 108 | \fBnpm install <tarball file>\fP: | |
| 97 | 109 | Install a package that is sitting on the filesystem\. Note: if you just | |
| Back | FazBrowse Home | New Git URL |
0 commit comments