mirror of
https://github.com/nodejs/node.git
synced 2025-05-13 16:39:33 +00:00

PR-URL: https://github.com/nodejs/node/pull/38030 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruy Adorno <ruyadorno@github.com>
48 lines
885 B
Markdown
48 lines
885 B
Markdown
---
|
|
title: npm-set-script
|
|
section: 1
|
|
description: Set tasks in the scripts section of package.json
|
|
---
|
|
|
|
### Synopsis
|
|
An npm command that lets you create a task in the `scripts` section of the `package.json`.
|
|
|
|
```bash
|
|
npm set-script [<script>] [<command>]
|
|
```
|
|
|
|
|
|
**Example:**
|
|
|
|
* `npm set-script start "http-server ."`
|
|
|
|
```json
|
|
{
|
|
"name": "my-project",
|
|
"scripts": {
|
|
"start": "http-server .",
|
|
"test": "some existing value"
|
|
}
|
|
}
|
|
```
|
|
|
|
### Configuration
|
|
|
|
#### workspaces
|
|
|
|
Enables workspaces context. Tasks will be created in the `scripts` section
|
|
of the `package.json` of each workspace.
|
|
|
|
#### workspace
|
|
|
|
Enables workspaces context and limits creating a task to the
|
|
`package.json` files of the workspaces given.
|
|
|
|
|
|
### See Also
|
|
|
|
* [npm run-script](/commands/npm-run-script)
|
|
* [npm install](/commands/npm-install)
|
|
* [npm test](/commands/npm-test)
|
|
* [npm start](/commands/npm-start)
|