netlify-cli 17.6.0 → 17.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/bin/{run.mjs → run.js} +3 -3
  2. package/npm-shrinkwrap.json +4 -4
  3. package/package.json +8 -9
  4. package/scripts/{postinstall.mjs → postinstall.js} +3 -4
  5. package/src/commands/addons/addons-auth.js +22 -0
  6. package/src/commands/addons/{addons-config.mjs → addons-config.js} +9 -34
  7. package/src/commands/addons/{addons-create.mjs → addons-create.js} +7 -33
  8. package/src/commands/addons/addons-delete.js +33 -0
  9. package/src/commands/addons/{addons-list.mjs → addons-list.js} +3 -25
  10. package/src/commands/addons/addons.js +68 -0
  11. package/src/commands/addons/index.js +1 -0
  12. package/src/commands/api/{api.mjs → api.js} +2 -24
  13. package/src/commands/api/index.js +13 -0
  14. package/src/commands/{base-command.mjs → base-command.js} +7 -7
  15. package/src/commands/blobs/blobs-delete.js +20 -0
  16. package/src/commands/blobs/{blobs-get.mjs → blobs-get.js} +2 -15
  17. package/src/commands/blobs/{blobs-list.mjs → blobs-list.js} +2 -16
  18. package/src/commands/blobs/{blobs-set.mjs → blobs-set.js} +2 -17
  19. package/src/commands/blobs/blobs.js +74 -0
  20. package/src/commands/blobs/index.js +1 -0
  21. package/src/commands/build/{build.mjs → build.js} +7 -28
  22. package/src/commands/build/index.js +13 -0
  23. package/src/commands/completion/completion.js +29 -0
  24. package/src/commands/completion/index.js +26 -0
  25. package/src/commands/deploy/{deploy.mjs → deploy.js} +17 -133
  26. package/src/commands/deploy/index.js +106 -0
  27. package/src/commands/dev/{dev-exec.mjs → dev-exec.js} +3 -15
  28. package/src/commands/dev/{dev.mjs → dev.js} +19 -38
  29. package/src/commands/dev/index.js +1 -0
  30. package/src/commands/env/{env-clone.mjs → env-clone.js} +71 -94
  31. package/src/commands/env/env-get.js +34 -0
  32. package/src/commands/env/{env-import.mjs → env-import.js} +38 -65
  33. package/src/commands/env/{env-list.mjs → env-list.js} +3 -37
  34. package/src/commands/env/{env-set.mjs → env-set.js} +36 -81
  35. package/src/commands/env/{env-unset.mjs → env-unset.js} +30 -62
  36. package/src/commands/env/env.js +127 -0
  37. package/src/commands/env/index.js +1 -0
  38. package/src/commands/functions/{functions-build.mjs → functions-build.js} +3 -22
  39. package/src/commands/functions/{functions-create.mjs → functions-create.js} +20 -47
  40. package/src/commands/functions/{functions-invoke.mjs → functions-invoke.js} +3 -41
  41. package/src/commands/functions/{functions-list.mjs → functions-list.js} +3 -27
  42. package/src/commands/functions/{functions-serve.mjs → functions-serve.js} +6 -28
  43. package/src/commands/functions/functions.js +98 -0
  44. package/src/commands/functions/index.js +1 -0
  45. package/src/commands/index.js +2 -0
  46. package/src/commands/init/index.js +12 -0
  47. package/src/commands/init/{init.mjs → init.js} +10 -31
  48. package/src/commands/integration/{deploy.mjs → deploy.js} +7 -28
  49. package/src/commands/integration/index.js +26 -0
  50. package/src/commands/link/index.js +13 -0
  51. package/src/commands/link/{link.mjs → link.js} +6 -28
  52. package/src/commands/lm/index.js +1 -0
  53. package/src/commands/lm/{lm-info.mjs → lm-info.js} +2 -9
  54. package/src/commands/lm/lm-install.js +8 -0
  55. package/src/commands/lm/{lm-setup.mjs → lm-setup.js} +6 -25
  56. package/src/commands/lm/lm-uninstall.js +7 -0
  57. package/src/commands/lm/lm.js +46 -0
  58. package/src/commands/login/index.js +9 -0
  59. package/src/commands/login/{login.mjs → login.js} +1 -19
  60. package/src/commands/logout/index.js +7 -0
  61. package/src/commands/logout/{logout.mjs → logout.js} +3 -16
  62. package/src/commands/logs/{build.mjs → build.js} +3 -8
  63. package/src/commands/logs/{functions.mjs → functions.js} +4 -27
  64. package/src/commands/logs/index.js +39 -0
  65. package/src/commands/logs/log-levels.js +11 -0
  66. package/src/commands/{main.mjs → main.js} +32 -32
  67. package/src/commands/open/index.js +31 -0
  68. package/src/commands/open/open-admin.js +11 -0
  69. package/src/commands/open/open-site.js +12 -0
  70. package/src/commands/open/open.js +13 -0
  71. package/src/commands/recipes/{common.mjs → common.js} +2 -2
  72. package/src/commands/recipes/index.js +20 -0
  73. package/src/commands/recipes/recipes-list.js +14 -0
  74. package/src/commands/recipes/{recipes.mjs → recipes.js} +8 -32
  75. package/src/commands/serve/index.js +27 -0
  76. package/src/commands/serve/{serve.mjs → serve.js} +14 -51
  77. package/src/commands/sites/index.js +1 -0
  78. package/src/commands/sites/{sites-create-template.mjs → sites-create-template.js} +9 -38
  79. package/src/commands/sites/{sites-create.mjs → sites-create.js} +5 -38
  80. package/src/commands/sites/{sites-delete.mjs → sites-delete.js} +2 -22
  81. package/src/commands/sites/{sites-list.mjs → sites-list.js} +4 -24
  82. package/src/commands/sites/sites.js +77 -0
  83. package/src/commands/status/index.js +19 -0
  84. package/src/commands/status/{status-hooks.mjs → status-hooks.js} +2 -20
  85. package/src/commands/status/{status.mjs → status.js} +2 -23
  86. package/src/commands/switch/index.js +7 -0
  87. package/src/commands/switch/{switch.mjs → switch.js} +3 -16
  88. package/src/commands/unlink/index.js +7 -0
  89. package/src/commands/unlink/unlink.js +21 -0
  90. package/src/commands/watch/index.js +8 -0
  91. package/src/commands/watch/{watch.mjs → watch.js} +4 -21
  92. package/src/lib/{api.mjs → api.js} +1 -1
  93. package/src/lib/blobs/{blobs.mjs → blobs.js} +2 -2
  94. package/src/lib/{build.mjs → build.js} +3 -3
  95. package/src/lib/completion/{constants.mjs → constants.js} +1 -1
  96. package/src/lib/completion/{generate-autocompletion.mjs → generate-autocompletion.js} +3 -3
  97. package/src/lib/completion/{index.mjs → index.js} +1 -1
  98. package/src/lib/completion/{script.mjs → script.js} +3 -3
  99. package/src/lib/edge-functions/{deploy.mjs → deploy.js} +2 -2
  100. package/src/lib/edge-functions/{editor-helper.mjs → editor-helper.js} +1 -1
  101. package/src/lib/edge-functions/{internal.mjs → internal.js} +2 -2
  102. package/src/lib/edge-functions/{proxy.mjs → proxy.js} +10 -11
  103. package/src/lib/edge-functions/{registry.mjs → registry.js} +4 -2
  104. package/src/lib/{exec-fetcher.mjs → exec-fetcher.js} +2 -2
  105. package/src/lib/functions/{background.mjs → background.js} +2 -2
  106. package/src/lib/functions/{form-submissions-handler.mjs → form-submissions-handler.js} +3 -3
  107. package/src/lib/functions/{local-proxy.mjs → local-proxy.js} +1 -1
  108. package/src/lib/functions/{netlify-function.mjs → netlify-function.js} +18 -63
  109. package/src/lib/functions/{registry.mjs → registry.js} +33 -96
  110. package/src/lib/functions/runtimes/go/{index.mjs → index.js} +2 -2
  111. package/src/lib/functions/runtimes/{index.mjs → index.js} +3 -4
  112. package/src/lib/functions/runtimes/js/builders/{netlify-lambda.mjs → netlify-lambda.js} +3 -3
  113. package/src/lib/functions/runtimes/js/builders/{zisi.mjs → zisi.js} +6 -6
  114. package/src/lib/functions/runtimes/js/{index.mjs → index.js} +4 -4
  115. package/src/lib/functions/runtimes/rust/{index.mjs → index.js} +4 -4
  116. package/src/lib/functions/{scheduled.mjs → scheduled.js} +2 -2
  117. package/src/lib/functions/{server.mjs → server.js} +16 -15
  118. package/src/lib/functions/{synchronous.mjs → synchronous.js} +3 -3
  119. package/src/lib/functions/{utils.mjs → utils.js} +2 -2
  120. package/src/lib/{geo-location.mjs → geo-location.js} +1 -1
  121. package/src/lib/{http-agent.mjs → http-agent.js} +1 -1
  122. package/src/lib/images/{proxy.mjs → proxy.js} +3 -3
  123. package/src/lib/{log.mjs → log.js} +1 -1
  124. package/src/recipes/vscode/{index.mjs → index.js} +2 -2
  125. package/src/recipes/vscode/{settings.mjs → settings.js} +0 -1
  126. package/src/utils/addons/diffs/{index.mjs → index.js} +1 -1
  127. package/src/utils/addons/diffs/{options.mjs → options.js} +0 -1
  128. package/src/utils/addons/{prepare.mjs → prepare.js} +2 -2
  129. package/src/utils/addons/{prompts.mjs → prompts.js} +1 -1
  130. package/src/utils/addons/{render.mjs → render.js} +1 -1
  131. package/src/utils/{banner.mjs → banner.js} +1 -1
  132. package/src/utils/{build-info.mjs → build-info.js} +3 -3
  133. package/src/utils/{command-helpers.mjs → command-helpers.js} +4 -9
  134. package/src/utils/deploy/{deploy-site.mjs → deploy-site.js} +8 -8
  135. package/src/utils/deploy/{hash-files.mjs → hash-files.js} +1 -1
  136. package/src/utils/deploy/{hash-fns.mjs → hash-fns.js} +3 -3
  137. package/src/utils/deploy/{hasher-segments.mjs → hasher-segments.js} +1 -1
  138. package/src/utils/deploy/{upload-files.mjs → upload-files.js} +1 -1
  139. package/src/utils/deploy/{util.mjs → util.js} +1 -1
  140. package/src/utils/{detect-server-settings.mjs → detect-server-settings.js} +6 -7
  141. package/src/utils/{dev.mjs → dev.js} +3 -3
  142. package/src/utils/{dot-env.mjs → dot-env.js} +2 -2
  143. package/src/utils/env/{index.mjs → index.js} +1 -1
  144. package/src/utils/{framework-server.mjs → framework-server.js} +4 -4
  145. package/src/utils/functions/{functions.mjs → functions.js} +2 -2
  146. package/src/utils/functions/{get-functions.mjs → get-functions.js} +1 -1
  147. package/src/utils/functions/index.js +3 -0
  148. package/src/utils/{get-global-config.mjs → get-global-config.js} +1 -1
  149. package/src/utils/{get-repo-data.mjs → get-repo-data.js} +1 -1
  150. package/src/utils/{get-site.mjs → get-site.js} +1 -1
  151. package/src/utils/{gh-auth.mjs → gh-auth.js} +3 -3
  152. package/src/utils/{gitignore.mjs → gitignore.js} +2 -2
  153. package/src/utils/{headers.mjs → headers.js} +1 -1
  154. package/src/utils/hooks/{requires-site-info.mjs → requires-site-info.js} +1 -1
  155. package/src/utils/init/{config-github.mjs → config-github.js} +4 -4
  156. package/src/utils/init/{config-manual.mjs → config-manual.js} +5 -5
  157. package/src/utils/init/{config.mjs → config.js} +4 -4
  158. package/src/utils/init/{node-version.mjs → node-version.js} +1 -1
  159. package/src/utils/init/{utils.mjs → utils.js} +7 -7
  160. package/src/utils/{live-tunnel.mjs → live-tunnel.js} +4 -4
  161. package/src/utils/lm/{install.mjs → install.js} +6 -6
  162. package/src/utils/lm/{requirements.mjs → requirements.js} +1 -1
  163. package/src/utils/lm/{steps.mjs → steps.js} +2 -2
  164. package/src/utils/lm/{ui.mjs → ui.js} +2 -2
  165. package/src/utils/{open-browser.mjs → open-browser.js} +1 -1
  166. package/src/utils/{proxy-server.mjs → proxy-server.js} +5 -5
  167. package/src/utils/{proxy.mjs → proxy.js} +18 -16
  168. package/src/utils/{redirects.mjs → redirects.js} +1 -1
  169. package/src/utils/{rules-proxy.mjs → rules-proxy.js} +3 -3
  170. package/src/utils/{run-build.mjs → run-build.js} +8 -8
  171. package/src/utils/{shell.mjs → shell.js} +2 -2
  172. package/src/utils/{state-config.mjs → state-config.js} +1 -1
  173. package/src/utils/{static-server.mjs → static-server.js} +1 -1
  174. package/src/utils/telemetry/index.js +2 -0
  175. package/src/utils/telemetry/{report-error.mjs → report-error.js} +4 -4
  176. package/src/utils/telemetry/{request.mjs → request.js} +1 -1
  177. package/src/utils/telemetry/{telemetry.mjs → telemetry.js} +5 -5
  178. package/src/utils/telemetry/{utils.mjs → utils.js} +1 -1
  179. package/src/utils/telemetry/{validation.mjs → validation.js} +1 -1
  180. package/src/utils/{validation.mjs → validation.js} +1 -1
  181. package/src/commands/addons/addons-auth.mjs +0 -45
  182. package/src/commands/addons/addons-delete.mjs +0 -53
  183. package/src/commands/addons/addons.mjs +0 -39
  184. package/src/commands/addons/index.mjs +0 -1
  185. package/src/commands/api/index.mjs +0 -1
  186. package/src/commands/blobs/blobs-delete.mjs +0 -35
  187. package/src/commands/blobs/blobs.mjs +0 -32
  188. package/src/commands/blobs/index.mjs +0 -1
  189. package/src/commands/build/index.mjs +0 -1
  190. package/src/commands/completion/completion.mjs +0 -53
  191. package/src/commands/completion/index.mjs +0 -1
  192. package/src/commands/deploy/index.mjs +0 -1
  193. package/src/commands/dev/index.mjs +0 -1
  194. package/src/commands/dev/types.d.ts +0 -30
  195. package/src/commands/env/env-get.mjs +0 -66
  196. package/src/commands/env/env.mjs +0 -41
  197. package/src/commands/env/index.mjs +0 -1
  198. package/src/commands/functions/functions.mjs +0 -39
  199. package/src/commands/functions/index.mjs +0 -1
  200. package/src/commands/index.mjs +0 -2
  201. package/src/commands/init/index.mjs +0 -1
  202. package/src/commands/integration/index.mjs +0 -24
  203. package/src/commands/link/index.mjs +0 -1
  204. package/src/commands/lm/index.mjs +0 -1
  205. package/src/commands/lm/lm-install.mjs +0 -27
  206. package/src/commands/lm/lm-uninstall.mjs +0 -18
  207. package/src/commands/lm/lm.mjs +0 -30
  208. package/src/commands/login/index.mjs +0 -1
  209. package/src/commands/logout/index.mjs +0 -1
  210. package/src/commands/logs/index.mjs +0 -12
  211. package/src/commands/open/index.mjs +0 -1
  212. package/src/commands/open/open-admin.mjs +0 -30
  213. package/src/commands/open/open-site.mjs +0 -31
  214. package/src/commands/open/open.mjs +0 -36
  215. package/src/commands/recipes/index.mjs +0 -1
  216. package/src/commands/recipes/recipes-list.mjs +0 -25
  217. package/src/commands/serve/index.mjs +0 -1
  218. package/src/commands/sites/index.mjs +0 -2
  219. package/src/commands/sites/sites.mjs +0 -30
  220. package/src/commands/status/index.mjs +0 -1
  221. package/src/commands/switch/index.mjs +0 -1
  222. package/src/commands/types.d.ts +0 -31
  223. package/src/commands/unlink/index.mjs +0 -1
  224. package/src/commands/unlink/unlink.mjs +0 -34
  225. package/src/commands/watch/index.mjs +0 -1
  226. package/src/functions-templates/typescript/abtest/{{name}}.ts +0 -31
  227. package/src/functions-templates/typescript/geolocation/{{name}}.ts +0 -24
  228. package/src/functions-templates/typescript/hello-world/{{name}}.ts +0 -12
  229. package/src/functions-templates/typescript/json/{{name}}.ts +0 -5
  230. package/src/functions-templates/typescript/log/{{name}}.ts +0 -9
  231. package/src/functions-templates/typescript/scheduled-function/{{name}}.ts +0 -12
  232. package/src/functions-templates/typescript/set-cookies/{{name}}.ts +0 -29
  233. package/src/functions-templates/typescript/set-req-header/{{name}}.ts +0 -5
  234. package/src/functions-templates/typescript/set-res-header/{{name}}.ts +0 -7
  235. package/src/functions-templates/typescript/transform-response/{{name}}.ts +0 -13
  236. package/src/utils/functions/index.mjs +0 -3
  237. package/src/utils/telemetry/index.mjs +0 -2
  238. package/src/utils/types.d.ts +0 -46
  239. /package/src/functions-templates/go/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  240. /package/src/functions-templates/javascript/hello/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  241. /package/src/functions-templates/javascript/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  242. /package/src/functions-templates/javascript/identity-signup/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  243. /package/src/functions-templates/javascript/image-external/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  244. /package/src/functions-templates/javascript/localized-content/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  245. /package/src/functions-templates/javascript/sanity-create/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  246. /package/src/functions-templates/javascript/sanity-groq/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  247. /package/src/functions-templates/javascript/scheduled-function/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  248. /package/src/functions-templates/javascript/set-cookies/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  249. /package/src/functions-templates/javascript/set-req-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  250. /package/src/functions-templates/javascript/set-res-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  251. /package/src/functions-templates/javascript/submission-created/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  252. /package/src/functions-templates/javascript/transform-response/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  253. /package/src/functions-templates/rust/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  254. /package/src/functions-templates/typescript/abtest/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  255. /package/src/functions-templates/typescript/geolocation/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  256. /package/src/functions-templates/typescript/hello-world/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  257. /package/src/functions-templates/typescript/json/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  258. /package/src/functions-templates/typescript/log/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  259. /package/src/functions-templates/typescript/scheduled-function/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  260. /package/src/functions-templates/typescript/set-cookies/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  261. /package/src/functions-templates/typescript/set-req-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  262. /package/src/functions-templates/typescript/set-res-header/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  263. /package/src/functions-templates/typescript/transform-response/{.netlify-function-template.mjs → .netlify-function-template.js} +0 -0
  264. /package/src/lib/{account.mjs → account.js} +0 -0
  265. /package/src/lib/completion/{get-autocompletion.mjs → get-autocompletion.js} +0 -0
  266. /package/src/lib/edge-functions/{bootstrap.mjs → bootstrap.js} +0 -0
  267. /package/src/lib/edge-functions/{consts.mjs → consts.js} +0 -0
  268. /package/src/lib/edge-functions/{headers.mjs → headers.js} +0 -0
  269. /package/src/lib/{fs.mjs → fs.js} +0 -0
  270. /package/src/lib/functions/{config.mjs → config.js} +0 -0
  271. /package/src/lib/functions/{memoized-build.mjs → memoized-build.js} +0 -0
  272. /package/src/lib/functions/runtimes/js/{constants.mjs → constants.js} +0 -0
  273. /package/src/lib/functions/runtimes/js/{worker.mjs → worker.js} +0 -0
  274. /package/src/lib/{path.mjs → path.js} +0 -0
  275. /package/src/lib/{render-error-template.mjs → render-error-template.js} +0 -0
  276. /package/src/lib/{settings.mjs → settings.js} +0 -0
  277. /package/src/lib/{spinner.mjs → spinner.js} +0 -0
  278. /package/src/lib/{string.mjs → string.js} +0 -0
  279. /package/src/utils/addons/{compare.mjs → compare.js} +0 -0
  280. /package/src/utils/addons/{validation.mjs → validation.js} +0 -0
  281. /package/src/utils/{create-deferred.mjs → create-deferred.js} +0 -0
  282. /package/src/utils/{create-stream-promise.mjs → create-stream-promise.js} +0 -0
  283. /package/src/utils/deploy/{constants.mjs → constants.js} +0 -0
  284. /package/src/utils/deploy/{hash-config.mjs → hash-config.js} +0 -0
  285. /package/src/utils/{execa.mjs → execa.js} +0 -0
  286. /package/src/utils/{feature-flags.mjs → feature-flags.js} +0 -0
  287. /package/src/utils/functions/{constants.mjs → constants.js} +0 -0
  288. /package/src/utils/{get-package-json.mjs → get-package-json.js} +0 -0
  289. /package/src/utils/init/{plugins.mjs → plugins.js} +0 -0
  290. /package/src/utils/{parse-raw-flags.mjs → parse-raw-flags.js} +0 -0
  291. /package/src/utils/{read-repo-url.mjs → read-repo-url.js} +0 -0
  292. /package/src/utils/{request-id.mjs → request-id.js} +0 -0
  293. /package/src/utils/{sign-redirect.mjs → sign-redirect.js} +0 -0
  294. /package/src/utils/sites/{utils.mjs → utils.js} +0 -0
  295. /package/src/utils/websockets/{index.mjs → index.js} +0 -0
