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