netlify-cli 17.6.0 → 17.7.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} +1 -1
  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} +3 -3
  109. package/src/lib/functions/{registry.mjs → registry.js} +9 -9
  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} +15 -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} +2 -2
  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} +11 -11
  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,74 @@
1
+ import requiresSiteInfo from '../../utils/hooks/requires-site-info.js';
2
+ /**
3
+ * The blobs command
4
+ */
5
+ const blobs = (_options, command) => {
6
+ command.help();
7
+ };
8
+ /**
9
+ * Creates the `netlify blobs` command
10
+ */
11
+ export const createBlobsCommand = (program) => {
12
+ program
13
+ .command('blobs:delete')
14
+ .description(`(Beta) Deletes an object with a given key, if it exists, from a Netlify Blobs store`)
15
+ .argument('<store>', 'Name of the store')
16
+ .argument('<key>', 'Object key')
17
+ .alias('blob:delete')
18
+ .hook('preAction', requiresSiteInfo)
19
+ .action(async (storeName, key, _options, command) => {
20
+ const { blobsDelete } = await import('./blobs-delete.js');
21
+ await blobsDelete(storeName, key, _options, command);
22
+ });
23
+ program
24
+ .command('blobs:get')
25
+ .description(`(Beta) Reads an object with a given key from a Netlify Blobs store and, if it exists, prints the content to the terminal or saves it to a file`)
26
+ .argument('<store>', 'Name of the store')
27
+ .argument('<key>', 'Object key')
28
+ .option('-o, --output <path>', 'Defines the filesystem path where the blob data should be persisted')
29
+ .alias('blob:get')
30
+ .hook('preAction', requiresSiteInfo)
31
+ .action(async (storeName, key, options, command) => {
32
+ const { blobsGet } = await import('./blobs-get.js');
33
+ await blobsGet(storeName, key, options, command);
34
+ });
35
+ program
36
+ .command('blobs:list')
37
+ .description(`(Beta) Lists objects in a Netlify Blobs store`)
38
+ .argument('<store>', 'Name of the store')
39
+ .option('-d, --directories', `Indicates that keys with the '/' character should be treated as directories, returning a list of sub-directories at a given level rather than all the keys inside them`)
40
+ .option('-p, --prefix <prefix>', `A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned`)
41
+ .option('--json', `Output list contents as JSON`)
42
+ .alias('blob:list')
43
+ .hook('preAction', requiresSiteInfo)
44
+ .action(async (storeName, options, command) => {
45
+ const { blobsList } = await import('./blobs-list.js');
46
+ await blobsList(storeName, options, command);
47
+ });
48
+ program
49
+ .command('blobs:set')
50
+ .description(`(Beta) Writes to a Netlify Blobs store an object with the data provided in the command or the contents of a file defined by the 'input' parameter`)
51
+ .argument('<store>', 'Name of the store')
52
+ .argument('<key>', 'Object key')
53
+ .argument('[value...]', 'Object value')
54
+ .option('-i, --input <path>', 'Defines the filesystem path where the blob data should be read from')
55
+ .alias('blob:set')
56
+ .hook('preAction', requiresSiteInfo)
57
+ .action(async (storeName, key, valueParts, options, command) => {
58
+ const { blobsSet } = await import('./blobs-set.js');
59
+ await blobsSet(storeName, key, valueParts, options, command);
60
+ });
61
+ return program
62
+ .command('blobs')
63
+ .alias('blob')
64
+ .description(`(Beta) Manage objects in Netlify Blobs`)
65
+ .addExamples([
66
+ 'netlify blobs:get my-store my-key',
67
+ 'netlify blobs:set my-store my-key This will go in a blob',
68
+ 'netlify blobs:set my-store my-key --input ./some-file.txt',
69
+ 'netlify blobs:delete my-store my-key',
70
+ 'netlify blobs:list my-store',
71
+ 'netlify blobs:list my-store --json',
72
+ ])
73
+ .action(blobs);
74
+ };
@@ -0,0 +1 @@
1
+ export { createBlobsCommand } from './blobs.js';
@@ -1,10 +1,9 @@
1
- import process from 'process';
2
- import { getBuildOptions, runBuild } from '../../lib/build.mjs';
3
- import { detectFrameworkSettings } from '../../utils/build-info.mjs';
4
- import { error, exit, getToken } from '../../utils/command-helpers.mjs';
5
- import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs';
1
+ import { getBuildOptions, runBuild } from '../../lib/build.js';
2
+ import { detectFrameworkSettings } from '../../utils/build-info.js';
3
+ import { error, exit, getToken } from '../../utils/command-helpers.js';
4
+ import { getEnvelopeEnv } from '../../utils/env/index.js';
6
5
  /**
7
- * @param {import('../../lib/build.mjs').BuildConfig} options
6
+ * @param {import('../../lib/build.js').BuildConfig} options
8
7
  */
