npm-set-script.1 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. .TH "NPM\-SET\-SCRIPT" "1" "October 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-set-script\fR \- Set tasks in the scripts section of package\.json
  4. .SS Synopsis
  5. .P
  6. An npm command that lets you create a task in the \fBscripts\fP section of the \fBpackage\.json\fP\|\.
  7. .P
  8. .RS 2
  9. .nf
  10. npm set\-script [<script>] [<command>]
  11. .fi
  12. .RE
  13. .P
  14. \fBExample:\fR
  15. .RS 0
  16. .IP \(bu 2
  17. \fBnpm set\-script start "http\-server \."\fP
  18. .RE
  19. .P
  20. .RS 2
  21. .nf
  22. {
  23. "name": "my\-project",
  24. "scripts": {
  25. "start": "http\-server \.",
  26. "test": "some existing value"
  27. }
  28. }
  29. .fi
  30. .RE
  31. .SS Configuration
  32. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  33. <!\-\- automatically generated, do not edit manually \-\->
  34. <!\-\- see lib/utils/config/definitions\.js \-\->
  35. .SS \fBworkspace\fP
  36. .RS 0
  37. .IP \(bu 2
  38. Default:
  39. .IP \(bu 2
  40. Type: String (can be set multiple times)
  41. .RE
  42. .P
  43. Enable running a command in the context of the configured workspaces of the
  44. current project while filtering by running only the workspaces defined by
  45. this configuration option\.
  46. .P
  47. Valid values for the \fBworkspace\fP config are either:
  48. .RS 0
  49. .IP \(bu 2
  50. Workspace names
  51. .IP \(bu 2
  52. Path to a workspace directory
  53. .IP \(bu 2
  54. Path to a parent workspace directory (will result in selecting all
  55. workspaces within that folder)
  56. .RE
  57. .P
  58. When set for the \fBnpm init\fP command, this may be set to the folder of a
  59. workspace which does not yet exist, to create the folder and set it up as a
  60. brand new workspace within the project\.
  61. .P
  62. This value is not exported to the environment for child processes\.
  63. <!\-\- automatically generated, do not edit manually \-\->
  64. <!\-\- see lib/utils/config/definitions\.js \-\->
  65. .SS \fBworkspaces\fP
  66. .RS 0
  67. .IP \(bu 2
  68. Default: null
  69. .IP \(bu 2
  70. Type: null or Boolean
  71. .RE
  72. .P
  73. Set to true to run the command in the context of \fBall\fR configured
  74. workspaces\.
  75. .P
  76. Explicitly setting this to false will cause commands like \fBinstall\fP to
  77. ignore workspaces altogether\. When not set explicitly:
  78. .RS 0
  79. .IP \(bu 2
  80. Commands that operate on the \fBnode_modules\fP tree (install, update, etc\.)
  81. will link workspaces into the \fBnode_modules\fP folder\. \- Commands that do
  82. other things (test, exec, publish, etc\.) will operate on the root project,
  83. \fIunless\fR one or more workspaces are specified in the \fBworkspace\fP config\.
  84. .RE
  85. .P
  86. This value is not exported to the environment for child processes\.
  87. <!\-\- automatically generated, do not edit manually \-\->
  88. <!\-\- see lib/utils/config/definitions\.js \-\->
  89. .SS \fBinclude\-workspace\-root\fP
  90. .RS 0
  91. .IP \(bu 2
  92. Default: false
  93. .IP \(bu 2
  94. Type: Boolean
  95. .RE
  96. .P
  97. Include the workspace root when workspaces are enabled for a command\.
  98. .P
  99. When false, specifying individual workspaces via the \fBworkspace\fP config, or
  100. all workspaces via the \fBworkspaces\fP flag, will cause npm to operate only on
  101. the specified workspaces, and not on the root project\.
  102. <!\-\- automatically generated, do not edit manually \-\->
  103. <!\-\- see lib/utils/config/definitions\.js \-\->
  104. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  105. .SS See Also
  106. .RS 0
  107. .IP \(bu 2
  108. npm help run\-script
  109. .IP \(bu 2
  110. npm help install
  111. .IP \(bu 2
  112. npm help test
  113. .IP \(bu 2
  114. npm help start
  115. .RE