Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
doc: Make "JSON" snippets valid JSON
Browse files Browse the repository at this point in the history
Documentation for `package.json`
[states](https://docs.npmjs.com/files/package.json) that it "must be actual
JSON, not just a JavaScript object literal".

PR-URL: #11196
Credit: @s100
Reviewed-By: @iarna
  • Loading branch information
s100 authored and iarna committed Jan 28, 2016
1 parent 61daa6a commit f427934
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions doc/cli/npm-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@ on dependencies, `dep1` (`dep2`, .. etc.). The published versions of `dep1` are

```
{
dist-tags: { latest: "1.2.2" },
versions: { "1.2.2",
"1.2.1",
"1.2.0",
"1.1.2",
"1.1.1",
"1.0.0",
"0.4.1",
"0.4.0",
"0.2.0"
"dist-tags": { "latest": "1.2.2" },
"versions": {
"1.2.2",
"1.2.1",
"1.2.0",
"1.1.2",
"1.1.1",
"1.0.0",
"0.4.1",
"0.4.0",
"0.2.0"
}
}
```
Expand All @@ -63,8 +64,8 @@ on dependencies, `dep1` (`dep2`, .. etc.). The published versions of `dep1` are
If `app`'s `package.json` contains:

```
dependencies: {
dep1: "^1.1.1"
"dependencies": {
"dep1": "^1.1.1"
}
```

Expand All @@ -76,8 +77,8 @@ Then `npm update` will install `dep1@1.2.2`, because `1.2.2` is `latest` and
However, if `app`'s `package.json` contains:

```
dependencies: {
dep1: "~1.1.1"
"dependencies": {
"dep1": "~1.1.1"
}
```

Expand All @@ -91,8 +92,8 @@ which is `1.1.2`.
Suppose `app` has a caret dependency on a version below `1.0.0`, for example:

```
dependencies: {
dep1: "^0.2.0"
"dependencies": {
"dep1": "^0.2.0"
}
```

Expand All @@ -102,8 +103,8 @@ versions which satisfy `^0.2.0`.
If the dependence were on `^0.4.0`:

```
dependencies: {
dep1: "^0.4.0"
"dependencies": {
"dep1": "^0.4.0"
}
```

Expand All @@ -118,17 +119,17 @@ the minimum required dependency in `package.json`, you can use
`package.json` contains:

```
dependencies: {
dep1: "^1.1.1"
"dependencies": {
"dep1": "^1.1.1"
}
```

Then `npm update --save` will install `dep1@1.2.2` (i.e., `latest`),
and `package.json` will be modified:

```
dependencies: {
dep1: "^1.2.2"
"dependencies": {
"dep1": "^1.2.2"
}
```

Expand Down

0 comments on commit f427934

Please sign in to comment.