9
8
  // @ts-expect-error TS(7031) FIXME: Binding element 'token' implicitly has an 'any' ty... Remove this comment to see the full error message
10
9
  export const checkOptions = ({ cachedConfig: { siteInfo = {} }, token }) => {
@@ -24,13 +23,7 @@ const injectEnv = async function (command, { api, buildOptions, context, siteInf
24
23
  buildOptions.cachedConfig.env = await getEnvelopeEnv({ api, context, env, siteInfo });
25
24
  }
26
25
  };
27
- /**
28
- * The build command
29
- * @param {import('commander').OptionValues} options
30
- * @param {import('../base-command.mjs').default} command
31
- */
32
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
33
- const build = async (options, command) => {
26
+ export const build = async (options, command) => {
34
27
  const { cachedConfig, siteInfo } = command.netlify;
35
28
  command.setAnalyticsPayload({ dry: options.dry });
36
29
  // Retrieve Netlify Build options
@@ -42,12 +35,12 @@ const build = async (options, command) => {
42
35
  cachedConfig.config.build.command = settings?.buildCommand;
43
36
  cachedConfig.config.build.commandOrigin = 'heuristics';
44
37
  }
45
- // @ts-expect-error TS(2345) FIXME: Argument of type '{ cachedConfig: any; packagePath... Remove this comment to see the full error message
46
38
  const buildOptions = await getBuildOptions({
47
39
  cachedConfig,
48
40
  packagePath: command.workspacePackage,
49
41
  currentDir: command.workingDir,
50
42
  token,
43
+ // @ts-expect-error TS(2740)
51
44
  options,
52
45
  });
53
46
  if (!options.offline) {
@@ -60,17 +53,3 @@ const build = async (options, command) => {
60
53
  const { exitCode } = await runBuild(buildOptions);
61
54
  exit(exitCode);
62
55
  };
63
- /**
64
- * Creates the `netlify build` command
65
- * @param {import('../base-command.mjs').default} program
66
- * @returns
67
- */
68
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
69
- export const createBuildCommand = (program) => program
70
- .command('build')
71
- .description('Build on your local machine')
72
- .option('--context <context>', 'Specify a build context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev")', normalizeContext, process.env.CONTEXT || 'production')
73
- .option('--dry', 'Dry run: show instructions without running them', false)
74
- .option('-o, --offline', 'disables any features that require network access', false)
75
- .addExamples(['netlify build'])
76
- .action(build);
@@ -0,0 +1,13 @@
1
+ import process from 'process';
2
+ import { normalizeContext } from '../../utils/env/index.js';
3
+ export const createBuildCommand = (program) => program
4
+ .command('build')
5
+ .description('Build on your local machine')
6
+ .option('--context <context>', 'Specify a build context or branch (contexts: "production", "deploy-preview", "branch-deploy", "dev")', normalizeContext, process.env.CONTEXT || 'production')
7
+ .option('--dry', 'Dry run: show instructions without running them', false)
8
+ .option('-o, --offline', 'disables any features that require network access', false)
9
+ .addExamples(['netlify build'])
10
+ .action(async (options, command) => {
11
+ const { build } = await import('./build.js');
12
+ await build(options, command);
13
+ });
@@ -0,0 +1,29 @@
1
+ import { dirname, join } from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'tabt... Remove this comment to see the full error message
4
+ import { install, uninstall } from 'tabtab';
5
+ import { generateAutocompletion } from '../../lib/completion/index.js';
6
+ import { error } from '../../utils/command-helpers.js';
7
+ const completer = join(dirname(fileURLToPath(import.meta.url)), '../../lib/completion/script.js');
8
+ export const completionGenerate = async (options, command) => {
9
+ const { parent } = command;
10
+ if (!parent) {
11
+ error(`There has been an error generating the completion script.`);
12
+ return;
13
+ }
14
+ generateAutocompletion(parent);
15
+ await install({
16
+ name: parent.name(),
17
+ completer,
18
+ });
19
+ console.log(`Completion for ${parent.name()} successful installed!`);
20
+ };
21
+ export const completionUninstall = async (options, command) => {
22
+ if (!command.parent) {
23
+ error(`There has been an error deleting the completion script.`);
24
+ return;
25
+ }
26
+ await uninstall({
27
+ name: command.parent.name(),
28
+ });
29
+ };
@@ -0,0 +1,26 @@
1
+ export const createCompletionCommand = (program) => {
2
+ program
3
+ .command('completion:install')
4
+ .alias('completion:generate')
5
+ .description('Generates completion script for your preferred shell')
6
+ .action(async (options, command) => {
7
+ const { completionGenerate } = await import('./completion.js');
8
+ await completionGenerate(options, command);
9
+ });
10
+ program
11
+ .command('completion:uninstall', { hidden: true })
12
+ .alias('completion:remove')
13
+ .description('Uninstalls the installed completions')
14
+ .addExamples(['netlify completion:uninstall'])
15
+ .action(async (options, command) => {
16
+ const { completionUninstall } = await import('./completion.js');
17
+ await completionUninstall(options, command);
18
+ });
19
+ return program
20
+ .command('completion')
21
+ .description('Generate shell completion script\nRun this command to see instructions for your shell.')
22
+ .addExamples(['netlify completion:install'])
23
+ .action((options, command) => {
24
+ command.help();
25
+ });
26
+ };
@@ -1,29 +1,27 @@
1
1
  import { stat } from 'fs/promises';
2
2
  import { basename, resolve } from 'path';
3
- import { env } from 'process';
4
3
  import { runCoreSteps } from '@netlify/build';
5
- import { Option } from 'commander';
6
4
  import inquirer from 'inquirer';
7
5
  import isEmpty from 'lodash/isEmpty.js';
8
6
  import isObject from 'lodash/isObject.js';
9
7
  import { parseAllHeaders } from 'netlify-headers-parser';
10
8
  import { parseAllRedirects } from 'netlify-redirect-parser';
11
9
  import prettyjson from 'prettyjson';
12
- import { cancelDeploy } from '../../lib/api.mjs';
13
- import { getBuildOptions, runBuild } from '../../lib/build.mjs';
14
- import { getBootstrapURL } from '../../lib/edge-functions/bootstrap.mjs';
15
- import { featureFlags as edgeFunctionsFeatureFlags } from '../../lib/edge-functions/consts.mjs';
16
- import { normalizeFunctionsConfig } from '../../lib/functions/config.mjs';
17
- import { BACKGROUND_FUNCTIONS_WARNING } from '../../lib/log.mjs';
18
- import { startSpinner, stopSpinner } from '../../lib/spinner.mjs';
19
- import { chalk, error, exit, getToken, log, logJson, NETLIFYDEV, NETLIFYDEVERR, NETLIFYDEVLOG, warn, } from '../../utils/command-helpers.mjs';
20
- import { DEFAULT_DEPLOY_TIMEOUT } from '../../utils/deploy/constants.mjs';
21
- import { deploySite } from '../../utils/deploy/deploy-site.mjs';
22
- import { getEnvelopeEnv } from '../../utils/env/index.mjs';
23
- import { getFunctionsManifestPath, getInternalFunctionsDir } from '../../utils/functions/index.mjs';
24
- import openBrowser from '../../utils/open-browser.mjs';
25
- import { link } from '../link/index.mjs';
26
- import { sitesCreate } from '../sites/index.mjs';
10
+ import { cancelDeploy } from '../../lib/api.js';
11
+ import { getBuildOptions, runBuild } from '../../lib/build.js';
12
+ import { getBootstrapURL } from '../../lib/edge-functions/bootstrap.js';
13
+ import { featureFlags as edgeFunctionsFeatureFlags } from '../../lib/edge-functions/consts.js';
14
+ import { normalizeFunctionsConfig } from '../../lib/functions/config.js';
15
+ import { BACKGROUND_FUNCTIONS_WARNING } from '../../lib/log.js';
16
+ import { startSpinner, stopSpinner } from '../../lib/spinner.js';
17
+ import { chalk, error, exit, getToken, log, logJson, NETLIFYDEV, NETLIFYDEVERR, NETLIFYDEVLOG, warn, } from '../../utils/command-helpers.js';
18
+ import { DEFAULT_DEPLOY_TIMEOUT } from '../../utils/deploy/constants.js';
19
+ import { deploySite } from '../../utils/deploy/deploy-site.js';
20
+ import { getEnvelopeEnv } from '../../utils/env/index.js';
21
+ import { getFunctionsManifestPath, getInternalFunctionsDir } from '../../utils/functions/index.js';
22
+ import openBrowser from '../../utils/open-browser.js';
23
+ import { link } from '../link/link.js';
24
+ import { sitesCreate } from '../sites/sites-create.js';
27
25
  // @ts-expect-error TS(7031) FIXME: Binding element 'api' implicitly has an 'any' type... Remove this comment to see the full error message
28
26
  const triggerDeploy = async ({ api, options, siteData, siteId }) => {
29
27
  try {
@@ -54,7 +52,7 @@ const triggerDeploy = async ({ api, options, siteData, siteId }) => {
54
52
  /**
55
53
  * Retrieves the folder containing the static files that need to be deployed
56
54
  * @param {object} config
57
- * @param {import('../base-command.mjs').default} config.command The process working directory
55
+ * @param {import('../base-command.js').default} config.command The process working directory
58
56
  * @param {object} config.config
59
57
  * @param {import('commander').OptionValues} config.options
60
58
  * @param {object} config.site
@@ -457,7 +455,7 @@ const handleBuild = async ({ cachedConfig, currentDir, deployHandler, options, p
457
455
  /**
458
456
  *
459
457
  * @param {*} options Bundling options
460
- * @param {import('..//base-command.mjs').default} command
458
+ * @param {import('..//base-command.js').default} command
461
459
  * @returns
462
460
  */
463
461
  // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
@@ -629,12 +627,6 @@ workingDir, }) => {
629
627
  });
630
628
  return results;
631
629
  };
632
- /**
633
- * The deploy command
634
- * @param {import('commander').OptionValues} options
635
- * @param {import('../base-command.mjs').default} command
636
- */
637
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
638
630
  export const deploy = async (options, command) => {
639
631
  const { workingDir } = command;
640
632
  const { api, site, siteInfo } = command.netlify;
@@ -740,111 +732,3 @@ export const deploy = async (options, command) => {
740
732
  exit();
741
733
  }
742
734
  };
743
- /**
744
- * Creates the `netlify deploy` command
745
- * @param {import('../base-command.mjs').default} program
746
- * @returns
747
- */
748
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
749
- export const createDeployCommand = (program) => program
750
- .command('deploy')
751
- .description(`Create a new deploy from the contents of a folder
752
- Deploys from the build settings found in the netlify.toml file, or settings from the API.
753
-
754
- The following environment variables can be used to override configuration file lookups and prompts:
755
-
756
- - \`NETLIFY_AUTH_TOKEN\` - an access token to use when authenticating commands. Keep this value private.
757
- - \`NETLIFY_SITE_ID\` - override any linked site in the current working directory.
758
-
759
- Lambda functions in the function folder can be in the following configurations for deployment:
760
-
761
-
762
- Built Go binaries:
763
- ------------------
764
-
765
- \`\`\`
766
- functions/
767
- └── nameOfGoFunction
768
- \`\`\`
769
-
770
- Build binaries of your Go language functions into the functions folder as part of your build process.
771
-
772
-
773
- Single file Node.js functions:
774
- -----------------------------
775
-
776
- Build dependency bundled Node.js lambda functions with tools like netlify-lambda, webpack or browserify into the function folder as part of your build process.
777
-
778
- \`\`\`
779
- functions/
780
- └── nameOfBundledNodeJSFunction.js
781
- \`\`\`
782
-
783
- Unbundled Node.js functions that have dependencies outside or inside of the functions folder:
784
- ---------------------------------------------------------------------------------------------
785
-
786
- You can ship unbundled Node.js functions with the CLI, utilizing top level project dependencies, or a nested package.json.
787
- If you use nested dependencies, be sure to populate the nested node_modules as part of your build process before deploying using npm or yarn.
788
-
789
- \`\`\`
790
- project/
791
- ├── functions
792
- │ ├── functionName/
793
- │ │ ├── functionName.js (Note the folder and the function name need to match)
794
- │ │ ├── package.json
795
- │ │ └── node_modules/
796
- │ └── unbundledFunction.js
797
- ├── package.json
798
- ├── netlify.toml
799
- └── node_modules/
800
- \`\`\`
801
-
802
- Any mix of these configurations works as well.
803
-
804
-
805
- Node.js function entry points
806
- -----------------------------
807
-
808
- Function entry points are determined by the file name and name of the folder they are in:
809
-
810
- \`\`\`
811
- functions/
812
- ├── aFolderlessFunctionEntrypoint.js
813
- └── functionName/
814
- ├── notTheEntryPoint.js
815
- └── functionName.js
816
- \`\`\`
817
-
818
- Support for package.json's main field, and intrinsic index.js entrypoints are coming soon.`)
819
- .option('-d, --dir <path>', 'Specify a folder to deploy')
820
- .option('-f, --functions <folder>', 'Specify a functions folder to deploy')
821
- .option('-p, --prod', 'Deploy to production', false)
822
- .addOption(new Option('--prodIfUnlocked', 'Old, prefer --prod-if-unlocked. Deploy to production if unlocked, create a draft otherwise')
823
- .default(false)
824
- .hideHelp(true))
825
- .option('--prod-if-unlocked', 'Deploy to production if unlocked, create a draft otherwise', false)
826
- .option('--alias <name>', 'Specifies the alias for deployment, the string at the beginning of the deploy subdomain. Useful for creating predictable deployment URLs. Avoid setting an alias string to the same value as a deployed branch. `alias` doesn’t create a branch deploy and can’t be used in conjunction with the branch subdomain feature. Maximum 37 characters.')
827
- .option('-b, --branch <name>', 'Serves the same functionality as --alias. Deprecated and will be removed in future versions')
828
- .option('-o, --open', 'Open site after deploy', false)
829
- .option('-m, --message <message>', 'A short message to include in the deploy log')
830
- .option('-a, --auth <token>', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN)
831
- .option('-s, --site <name-or-id>', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID)
832
- .option('--json', 'Output deployment data as JSON')
833
- // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
834
- .option('--timeout <number>', 'Timeout to wait for deployment to finish', (value) => Number.parseInt(value))
835
- .option('--trigger', 'Trigger a new build of your site on Netlify without uploading local files')
836
- .option('--build', 'Run build command before deploying')
837
- .option('--context <context>', 'Context to use when resolving build configuration')
838
- .option('--skip-functions-cache', 'Ignore any functions created as part of a previous `build` or `deploy` commands, forcing them to be bundled again as part of the deployment', false)
839
- .addExamples([
840
- 'netlify deploy',
841
- 'netlify deploy --site my-first-site',
842
- 'netlify deploy --prod',
843
- 'netlify deploy --prod --open',
844
- 'netlify deploy --prod-if-unlocked',
845
- 'netlify deploy --message "A message with an $ENV_VAR"',
846
- 'netlify deploy --auth $NETLIFY_AUTH_TOKEN',
847
- 'netlify deploy --trigger',
848
- 'netlify deploy --build --context deploy-preview',
849
- ])
850
- .action(deploy);
@@ -0,0 +1,106 @@
1
+ import { env } from 'process';
2
+ import { Option } from 'commander';
3
+ export const createDeployCommand = (program) => program
4
+ .command('deploy')
5
+ .description(`Create a new deploy from the contents of a folder
6
+ Deploys from the build settings found in the netlify.toml file, or settings from the API.
7
+
8
+ The following environment variables can be used to override configuration file lookups and prompts:
9
+
10
+ - \`NETLIFY_AUTH_TOKEN\` - an access token to use when authenticating commands. Keep this value private.
11
+ - \`NETLIFY_SITE_ID\` - override any linked site in the current working directory.
12
+
13
+ Lambda functions in the function folder can be in the following configurations for deployment:
14
+
15
+
16
+ Built Go binaries:
17
+ ------------------
18
+
19
+ \`\`\`
20
+ functions/
21
+ └── nameOfGoFunction
22
+ \`\`\`
23
+
24
+ Build binaries of your Go language functions into the functions folder as part of your build process.
25
+
26
+
27
+ Single file Node.js functions:
28
+ -----------------------------
29
+
30
+ Build dependency bundled Node.js lambda functions with tools like netlify-lambda, webpack or browserify into the function folder as part of your build process.
31
+
32
+ \`\`\`
33
+ functions/
34
+ └── nameOfBundledNodeJSFunction.js
35
+ \`\`\`
36
+
37
+ Unbundled Node.js functions that have dependencies outside or inside of the functions folder:
38
+ ---------------------------------------------------------------------------------------------
39
+
40
+ You can ship unbundled Node.js functions with the CLI, utilizing top level project dependencies, or a nested package.json.
41
+ If you use nested dependencies, be sure to populate the nested node_modules as part of your build process before deploying using npm or yarn.
42
+
43
+ \`\`\`
44
+ project/
45
+ ├── functions
46
+ │ ├── functionName/
47
+ │ │ ├── functionName.js (Note the folder and the function name need to match)
48
+ │ │ ├── package.json
49
+ │ │ └── node_modules/
50
+ │ └── unbundledFunction.js
51
+ ├── package.json
52
+ ├── netlify.toml
53
+ └── node_modules/
54
+ \`\`\`
55
+
56
+ Any mix of these configurations works as well.
57
+
58
+
59
+ Node.js function entry points
60
+ -----------------------------
61
+
62
+ Function entry points are determined by the file name and name of the folder they are in:
63
+
64
+ \`\`\`
65
+ functions/
66
+ ├── aFolderlessFunctionEntrypoint.js
67
+ └── functionName/
68
+ ├── notTheEntryPoint.js
69
+ └── functionName.js
70
+ \`\`\`
71
+
72
+ Support for package.json's main field, and intrinsic index.js entrypoints are coming soon.`)
73
+ .option('-d, --dir <path>', 'Specify a folder to deploy')
74
+ .option('-f, --functions <folder>', 'Specify a functions folder to deploy')
75
+ .option('-p, --prod', 'Deploy to production', false)
76
+ .addOption(new Option('--prodIfUnlocked', 'Old, prefer --prod-if-unlocked. Deploy to production if unlocked, create a draft otherwise')
77
+ .default(false)
78
+ .hideHelp(true))
79
+ .option('--prod-if-unlocked', 'Deploy to production if unlocked, create a draft otherwise', false)
80
+ .option('--alias <name>', 'Specifies the alias for deployment, the string at the beginning of the deploy subdomain. Useful for creating predictable deployment URLs. Avoid setting an alias string to the same value as a deployed branch. `alias` doesn’t create a branch deploy and can’t be used in conjunction with the branch subdomain feature. Maximum 37 characters.')
81
+ .option('-b, --branch <name>', 'Serves the same functionality as --alias. Deprecated and will be removed in future versions')
82
+ .option('-o, --open', 'Open site after deploy', false)
83
+ .option('-m, --message <message>', 'A short message to include in the deploy log')
84
+ .option('-a, --auth <token>', 'Netlify auth token to deploy with', env.NETLIFY_AUTH_TOKEN)
85
+ .option('-s, --site <name-or-id>', 'A site name or ID to deploy to', env.NETLIFY_SITE_ID)
86
+ .option('--json', 'Output deployment data as JSON')
87
+ .option('--timeout <number>', 'Timeout to wait for deployment to finish', (value) => Number.parseInt(value))
88
+ .option('--trigger', 'Trigger a new build of your site on Netlify without uploading local files')
89
+ .option('--build', 'Run build command before deploying')
90
+ .option('--context <context>', 'Context to use when resolving build configuration')
91
+ .option('--skip-functions-cache', 'Ignore any functions created as part of a previous `build` or `deploy` commands, forcing them to be bundled again as part of the deployment', false)
92
+ .addExamples([
93
+ 'netlify deploy',
94
+ 'netlify deploy --site my-first-site',
95
+ 'netlify deploy --prod',
96
+ 'netlify deploy --prod --open',
97
+ 'netlify deploy --prod-if-unlocked',
98
+ 'netlify deploy --message "A message with an $ENV_VAR"',
99
+ 'netlify deploy --auth $NETLIFY_AUTH_TOKEN',
100
+ 'netlify deploy --trigger',
101
+ 'netlify deploy --build --context deploy-preview',
102
+ ])
103
+ .action(async (options, command) => {
104
+ const { deploy } = await import('./deploy.js');
105
+ await deploy(options, command);
106
+ });
@@ -1,13 +1,7 @@
1
1
  import execa from 'execa';
2
- import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.mjs';
3
- import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs';
4
- /**
5
- * The dev:exec command
6
- * @param {import('commander').OptionValues} options
7
- * @param {import('../base-command.mjs').default} command
8
- */
9
- // @ts-expect-error TS(7006) FIXME: Parameter 'cmd' implicitly has an 'any' type.
10
- const devExec = async (cmd, options, command) => {
2
+ import { getDotEnvVariables, injectEnvVariables } from '../../utils/dev.js';
3
+ import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.js';
4
+ export const devExec = async (cmd, options, command) => {
11
5
  const { api, cachedConfig, config, site, siteInfo } = command.netlify;
12
6
  let { env } = cachedConfig;
13
7
  if (siteInfo.use_envelope) {
@@ -19,12 +13,6 @@ const devExec = async (cmd, options, command) => {
19
13
  stdio: 'inherit',
20
14
  });
21
15
  };
22
- /**
23
- * Creates the `netlify dev:exec` command
24
- * @param {import('../base-command.mjs').default} program
25
- * @returns
26
- */
27
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
28
16
  export const createDevExecCommand = (program) => program
29
17
  .command('dev:exec')
30
18
  .argument('<...cmd>', `the command that should be executed`)
@@ -1,21 +1,21 @@
1
1
  import process from 'process';
2
2
  import { Option } from 'commander';
3
- import { getBlobsContext } from '../../lib/blobs/blobs.mjs';
4
- import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.mjs';
5
- import { startFunctionsServer } from '../../lib/functions/server.mjs';
6
- import { printBanner } from '../../utils/banner.mjs';
7
- import { BANG, chalk, log, NETLIFYDEV, NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, normalizeConfig, } from '../../utils/command-helpers.mjs';
8
- import detectServerSettings, { getConfigWithPlugins } from '../../utils/detect-server-settings.mjs';
9
- import { getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs';
10
- import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs';
11
- import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs';
12
- import { getLiveTunnelSlug, startLiveTunnel } from '../../utils/live-tunnel.mjs';
13
- import openBrowser from '../../utils/open-browser.mjs';
14
- import { generateInspectSettings, startProxyServer } from '../../utils/proxy-server.mjs';
15
- import { getProxyUrl } from '../../utils/proxy.mjs';
16
- import { runDevTimeline } from '../../utils/run-build.mjs';
17
- import { getGeoCountryArgParser } from '../../utils/validation.mjs';
18
- import { createDevExecCommand } from './dev-exec.mjs';
3
+ import { getBlobsContext } from '../../lib/blobs/blobs.js';
4
+ import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.js';
5
+ import { startFunctionsServer } from '../../lib/functions/server.js';
6
+ import { printBanner } from '../../utils/banner.js';
7
+ import { BANG, chalk, log, NETLIFYDEV, NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, normalizeConfig, } from '../../utils/command-helpers.js';
8
+ import detectServerSettings, { getConfigWithPlugins } from '../../utils/detect-server-settings.js';
9
+ import { getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.js';
10
+ import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.js';
11
+ import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
12
+ import { getLiveTunnelSlug, startLiveTunnel } from '../../utils/live-tunnel.js';
13
+ import openBrowser from '../../utils/open-browser.js';
14
+ import { generateInspectSettings, startProxyServer } from '../../utils/proxy-server.js';
15
+ import { getProxyUrl } from '../../utils/proxy.js';
16
+ import { runDevTimeline } from '../../utils/run-build.js';
17
+ import { getGeoCountryArgParser } from '../../utils/validation.js';
18
+ import { createDevExecCommand } from './dev-exec.js';
19
19
  /**
20
20
  *
21
21
  * @param {object} config
@@ -47,10 +47,6 @@ const handleLiveTunnel = async ({ api, options, settings, site, state }) => {
47
47
  return sessionUrl;
48
48
  }
49
49
  };
50
- /**
51
- * @param {string} args
52
- */
53
- // @ts-expect-error TS(7006) FIXME: Parameter 'args' implicitly has an 'any' type.
54
50
  const validateShortFlagArgs = (args) => {
55
51
  if (args.startsWith('=')) {
56
52
  throw new Error(`Short flag options like -e or -E don't support the '=' sign
@@ -64,13 +60,7 @@ const validateShortFlagArgs = (args) => {
64
60
  }
65
61
  return args;
66
62
  };
67
- /**
68
- * The dev command
69
- * @param {import('commander').OptionValues} options
70
- * @param {import('../base-command.mjs').default} command
71
- */
72
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
73
- const dev = async (options, command) => {
63
+ export const dev = async (options, command) => {
74
64
  log(`${NETLIFYDEV}`);
75
65
  const { api, cachedConfig, config, repositoryRoot, site, siteInfo, state } = command.netlify;
76
66
  config.dev = { ...config.dev };
@@ -195,27 +185,19 @@ const dev = async (options, command) => {
195
185
  }
196
186
  printBanner({ url });
197
187
  };
198
- /**
199
- * Creates the `netlify dev` command
200
- * @param {import('../base-command.mjs').default} program
201
- * @returns
202
- */
203
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
204
188
  export const createDevCommand = (program) => {
205
189
  createDevExecCommand(program);
206
- return (program
190
+ return program
207
191
  .command('dev')
208
192
  .alias('develop')
209
193
  .description(`Local dev server\nThe dev command will run a local dev server with Netlify's proxy and redirect rules`)
210
194
  .option('-c ,--command <command>', 'command to run')
211
195
  .option('--context <context>', 'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")', normalizeContext)
212
- // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
213
196
  .option('-p ,--port <port>', 'port of netlify dev', (value) => Number.parseInt(value))
214
197
  .addOption(new Option('--targetPort <port>', 'Old, prefer --target-port. Port of target app server')
215
198
  .argParser((value) => Number.parseInt(value))
216
199
  .hideHelp(true))
217
200
  .addOption(new Option('--no-open', 'disables the automatic opening of a browser window'))
218
- // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
219
201
  .option('--target-port <port>', 'port of target app server', (value) => Number.parseInt(value))
220
202
  .option('--framework <name>', 'framework to use. Defaults to #auto which automatically detects a framework')
221
203
  .option('-d ,--dir <path>', 'dir with static files')
@@ -225,7 +207,6 @@ export const createDevCommand = (program) => {
225
207
  .addOption(new Option('--functionsPort <port>', 'Old, prefer --functions-port. Port of functions server')
226
208
  .argParser((value) => Number.parseInt(value))
227
209
  .hideHelp(true))
228
- // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
229
210
  .option('--functions-port <port>', 'port of functions server', (value) => Number.parseInt(value))
230
211
  .addOption(new Option('--geo <mode>', 'force geolocation data to be updated, use cached data from the last 24h if found, or use a mock location')
231
212
  .choices(['cache', 'mock', 'update'])
@@ -259,5 +240,5 @@ export const createDevCommand = (program) => {
259
240
  'netlify dev --edge-inspect-brk=127.0.0.1:9229',
260
241
  'BROWSER=none netlify dev # disable browser auto opening',
261
242
  ])
262
- .action(dev));
243
+ .action(dev);
263
244
  };
@@ -0,0 +1 @@
1
+ export { createDevCommand } from './dev.js';