@@ -0,0 +1,98 @@
1
+ import { chalk } from '../../utils/command-helpers.js';
2
+ import requiresSiteInfo from '../../utils/hooks/requires-site-info.js';
3
+ const functions = (options, command) => {
4
+ command.help();
5
+ };
6
+ export const createFunctionsCommand = (program) => {
7
+ program
8
+ .command('functions:build')
9
+ .alias('function:build')
10
+ .description('Build functions locally')
11
+ .option('-f, --functions <directory>', 'Specify a functions directory to build to')
12
+ .option('-s, --src <directory>', 'Specify the source directory for the functions')
13
+ .action(async (options, command) => {
14
+ const { functionsBuild } = await import('./functions-build.js');
15
+ await functionsBuild(options, command);
16
+ });
17
+ program
18
+ .command('functions:create')
19
+ .alias('function:create')
20
+ .argument('[name]', 'name of your new function file inside your functions directory')
21
+ .description('Create a new function locally')
22
+ .option('-n, --name <name>', 'function name')
23
+ .option('-u, --url <url>', 'pull template from URL')
24
+ .option('-l, --language <lang>', 'function language')
25
+ .addExamples([
26
+ 'netlify functions:create',
27
+ 'netlify functions:create hello-world',
28
+ 'netlify functions:create --name hello-world',
29
+ ])
30
+ .action(async (name, options, command) => {
31
+ const { functionsCreate } = await import('./functions-create.js');
32
+ await functionsCreate(name, options, command);
33
+ });
34
+ program
35
+ .command('functions:invoke')
36
+ .alias('function:trigger')
37
+ .argument('[name]', 'function name to invoke')
38
+ .description(`Trigger a function while in netlify dev with simulated data, good for testing function calls including Netlify's Event Triggered Functions`)
39
+ .option('-n, --name <name>', 'function name to invoke')
40
+ .option('-f, --functions <dir>', 'Specify a functions folder to parse, overriding netlify.toml')
41
+ .option('-q, --querystring <query>', 'Querystring to add to your function invocation')
42
+ .option('-p, --payload <data>', 'Supply POST payload in stringified json, or a path to a json file')
43
+ // TODO: refactor to not need the `undefined` state by removing the --identity flag (value `identity` will be then always defined to true or false)
44
+ .option('--identity', 'simulate Netlify Identity authentication JWT. pass --identity to affirm unauthenticated request')
45
+ .option('--no-identity', 'simulate Netlify Identity authentication JWT. pass --no-identity to affirm unauthenticated request')
46
+ .option('--port <port>', 'Port where netlify dev is accessible. e.g. 8888', (value) => Number.parseInt(value))
47
+ .addExamples([
48
+ 'netlify functions:invoke',
49
+ 'netlify functions:invoke myfunction',
50
+ 'netlify functions:invoke --name myfunction',
51
+ 'netlify functions:invoke --name myfunction --identity',
52
+ 'netlify functions:invoke --name myfunction --no-identity',
53
+ `netlify functions:invoke myfunction --payload '{"foo": 1}'`,
54
+ 'netlify functions:invoke myfunction --querystring "foo=1',
55
+ 'netlify functions:invoke myfunction --payload "./pathTo.json"',
56
+ ])
57
+ .action(async (name, options, command) => {
58
+ const { functionsInvoke } = await import('./functions-invoke.js');
59
+ await functionsInvoke(name, options, command);
60
+ });
61
+ program
62
+ .command('functions:list')
63
+ .alias('function:list')
64
+ .description(`List functions that exist locally
65
+ Helpful for making sure that you have formatted your functions correctly
66
+
67
+ NOT the same as listing the functions that have been deployed. For that info you need to go to your Netlify deploy log.`)
68
+ .option('-f, --functions <dir>', 'Specify a functions directory to list')
69
+ .option('--json', 'Output function data as JSON')
70
+ .hook('preAction', requiresSiteInfo)
71
+ .action(async (options, command) => {
72
+ const { functionsList } = await import('./functions-list.js');
73
+ await functionsList(options, command);
74
+ });
75
+ program
76
+ .command('functions:serve')
77
+ .alias('function:serve')
78
+ .description('Serve functions locally')
79
+ .option('-f, --functions <dir>', 'Specify a functions directory to serve')
80
+ .option('-p, --port <port>', 'Specify a port for the functions server', (value) => Number.parseInt(value))
81
+ .option('-o, --offline', 'disables any features that require network access')
82
+ .addHelpText('after', 'Helpful for debugging functions.')
83
+ .action(async (options, command) => {
84
+ const { functionsServe } = await import('./functions-serve.js');
85
+ await functionsServe(options, command);
86
+ });
87
+ const name = chalk.greenBright('`functions`');
88
+ return program
89
+ .command('functions')
90
+ .alias('function')
91
+ .description(`Manage netlify functions
92
+ The ${name} command will help you manage the functions in this site`)
93
+ .addExamples([
94
+ 'netlify functions:create --name function-xyz',
95
+ 'netlify functions:build --functions build/to/directory --src source/directory',
96
+ ])
97
+ .action(functions);
98
+ };
@@ -0,0 +1 @@
1
+ export { createFunctionsCommand } from './functions.js';
@@ -0,0 +1,2 @@
1
+ export { default as BaseCommand } from './base-command.js';
2
+ export { createMainCommand } from './main.js';
@@ -0,0 +1,12 @@
1
+ import { Option } from 'commander';
2
+ export const createInitCommand = (program) => program
3
+ .command('init')
4
+ .description('Configure continuous deployment for a new or existing site. To create a new site without continuous deployment, use `netlify sites:create`')
5
+ .option('-m, --manual', 'Manually configure a git remote for CI')
6
+ .option('--force', 'Reinitialize CI hooks if the linked site is already configured to use CI')
7
+ .addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
8
+ .option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
9
+ .action(async (options, command) => {
10
+ const { init } = await import('./init.js');
11
+ await init(options, command);
12
+ });
@@ -1,13 +1,12 @@
1
- import { Option } from 'commander';
2
1
  import inquirer from 'inquirer';
