Skip to content

Commit

Permalink
chore(docs): Fixed example typo & code style in npm-scripts.md
Browse files Browse the repository at this point in the history
PR-URL: #1089
Credit: @NNNaix
Close: #1089
Reviewed-by: @ruyadorno
  • Loading branch information
Naix Geng authored and ruyadorno committed May 1, 2020
1 parent 33ec41f commit d16a34f
Showing 1 changed file with 28 additions and 14 deletions.
42 changes: 28 additions & 14 deletions docs/content/using-npm/scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,15 @@ suites, then those executables will be added to the `PATH` for
executing the scripts. So, if your package.json has this:

```json
{ "name" : "foo"
, "dependencies" : { "bar" : "0.1.x" }
, "scripts": { "start" : "bar ./test" } }
{
"name" : "foo",
"dependencies" : {
"bar" : "0.1.x"
},
"scripts": {
"start" : "bar ./test"
}
}
```

then you could run `npm start` to execute the `bar` script, which is
Expand Down Expand Up @@ -176,9 +182,15 @@ there is a config param of `<name>[@<version>]:<key>`. For example,
if the package.json has this:

```json
{ "name" : "foo"
, "config" : { "port" : "8080" }
, "scripts" : { "start" : "node server.js" } }
{
"name" : "foo",
"config" : {
"port" : "8080"
},
"scripts" : {
"start" : "node server.js"
}
}
```

and the server.js is this:
Expand Down Expand Up @@ -213,10 +225,11 @@ process.env.npm_package_scripts_install === "foo.js"
For example, if your package.json contains this:

```json
{ "scripts" :
{ "install" : "scripts/install.js"
, "postinstall" : "scripts/postinstall.js"
, "uninstall" : "scripts/uninstall.js"
{
"scripts" : {
"install" : "scripts/install.js",
"postinstall" : "scripts/install.js",
"uninstall" : "scripts/uninstall.js"
}
}
```
Expand All @@ -232,10 +245,11 @@ If you want to run a make command, you can do so. This works just
fine:

```json
{ "scripts" :
{ "preinstall" : "./configure"
, "install" : "make && make install"
, "test" : "make test"
{
"scripts" : {
"preinstall" : "./configure",
"install" : "make && make install",
"test" : "make test"
}
}
```
Expand Down

0 comments on commit d16a34f

Please sign in to comment.