npm-hook.1 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. .TH "NPM\-HOOK" "1" "October 2021" "" ""
  2. .SH "NAME"
  3. \fBnpm-hook\fR \- Manage registry hooks
  4. .SS Synopsis
  5. .P
  6. .RS 2
  7. .nf
  8. npm hook ls [pkg]
  9. npm hook add <entity> <url> <secret>
  10. npm hook update <id> <url> [secret]
  11. npm hook rm <id>
  12. .fi
  13. .RE
  14. .P
  15. Note: This command is unaware of workspaces\.
  16. .SS Description
  17. .P
  18. Allows you to manage npm
  19. hooks \fIhttps://blog\.npmjs\.org/post/145260155635/introducing\-hooks\-get\-notifications\-of\-npm\fR,
  20. including adding, removing, listing, and updating\.
  21. .P
  22. Hooks allow you to configure URL endpoints that will be notified whenever a
  23. change happens to any of the supported entity types\. Three different types
  24. of entities can be watched by hooks: packages, owners, and scopes\.
  25. .P
  26. To create a package hook, simply reference the package name\.
  27. .P
  28. To create an owner hook, prefix the owner name with \fB~\fP (as in,
  29. \fB~youruser\fP)\.
  30. .P
  31. To create a scope hook, prefix the scope name with \fB@\fP (as in,
  32. \fB@yourscope\fP)\.
  33. .P
  34. The hook \fBid\fP used by \fBupdate\fP and \fBrm\fP are the IDs listed in \fBnpm hook ls\fP
  35. for that particular hook\.
  36. .P
  37. The shared secret will be sent along to the URL endpoint so you can verify
  38. the request came from your own configured hook\.
  39. .SS Example
  40. .P
  41. Add a hook to watch a package for changes:
  42. .P
  43. .RS 2
  44. .nf
  45. $ npm hook add lodash https://example\.com/ my\-shared\-secret
  46. .fi
  47. .RE
  48. .P
  49. Add a hook to watch packages belonging to the user \fBsubstack\fP:
  50. .P
  51. .RS 2
  52. .nf
  53. $ npm hook add ~substack https://example\.com/ my\-shared\-secret
  54. .fi
  55. .RE
  56. .P
  57. Add a hook to watch packages in the scope \fB@npm\fP
  58. .P
  59. .RS 2
  60. .nf
  61. $ npm hook add @npm https://example\.com/ my\-shared\-secret
  62. .fi
  63. .RE
  64. .P
  65. List all your active hooks:
  66. .P
  67. .RS 2
  68. .nf
  69. $ npm hook ls
  70. .fi
  71. .RE
  72. .P
  73. List your active hooks for the \fBlodash\fP package:
  74. .P
  75. .RS 2
  76. .nf
  77. $ npm hook ls lodash
  78. .fi
  79. .RE
  80. .P
  81. Update an existing hook's url:
  82. .P
  83. .RS 2
  84. .nf
  85. $ npm hook update id\-deadbeef https://my\-new\-website\.here/
  86. .fi
  87. .RE
  88. .P
  89. Remove a hook:
  90. .P
  91. .RS 2
  92. .nf
  93. $ npm hook rm id\-deadbeef
  94. .fi
  95. .RE
  96. .SS Configuration
  97. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS START \-\->
  98. <!\-\- automatically generated, do not edit manually \-\->
  99. <!\-\- see lib/utils/config/definitions\.js \-\->
  100. .SS \fBregistry\fP
  101. .RS 0
  102. .IP \(bu 2
  103. Default: "https://registry\.npmjs\.org/"
  104. .IP \(bu 2
  105. Type: URL
  106. .RE
  107. .P
  108. The base URL of the npm registry\.
  109. <!\-\- automatically generated, do not edit manually \-\->
  110. <!\-\- see lib/utils/config/definitions\.js \-\->
  111. .SS \fBotp\fP
  112. .RS 0
  113. .IP \(bu 2
  114. Default: null
  115. .IP \(bu 2
  116. Type: null or String
  117. .RE
  118. .P
  119. This is a one\-time password from a two\-factor authenticator\. It's needed
  120. when publishing or changing package permissions with \fBnpm access\fP\|\.
  121. .P
  122. If not set, and a registry response fails with a challenge for a one\-time
  123. password, npm will prompt on the command line for one\.
  124. <!\-\- automatically generated, do not edit manually \-\->
  125. <!\-\- see lib/utils/config/definitions\.js \-\->
  126. <!\-\- AUTOGENERATED CONFIG DESCRIPTIONS END \-\->
  127. .SS See Also
  128. .RS 0
  129. .IP \(bu 2
  130. "Introducing Hooks" blog post \fIhttps://blog\.npmjs\.org/post/145260155635/introducing\-hooks\-get\-notifications\-of\-npm\fR
  131. .RE