3
2
  import isEmpty from 'lodash/isEmpty.js';
4
- import { chalk, exit, log } from '../../utils/command-helpers.mjs';
5
- import getRepoData from '../../utils/get-repo-data.mjs';
6
- import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs';
7
- import { configureRepo } from '../../utils/init/config.mjs';
8
- import { track } from '../../utils/telemetry/index.mjs';
9
- import { link } from '../link/index.mjs';
10
- import { sitesCreate } from '../sites/index.mjs';
3
+ import { chalk, exit, log } from '../../utils/command-helpers.js';
4
+ import getRepoData from '../../utils/get-repo-data.js';
5
+ import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
6
+ import { configureRepo } from '../../utils/init/config.js';
7
+ import { track } from '../../utils/telemetry/index.js';
8
+ import { link } from '../link/link.js';
9
+ import { sitesCreate } from '../sites/sites-create.js';
11
10
  // @ts-expect-error TS(7031) FIXME: Binding element 'siteInfo' implicitly has an 'any'... Remove this comment to see the full error message
12
11
  const persistState = ({ siteInfo, state }) => {
13
12
  // Save to .netlify/state.json file
@@ -39,7 +38,7 @@ const logExistingAndExit = ({ siteInfo }) => {
39
38
  * Creates and new site and exits the process
40
39
  * @param {object} config
41
40
  * @param {*} config.state
42
- * @param {import('../base-command.mjs').default} config.command
41
+ * @param {import('../base-command.js').default} config.command
43
42
  */
44
43
  // @ts-expect-error TS(7031) FIXME: Binding element 'command' implicitly has an 'any' ... Remove this comment to see the full error message
45
44
  const createNewSiteAndExit = async ({ command, state }) => {
@@ -86,7 +85,7 @@ const logGitSetupInstructionsAndExit = () => {
86
85
  /**
87
86
  * Handles the case where no git remote was found.
88
87
  * @param {object} config
89
- * @param {import('../base-command.mjs').default} config.command
88
+ * @param {import('../base-command.js').default} config.command
90
89
  * @param {object} config.error
91
90
  * @param {object} config.state
92
91
  */
@@ -126,7 +125,7 @@ git remote add origin https://github.com/YourUserName/RepoName.git
126
125
  };
127
126
  /**
128
127
  * Creates a new site or links an existing one to the repository
129
- * @param {import('../base-command.mjs').default} command
128
+ * @param {import('../base-command.js').default} command
130
129
  */
131
130
  // @ts-expect-error TS(7006) FIXME: Parameter 'command' implicitly has an 'any' type.
132
131
  const createOrLinkSiteToRepo = async (command) => {
@@ -162,12 +161,6 @@ const logExistingRepoSetupAndExit = ({ repoUrl, siteName }) => {
162
161
  // TODO add support for changing GitHub repo in site:config command
163
162
  exit();
164
163
  };
165
- /**
166
- * The init command
167
- * @param {import('commander').OptionValues} options
168
- * @param {import('../base-command.mjs').default} command
169
- */
170
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
171
164
  export const init = async (options, command) => {
172
165
  command.setAnalyticsPayload({ manual: options.manual, force: options.force });
173
166
  const { repositoryRoot, state } = command.netlify;
@@ -198,17 +191,3 @@ export const init = async (options, command) => {
198
191
  await configureRepo({ command, siteId: siteInfo.id, repoData, manual: options.manual });
199
192
  return siteInfo;
200
193
  };
201
- /**
202
- * Creates the `netlify init` command
203
- * @param {import('../base-command.mjs').default} program
204
- * @returns
205
- */
206
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
207
- export const createInitCommand = (program) => program
208
- .command('init')
209
- .description('Configure continuous deployment for a new or existing site. To create a new site without continuous deployment, use `netlify sites:create`')
210
- .option('-m, --manual', 'Manually configure a git remote for CI')
211
- .option('--force', 'Reinitialize CI hooks if the linked site is already configured to use CI')
212
- .addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
213
- .option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
214
- .action(init);
@@ -7,11 +7,11 @@ import yaml from 'js-yaml';
7
7
  // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'node... Remove this comment to see the full error message
8
8
  import fetch from 'node-fetch';
9
9
  import { z } from 'zod';
10
- import { getBuildOptions } from '../../lib/build.mjs';
11
- import { getToken, chalk, log } from '../../utils/command-helpers.mjs';
12
- import { getSiteInformation } from '../../utils/dev.mjs';
13
- import { checkOptions } from '../build/build.mjs';
14
- import { deploy as siteDeploy } from '../deploy/deploy.mjs';
10
+ import { getBuildOptions } from '../../lib/build.js';
11
+ import { getToken, chalk, log } from '../../utils/command-helpers.js';
12
+ import { getSiteInformation } from '../../utils/dev.js';
13
+ import { checkOptions } from '../build/build.js';
14
+ import { deploy as siteDeploy } from '../deploy/deploy.js';
15
15
  function getIntegrationAPIUrl() {
16
16
  return env.INTEGRATION_URL || 'https://api.netlifysdk.com';
17
17
  }
@@ -319,24 +319,18 @@ export const getConfiguration = (workingDir) => {
319
319
  exit(1);
320
320
  }
321
321
  };
322
- /**
323
- * The deploy command for Netlify Integrations
324
- * @param {import('commander').OptionValues} options
325
- * * @param {import('../base-command.mjs').default} command
326
- */
327
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
328
- const deploy = async (options, command) => {
322
+ export const deploy = async (options, command) => {
329
323
  const { api, cachedConfig, site, siteInfo } = command.netlify;
330
324
  const { id: siteId } = site;
331
325
  // @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
332
326
  const [token] = await getToken();
333
327
  const workingDir = resolve(command.workingDir);
334
- // @ts-expect-error TS(2345) FIXME: Argument of type '{ cachedConfig: any; packagePath... Remove this comment to see the full error message
335
328
  const buildOptions = await getBuildOptions({
336
329
  cachedConfig,
337
330
  packagePath: command.workspacePackage,
338
331
  currentDir: command.workingDir,
339
332
  token,
333
+ // @ts-expect-error TS(2740)
340
334
  options,
341
335
  });
342
336
  // Confirm that a site is linked and that the user is logged in
@@ -369,18 +363,3 @@ const deploy = async (options, command) => {
369
363
  await siteDeploy(options, command);
370
364
  log(`${chalk.cyanBright.bold(`Your integration has been deployed. Next step is to enable it for a team or site.`)} https://ntl.fyi/create-private-integration`);
371
365
  };
372
- /**
373
- * Creates the `netlify int deploy` command
374
- * @param {import('../base-command.mjs').default} program
375
- * @returns
376
- */
377
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
378
- export const createDeployCommand = (program) => program
379
- .command('integration:deploy')
380
- .alias('int:deploy')
381
- .description('Register, build, and deploy a private integration on Netlify')
382
- .option('-p, --prod', 'Deploy to production', false)
383
- .option('-b, --build', 'Build the integration', false)
384
- .option('-a, --auth <token>', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN)
385
- .option('-s, --site <name-or-id>', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID)
386
- .action(deploy);
@@ -0,0 +1,26 @@
1
+ import { env } from 'process';
2
+ const integrations = (options, command) => {
3
+ command.help();
4
+ };
5
+ export const createIntegrationDeployCommand = (program) => {
6
+ program
7
+ .command('integration:deploy')
8
+ .alias('int:deploy')
9
+ .description('Register, build, and deploy a private integration on Netlify')
10
+ .option('-p, --prod', 'Deploy to production', false)
11
+ .option('-b, --build', 'Build the integration', false)
12
+ .option('-a, --auth <token>', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN)
13
+ .option('-s, --site <name-or-id>', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID)
14
+ .action(async (options, command) => {
15
+ const { deploy } = await import('./deploy.js');
16
+ await deploy(options, command);
17
+ });
18
+ };
19
+ export const createIntegrationCommand = (program) => {
20
+ createIntegrationDeployCommand(program);
21
+ return program
22
+ .command('integration')
23
+ .alias('int')
24
+ .description('Manage Netlify Integrations built with the Netlify SDK')
25
+ .action(integrations);
26
+ };
@@ -0,0 +1,13 @@
1
+ import { Option } from 'commander';
2
+ export const createLinkCommand = (program) => program
3
+ .command('link')
4
+ .description('Link a local repo or project folder to an existing site on Netlify')
5
+ .option('--id <id>', 'ID of site to link to')
6
+ .option('--name <name>', 'Name of site to link to')
7
+ .addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
8
+ .option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
9
+ .addExamples(['netlify link', 'netlify link --id 123-123-123-123', 'netlify link --name my-site-name'])
10
+ .action(async (options, command) => {
11
+ const { link } = await import('./link.js');
12
+ await link(options, command);
13
+ });
@@ -1,14 +1,13 @@
1
- import { Option } from 'commander';
2
1
  import inquirer from 'inquirer';
3
2
  import isEmpty from 'lodash/isEmpty.js';
4
- import { listSites } from '../../lib/api.mjs';
5
- import { chalk, error, exit, log } from '../../utils/command-helpers.mjs';
6
- import getRepoData from '../../utils/get-repo-data.mjs';
7
- import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs';
8
- import { track } from '../../utils/telemetry/index.mjs';
3
+ import { listSites } from '../../lib/api.js';
4
+ import { chalk, error, exit, log } from '../../utils/command-helpers.js';
5
+ import getRepoData from '../../utils/get-repo-data.js';
6
+ import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
7
+ import { track } from '../../utils/telemetry/index.js';
9
8
  /**
10
9
  *
11
- * @param {import('../base-command.mjs').default} command
10
+ * @param {import('../base-command.js').default} command
12
11
  * @param {import('commander').OptionValues} options
13
12
  */
14
13
  // @ts-expect-error TS(7006) FIXME: Parameter 'command' implicitly has an 'any' type.
@@ -228,12 +227,6 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`);
228
227
  log(`You can now run other \`netlify\` cli commands in this directory`);
229
228
  return site;
230
229
  };
231
- /**
232
- * The link command
233
- * @param {import('commander').OptionValues} options
234
- * @param {import('../base-command.mjs').default} command
235
- */
236
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
237
230
  export const link = async (options, command) => {
238
231
  await command.authenticate();
239
232
  const { api, repositoryRoot, site: { id: siteId }, siteInfo, state, } = command.netlify;
@@ -317,18 +310,3 @@ export const link = async (options, command) => {
317
310
  }
318
311
  return siteData;
319
312
  };
320
- /**
321
- * Creates the `netlify link` command
322
- * @param {import('../base-command.mjs').default} program
323
- * @returns
324
- */
325
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
326
- export const createLinkCommand = (program) => program
327
- .command('link')
328
- .description('Link a local repo or project folder to an existing site on Netlify')
329
- .option('--id <id>', 'ID of site to link to')
330
- .option('--name <name>', 'Name of site to link to')
331
- .addOption(new Option('--gitRemoteName <name>', 'Old, prefer --git-remote-name. Name of Git remote to use. e.g. "origin"').hideHelp(true))
332
- .option('--git-remote-name <name>', 'Name of Git remote to use. e.g. "origin"')
333
- .addExamples(['netlify link', 'netlify link --id 123-123-123-123', 'netlify link --name my-site-name'])
334
- .action(link);
@@ -0,0 +1 @@
1
+ export { createLmCommand } from './lm.js';
@@ -1,9 +1,9 @@
1
1
  import { Listr } from 'listr2';
2
- import { checkGitLFSVersionStep, checkGitVersionStep, checkHelperVersionStep, checkLFSFiltersStep, } from '../../utils/lm/steps.mjs';
2
+ import { checkGitLFSVersionStep, checkGitVersionStep, checkHelperVersionStep, checkLFSFiltersStep, } from '../../utils/lm/steps.js';
3
3
  /**
4
4
  * The lm:info command
5
5
  */
6
- const lmInfo = async () => {
6
+ export const lmInfo = async () => {
7
7
  const steps = [
8
8
  checkGitVersionStep,
9
9
  checkGitLFSVersionStep,
@@ -23,10 +23,3 @@ const lmInfo = async () => {
23
23
  // an error is already reported when a task fails
24
24
  }
25
25
  };
26
- /**
27
- * Creates the `netlify lm:info` command
28
- * @param {import('../base-command.mjs').default} program
29
- * @returns
30
- */
31
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
32
- export const createLmInfoCommand = (program) => program.command('lm:info', { hidden: true }).description('Show large media requirements information.').action(lmInfo);
@@ -0,0 +1,8 @@
1
+ import { installPlatform } from '../../utils/lm/install.js';
2
+ import { printBanner } from '../../utils/lm/ui.js';
3
+ export const lmInstall = async ({ force }) => {
4
+ const installed = await installPlatform({ force });
5
+ if (installed) {
6
+ printBanner(force);
7
+ }
8
+ };
@@ -1,10 +1,10 @@
1
1
  import { Listr } from 'listr2';
2
- import { error } from '../../utils/command-helpers.mjs';
2
+ import { error } from '../../utils/command-helpers.js';
3
3
  // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
4
- import execa from '../../utils/execa.mjs';
5
- import { installPlatform } from '../../utils/lm/install.mjs';
6
- import { checkHelperVersion } from '../../utils/lm/requirements.mjs';
7
- import { printBanner } from '../../utils/lm/ui.mjs';
4
+ import execa from '../../utils/execa.js';
5
+ import { installPlatform } from '../../utils/lm/install.js';
6
+ import { checkHelperVersion } from '../../utils/lm/requirements.js';
7
+ import { printBanner } from '../../utils/lm/ui.js';
8
8
  // @ts-expect-error TS(7031) FIXME: Binding element 'force' implicitly has an 'any' ty... Remove this comment to see the full error message
9
9
  const installHelperIfMissing = async function ({ force }) {
10
10
  let installHelper = false;
@@ -48,13 +48,7 @@ const configureLFSURL = async function (siteId, api) {
48
48
  // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
49
49
  return execa('git', ['config', '-f', '.lfsconfig', 'lfs.url', url]);
50
50
  };
51
- /**
52
- * The lm:setup command
53
- * @param {import('commander').OptionValues} options
54
- * @param {import('../base-command.mjs').default} command
55
- */
56
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
57
- const lmSetup = async (options, command) => {
51
+ export const lmSetup = async (options, command) => {
58
52
  await command.authenticate();
59
53
  const { api, site } = command.netlify;
60
54
  let helperInstalled = false;
@@ -86,16 +80,3 @@ const lmSetup = async (options, command) => {
86
80
  printBanner(options.forceInstall);
87
81
  }
88
82
  };
89
- /**
90
- * Creates the `netlify lm:setup` command
91
- * @param {import('../base-command.mjs').default} program
92
- * @returns
93
- */
94
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
95
- export const createLmSetupCommand = (program) => program
96
- .command('lm:setup', { hidden: true })
97
- .description('Configures your site to use Netlify Large Media')
98
- .option('-s, --skip-install', 'Skip the credentials helper installation check')
99
- .option('-f, --force-install', 'Force the credentials helper installation')
100
- .addHelpText('after', 'It runs the install command if you have not installed the dependencies yet.')
101
- .action(lmSetup);
@@ -0,0 +1,7 @@
1
+ import { uninstall } from '../../utils/lm/install.js';
2
+ /**
3
+ * The lm:uninstall command
4
+ */
5
+ export const lmUninstall = async () => {
6
+ await uninstall();
7
+ };
@@ -0,0 +1,46 @@
1
+ const lm = (options, command) => {
2
+ command.help();
3
+ };
4
+ export const createLmCommand = (program) => {
5
+ program
6
+ .command('lm:info', { hidden: true })
7
+ .description('Show large media requirements information.')
8
+ .action(async () => {
9
+ const { lmInfo } = await import('./lm-info.js');
10
+ await lmInfo();
11
+ });
12
+ program
13
+ .command('lm:install', { hidden: true })
14
+ .alias('lm:init')
15
+ .description(`Configures your computer to use Netlify Large Media
16
+ It installs the required credentials helper for Git,
17
+ and configures your Git environment with the right credentials.`)
18
+ .option('-f, --force', 'Force the credentials helper installation')
19
+ .action(async (options) => {
20
+ const { lmInstall } = await import('./lm-install.js');
21
+ await lmInstall(options);
22
+ });
23
+ program
24
+ .command('lm:setup', { hidden: true })
25
+ .description('Configures your site to use Netlify Large Media')
26
+ .option('-s, --skip-install', 'Skip the credentials helper installation check')
27
+ .option('-f, --force-install', 'Force the credentials helper installation')
28
+ .addHelpText('after', 'It runs the install command if you have not installed the dependencies yet.')
29
+ .action(async (options, command) => {
30
+ const { lmSetup } = await import('./lm-setup.js');
31
+ await lmSetup(options, command);
32
+ });
33
+ program
34
+ .command('lm:uninstall', { hidden: true })
35
+ .alias('lm:remove')
36
+ .description('Uninstalls Netlify git credentials helper and cleans up any related configuration changes made by the install command.')
37
+ .action(async () => {
38
+ const { lmUninstall } = await import('./lm-uninstall.js');
39
+ await lmUninstall();
40
+ });
41
+ program
42
+ .command('lm', { hidden: true })
43
+ .description('[Deprecated and will be removed from future versions] Handle Netlify Large Media operations\nThe lm command will help you manage large media for a site')
44
+ .addExamples(['netlify lm:info', 'netlify lm:install', 'netlify lm:setup'])
45
+ .action(lm);
46
+ };
@@ -0,0 +1,9 @@
1
+ export const createLoginCommand = (program) => program
2
+ .command('login')
3
+ .description(`Login to your Netlify account
4
+ Opens a web browser to acquire an OAuth token.`)
5
+ .option('--new', 'Login to new Netlify account')
6
+ .action(async (options, command) => {
7
+ const { login } = await import('./login.js');
8
+ await login(options, command);
9
+ });
@@ -1,4 +1,4 @@
1
- import { chalk, exit, getToken, log } from '../../utils/command-helpers.mjs';
1
+ import { chalk, exit, getToken, log } from '../../utils/command-helpers.js';
2
2
  // @ts-expect-error TS(7006) FIXME: Parameter 'location' implicitly has an 'any' type.
3
3
  const msg = function (location) {
4
4
  switch (location) {
@@ -12,12 +12,6 @@ const msg = function (location) {
12
12
  return '';
13
13
  }
14
14
  };
15
- /**
16
- * The login command
17
- * @param {import('commander').OptionValues} options
18
- * @param {import('../base-command.mjs').default} command
19
- */
20
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
21
15
  export const login = async (options, command) => {
22
16
  // @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
23
17
  const [accessToken, location] = await getToken();
@@ -35,15 +29,3 @@ export const login = async (options, command) => {
35
29
  }
36
30
  await command.expensivelyAuthenticate();
37
31
  };
38
- /**
39
- * Creates the `netlify login` command
40
- * @param {import('../base-command.mjs').default} program
41
- * @returns
42
- */
43
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
44
- export const createLoginCommand = (program) => program
45
- .command('login')
46
- .description(`Login to your Netlify account
47
- Opens a web browser to acquire an OAuth token.`)
48
- .option('--new', 'Login to new Netlify account')
49
- .action(login);
@@ -0,0 +1,7 @@
1
+ export const createLogoutCommand = (program) => program
2
+ .command('logout', { hidden: true })
3
+ .description('Logout of your Netlify account')
4
+ .action(async (options, command) => {
5
+ const { logout } = await import('./logout.js');
6
+ await logout(options, command);
7
+ });
@@ -1,12 +1,6 @@
1
- import { exit, getToken, log } from '../../utils/command-helpers.mjs';
2
- import { track } from '../../utils/telemetry/index.mjs';
3
- /**
4
- * The logout command
5
- * @param {import('commander').OptionValues} options
6
- * @param {import('../base-command.mjs').default} command
7
- */
8
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
9
- const logout = async (options, command) => {
1
+ import { exit, getToken, log } from '../../utils/command-helpers.js';
2
+ import { track } from '../../utils/telemetry/index.js';
3
+ export const logout = async (options, command) => {
10
4
  // @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
11
5
  const [accessToken, location] = await getToken();
12
6
  if (!accessToken) {
@@ -27,10 +21,3 @@ const logout = async (options, command) => {
27
21
  }
28
22
  log(`Logging you out of Netlify. Come back soon!`);
29
23
  };
30
- /**
31
- * Creates the `netlify logout` command
32
- * @param {import('../base-command.mjs').default} program
33
- * @returns
34
- */
35
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
36
- export const createLogoutCommand = (program) => program.command('logout', { hidden: true }).description('Logout of your Netlify account').action(logout);
@@ -1,6 +1,6 @@
1
1
  import inquirer from 'inquirer';
2
- import { log, chalk } from '../../utils/command-helpers.mjs';
3
- import { getWebSocket } from '../../utils/websockets/index.mjs';
2
+ import { log, chalk } from '../../utils/command-helpers.js';
3
+ import { getWebSocket } from '../../utils/websockets/index.js';
4
4
  export function getName({ deploy, userId }) {
5
5
  let normalisedName = '';
6
6
  const isUserDeploy = deploy.user_id === userId;
@@ -24,7 +24,7 @@ export function getName({ deploy, userId }) {
24
24
  }
25
25
  return `(${deploy.id.slice(0, 7)}) ${normalisedName}`;
26
26
  }
27
- const logsBuild = async (options, command) => {
27
+ export const logsBuild = async (options, command) => {
28
28
  await command.authenticate();
29
29
  const client = command.netlify.api;
30
30
  const { site } = command.netlify;
@@ -65,8 +65,3 @@ const logsBuild = async (options, command) => {
65
65
  log('---');
66
66
  });
67
67
  };
68
- export const createLogsBuildCommand = (program) => program
69
- .command('logs:deploy')
70
- .alias('logs:build')
71
- .description('(Beta) Stream the logs of deploys currently being built to the console')
72
- .action(logsBuild);