1NPM-SET-SCRIPT(1)                                            NPM-SET-SCRIPT(1)
2
3
4

NAME

6       npm-set-script - Set tasks in the scripts section of package.json
7
8   Synopsis
9       An  npm  command  that lets you create a task in the scripts section of
10       the package.json.
11
12       Deprecated.
13
14         npm set-script [<script>] [<command>]
15
16       Example:
17
18npm set-script start "http-server ."
19
20
21         {
22           "name": "my-project",
23           "scripts": {
24             "start": "http-server .",
25             "test": "some existing value"
26           }
27         }
28
29   Configuration
30   workspace
31       • Default:
32
33       • Type: String (can be set multiple times)
34
35
36       Enable running a command in the context of the configured workspaces of
37       the  current project while filtering by running only the workspaces de‐
38       fined by this configuration option.
39
40       Valid values for the workspace config are either:
41
42       • Workspace names
43
44       • Path to a workspace directory
45
46       • Path to a parent workspace directory (will result  in  selecting  all
47         workspaces within that folder)
48
49
50       When  set  for the npm init command, this may be set to the folder of a
51       workspace which does not yet exist, to create the folder and set it  up
52       as a brand new workspace within the project.
53
54       This value is not exported to the environment for child processes.
55
56   workspaces
57       • Default: null
58
59       • Type: null or Boolean
60
61
62       Set  to  true  to  run  the  command  in  the context of all configured
63       workspaces.
64
65       Explicitly setting this to false will cause commands  like  install  to
66       ignore workspaces altogether. When not set explicitly:
67
68       • Commands  that  operate  on  the  node_modules tree (install, update,
69         etc.)  will link workspaces into the node_modules folder. -  Commands
70         that  do other things (test, exec, publish, etc.) will operate on the
71         root project, unless one or more  workspaces  are  specified  in  the
72         workspace config.
73
74
75       This value is not exported to the environment for child processes.
76
77   include-workspace-root
78       • Default: false
79
80       • Type: Boolean
81
82
83       Include the workspace root when workspaces are enabled for a command.
84
85       When  false, specifying individual workspaces via the workspace config,
86       or all workspaces via the workspaces flag, will cause  npm  to  operate
87       only on the specified workspaces, and not on the root project.
88
89       This value is not exported to the environment for child processes.
90
91   See Also
92       • npm help run-script
93
94       • npm help install
95
96       • npm help test
97
98       • npm help start
99
100
101
102
103                                September 2022               NPM-SET-SCRIPT(1)
Impressum