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
@@ -1,18 +1,7 @@
1
- import { Argument, Option } from 'commander';
2
1
  import inquirer from 'inquirer';
3
- import { chalk, log } from '../../utils/command-helpers.mjs';
4
- import { getWebSocket } from '../../utils/websockets/index.mjs';
5
- // Source: Source: https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-advanced
6
- export const LOG_LEVELS = {
7
- TRACE: 'TRACE',
8
- DEBUG: 'DEBUG',
9
- INFO: 'INFO',
10
- WARN: 'WARN',
11
- ERROR: 'ERROR',
12
- FATAL: 'FATAL',
13
- };
14
- const LOG_LEVELS_LIST = Object.values(LOG_LEVELS).map((level) => level.toLowerCase());
15
- const CLI_LOG_LEVEL_CHOICES_STRING = LOG_LEVELS_LIST.map((level) => ` ${level}`);
2
+ import { chalk, log } from '../../utils/command-helpers.js';
3
+ import { getWebSocket } from '../../utils/websockets/index.js';
4
+ import { CLI_LOG_LEVEL_CHOICES_STRING, LOG_LEVELS, LOG_LEVELS_LIST } from './log-levels.js';
16
5
  function getLog(logData) {
17
6
  let logString = '';
18
7
  switch (logData.level) {
@@ -31,7 +20,7 @@ function getLog(logData) {
31
20
  }
32
21
  return `${logString} ${logData.message}`;
33
22
  }
34
- const logsFunction = async (functionName, options, command) => {
23
+ export const logsFunction = async (functionName, options, command) => {
35
24
  const client = command.netlify.api;
36
25
  const { site } = command.netlify;
37
26
  const { id: siteId } = site;
@@ -86,15 +75,3 @@ const logsFunction = async (functionName, options, command) => {
86
75
  log(err);
87
76
  });
88
77
  };
89
- export const createLogsFunctionCommand = (program) => program
90
- .command('logs:function')
91
- .alias('logs:functions')
92
- .addOption(new Option('-l, --level <levels...>', `Log levels to stream. Choices are:${CLI_LOG_LEVEL_CHOICES_STRING}`))
93
- .addArgument(new Argument('[functionName]', 'Name of the function to stream logs for'))
94
- .addExamples([
95
- 'netlify logs:function',
96
- 'netlify logs:function my-function',
97
- 'netlify logs:function my-function -l info warn',
98
- ])
99
- .description('(Beta) Stream netlify function logs to the console')
100
- .action(logsFunction);
@@ -0,0 +1,39 @@
1
+ import { Option, Argument } from 'commander';
2
+ import { CLI_LOG_LEVEL_CHOICES_STRING } from './log-levels.js';
3
+ export const createLogsBuildCommand = (program) => {
4
+ program
5
+ .command('logs:deploy')
6
+ .alias('logs:build')
7
+ .description('(Beta) Stream the logs of deploys currently being built to the console')
8
+ .action(async (options, command) => {
9
+ const { logsBuild } = await import('./build.js');
10
+ await logsBuild(options, command);
11
+ });
12
+ };
13
+ export const createLogsFunctionCommand = (program) => {
14
+ program
15
+ .command('logs:function')
16
+ .alias('logs:functions')
17
+ .addOption(new Option('-l, --level <levels...>', `Log levels to stream. Choices are:${CLI_LOG_LEVEL_CHOICES_STRING}`))
18
+ .addArgument(new Argument('[functionName]', 'Name of the function to stream logs for'))
19
+ .addExamples([
20
+ 'netlify logs:function',
21
+ 'netlify logs:function my-function',
22
+ 'netlify logs:function my-function -l info warn',
23
+ ])
24
+ .description('(Beta) Stream netlify function logs to the console')
25
+ .action(async (functionName, options, command) => {
26
+ const { logsFunction } = await import('./functions.js');
27
+ await logsFunction(functionName, options, command);
28
+ });
29
+ };
30
+ export const createLogsCommand = (program) => {
31
+ createLogsBuildCommand(program);
32
+ createLogsFunctionCommand(program);
33
+ return program
34
+ .command('logs')
35
+ .alias('log')
36
+ .description('Stream logs from your site')
37
+ .addExamples(['netlify logs:deploy', 'netlify logs:function', 'netlify logs:function my-function'])
38
+ .action((_, command) => command.help());
39
+ };
@@ -0,0 +1,11 @@
1
+ // Source: Source: https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-advanced
2
+ export const LOG_LEVELS = {
3
+ TRACE: 'TRACE',
4
+ DEBUG: 'DEBUG',
5
+ INFO: 'INFO',
6
+ WARN: 'WARN',
7
+ ERROR: 'ERROR',
8
+ FATAL: 'FATAL',
9
+ };
10
+ export const LOG_LEVELS_LIST = Object.values(LOG_LEVELS).map((level) => level.toLowerCase());
11
+ export const CLI_LOG_LEVEL_CHOICES_STRING = LOG_LEVELS_LIST.map((level) => ` ${level}`);
@@ -4,37 +4,37 @@ import { Option } from 'commander';
4
4
  import envinfo from 'envinfo';
5
5
  import { closest } from 'fastest-levenshtein';
6
6
  import inquirer from 'inquirer';
7
- import { BANG, chalk, error, exit, log, NETLIFY_CYAN, USER_AGENT, warn } from '../utils/command-helpers.mjs';
7
+ import { BANG, chalk, error, exit, log, NETLIFY_CYAN, USER_AGENT, warn } from '../utils/command-helpers.js';
8
8
  // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
9
- import execa from '../utils/execa.mjs';
10
- import getGlobalConfig from '../utils/get-global-config.mjs';
11
- import getPackageJson from '../utils/get-package-json.mjs';
12
- import { track, reportError } from '../utils/telemetry/index.mjs';
13
- import { createAddonsCommand } from './addons/index.mjs';
14
- import { createApiCommand } from './api/index.mjs';
15
- import BaseCommand from './base-command.mjs';
16
- import { createBlobsCommand } from './blobs/blobs.mjs';
17
- import { createBuildCommand } from './build/index.mjs';
18
- import { createCompletionCommand } from './completion/index.mjs';
19
- import { createDeployCommand } from './deploy/index.mjs';
20
- import { createDevCommand } from './dev/index.mjs';
21
- import { createEnvCommand } from './env/index.mjs';
22
- import { createFunctionsCommand } from './functions/index.mjs';
23
- import { createInitCommand } from './init/index.mjs';
24
- import { createIntegrationCommand } from './integration/index.mjs';
25
- import { createLinkCommand } from './link/index.mjs';
26
- import { createLmCommand } from './lm/index.mjs';
27
- import { createLoginCommand } from './login/index.mjs';
28
- import { createLogoutCommand } from './logout/index.mjs';
29
- import { createLogsCommand } from './logs/index.mjs';
30
- import { createOpenCommand } from './open/index.mjs';
31
- import { createRecipesCommand } from './recipes/index.mjs';
32
- import { createServeCommand } from './serve/serve.mjs';
33
- import { createSitesCommand } from './sites/index.mjs';
34
- import { createStatusCommand } from './status/index.mjs';
35
- import { createSwitchCommand } from './switch/index.mjs';
36
- import { createUnlinkCommand } from './unlink/index.mjs';
37
- import { createWatchCommand } from './watch/index.mjs';
9
+ import execa from '../utils/execa.js';
10
+ import getGlobalConfig from '../utils/get-global-config.js';
11
+ import getPackageJson from '../utils/get-package-json.js';
12
+ import { track, reportError } from '../utils/telemetry/index.js';
13
+ import { createAddonsCommand } from './addons/index.js';
14
+ import { createApiCommand } from './api/index.js';
15
+ import BaseCommand from './base-command.js';
16
+ import { createBlobsCommand } from './blobs/blobs.js';
17
+ import { createBuildCommand } from './build/index.js';
18
+ import { createCompletionCommand } from './completion/index.js';
19
+ import { createDeployCommand } from './deploy/index.js';
20
+ import { createDevCommand } from './dev/index.js';
21
+ import { createEnvCommand } from './env/index.js';
22
+ import { createFunctionsCommand } from './functions/index.js';
23
+ import { createInitCommand } from './init/index.js';
24
+ import { createIntegrationCommand } from './integration/index.js';
25
+ import { createLinkCommand } from './link/index.js';
26
+ import { createLmCommand } from './lm/index.js';
27
+ import { createLoginCommand } from './login/index.js';
28
+ import { createLogoutCommand } from './logout/index.js';
29
+ import { createLogsCommand } from './logs/index.js';
30
+ import { createOpenCommand } from './open/index.js';
31
+ import { createRecipesCommand } from './recipes/index.js';
32
+ import { createServeCommand } from './serve/index.js';
33
+ import { createSitesCommand } from './sites/index.js';
34
+ import { createStatusCommand } from './status/index.js';
35
+ import { createSwitchCommand } from './switch/index.js';
36
+ import { createUnlinkCommand } from './unlink/index.js';
37
+ import { createWatchCommand } from './watch/index.js';
38
38
  const SUGGESTION_TIMEOUT = 1e4;
39
39
  process.on('uncaughtException', async (err) => {
40
40
  console.log('');
@@ -64,7 +64,7 @@ ${USER_AGENT}
64
64
  /**
65
65
  * The main CLI command without any command (root action)
66
66
  * @param {import('commander').OptionValues} options
67
- * @param {import('./base-command.mjs').default} command
67
+ * @param {import('./base-command.js').default} command
68
68
  */
69
69
  // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
70
70
  const mainCommand = async function (options, command) {
@@ -144,7 +144,7 @@ const mainCommand = async function (options, command) {
144
144
  /**
145
145
  * Creates the `netlify-cli` command
146
146
  * Promise is needed as the envinfo is a promise
147
- * @returns {import('./base-command.mjs').default}
147
+ * @returns {import('./base-command.js').default}
148
148
  */
149
149
  export const createMainCommand = () => {
150
150
  const program = new BaseCommand('netlify');
@@ -0,0 +1,31 @@
1
+ import requiresSiteInfo from '../../utils/hooks/requires-site-info.js';
2
+ export const createOpenCommand = (program) => {
3
+ program
4
+ .command('open:admin')
5
+ .description('Opens current site admin UI in Netlify')
6
+ .addExamples(['netlify open:admin'])
7
+ .hook('preAction', requiresSiteInfo)
8
+ .action(async (options, command) => {
9
+ const { openAdmin } = await import('./open-admin.js');
10
+ await openAdmin(options, command);
11
+ });
12
+ program
13
+ .command('open:site')
14
+ .description('Opens current site url in browser')
15
+ .addExamples(['netlify open:site'])
16
+ .hook('preAction', requiresSiteInfo)
17
+ .action(async (options, command) => {
18
+ const { openSite } = await import('./open-site.js');
19
+ await openSite(options, command);
20
+ });
21
+ return program
22
+ .command('open')
23
+ .description(`Open settings for the site linked to the current folder`)
24
+ .option('--site', 'Open site')
25
+ .option('--admin', 'Open Netlify site')
26
+ .addExamples(['netlify open --site', 'netlify open --admin', 'netlify open:admin', 'netlify open:site'])
27
+ .action(async (options, command) => {
28
+ const { open } = await import('./open.js');
29
+ await open(options, command);
30
+ });
31
+ };
@@ -0,0 +1,11 @@
1
+ import { exit, log } from '../../utils/command-helpers.js';
2
+ import openBrowser from '../../utils/open-browser.js';
3
+ export const openAdmin = async (options, command) => {
4
+ const { siteInfo } = command.netlify;
5
+ await command.authenticate();
6
+ log(`Opening "${siteInfo.name}" site admin UI:`);
7
+ log(`> ${siteInfo.admin_url}`);
8
+ // @ts-expect-error TS(2345) FIXME: Argument of type '{ url: any; }' is not assignable... Remove this comment to see the full error message
9
+ await openBrowser({ url: siteInfo.admin_url });
10
+ exit();
11
+ };
@@ -0,0 +1,12 @@
1
+ import { exit, log } from '../../utils/command-helpers.js';
2
+ import openBrowser from '../../utils/open-browser.js';
3
+ export const openSite = async (options, command) => {
4
+ const { siteInfo } = command.netlify;
5
+ await command.authenticate();
6
+ const url = siteInfo.ssl_url || siteInfo.url;
7
+ log(`Opening "${siteInfo.name}" site url:`);
8
+ log(`> ${url}`);
9
+ // @ts-expect-error TS(2345) FIXME: Argument of type '{ url: any; }' is not assignable... Remove this comment to see the full error message
10
+ await openBrowser({ url });
11
+ exit();
12
+ };
@@ -0,0 +1,13 @@
1
+ import { log } from '../../utils/command-helpers.js';
2
+ import { openAdmin } from './open-admin.js';
3
+ import { openSite } from './open-site.js';
4
+ export const open = async (options, command) => {
5
+ if (!options.site || !options.admin) {
6
+ log(command.helpInformation());
7
+ }
8
+ if (options.site) {
9
+ await openSite(options, command);
10
+ }
11
+ // Default open netlify admin
12
+ await openAdmin(options, command);
13
+ };
@@ -4,7 +4,7 @@ import { fileURLToPath, pathToFileURL } from 'url';
4
4
  const directoryPath = dirname(fileURLToPath(import.meta.url));
5
5
  // @ts-expect-error TS(7006) FIXME: Parameter 'name' implicitly has an 'any' type.
6
6
  export const getRecipe = async (name) => {
7
- const recipePath = resolve(directoryPath, '../../recipes', name, 'index.mjs');
7
+ const recipePath = resolve(directoryPath, '../../recipes', name, 'index.js');
8
8
  // windows needs a URL for absolute paths
9
9
  const recipe = await import(pathToFileURL(recipePath).href);
10
10
  return recipe;
@@ -13,7 +13,7 @@ export const listRecipes = async () => {
13
13
  const recipesPath = resolve(directoryPath, '../../recipes');
14
14
  const recipeNames = await fs.readdir(recipesPath);
15
15
  const recipes = await Promise.all(recipeNames.map(async (name) => {
16
- const recipePath = join(recipesPath, name, 'index.mjs');
16
+ const recipePath = join(recipesPath, name, 'index.js');
17
17
  // windows needs a URL for absolute paths
18
18
  const recipe = await import(pathToFileURL(recipePath).href);
19
19
  return {
@@ -0,0 +1,20 @@
1
+ export const createRecipesCommand = (program) => {
2
+ program
3
+ .command('recipes:list')
4
+ .description(`List the recipes available to create and modify files in a project`)
5
+ .addExamples(['netlify recipes:list'])
6
+ .action(async () => {
7
+ const { recipesListCommand } = await import('./recipes-list.js');
8
+ await recipesListCommand();
9
+ });
10
+ return program
11
+ .command('recipes')
12
+ .argument('[name]', 'name of the recipe')
13
+ .description(`Create and modify files in a project using pre-defined recipes`)
14
+ .option('-n, --name <name>', 'recipe name to use')
15
+ .addExamples(['netlify recipes my-recipe', 'netlify recipes --name my-recipe'])
16
+ .action(async (recipeName, options, command) => {
17
+ const { recipesCommand } = await import('./recipes.js');
18
+ await recipesCommand(recipeName, options, command);
19
+ });
20
+ };
@@ -0,0 +1,14 @@
1
+ import AsciiTable from 'ascii-table';
2
+ import { listRecipes } from './common.js';
3
+ /**
4
+ * The recipes:list command
5
+ */
6
+ export const recipesListCommand = async () => {
7
+ const recipes = await listRecipes();
8
+ const table = new AsciiTable(`Usage: netlify recipes <name>`);
9
+ table.setHeading('Name', 'Description');
10
+ recipes.forEach(({ description, name }) => {
11
+ table.addRow(name, description);
12
+ });
13
+ console.log(table.toString());
14
+ };
@@ -1,18 +1,15 @@
1
1
  import { basename } from 'path';
2
2
  import { closest } from 'fastest-levenshtein';
3
3
  import inquirer from 'inquirer';
4
- import { NETLIFYDEVERR, chalk, log } from '../../utils/command-helpers.mjs';
5
- import { getRecipe, listRecipes } from './common.mjs';
6
- import { createRecipesListCommand } from './recipes-list.mjs';
4
+ import { NETLIFYDEVERR, chalk, log } from '../../utils/command-helpers.js';
5
+ import { getRecipe, listRecipes } from './common.js';
7
6
  const SUGGESTION_TIMEOUT = 1e4;
8
- /**
9
- * The recipes command
10
- * @param {string} recipeName
11
- * @param {import('commander').OptionValues} options
12
- * @param {import('../base-command.mjs').default} command
13
- */
14
- // @ts-expect-error TS(7023) FIXME: 'recipesCommand' implicitly has return type 'any' ... Remove this comment to see the full error message
15
- const recipesCommand = async (recipeName, options, command) => {
7
+ // @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
8
+ export const runRecipe = async ({ config, recipeName, repositoryRoot }) => {
9
+ const recipe = await getRecipe(recipeName);
10
+ return recipe.run({ config, repositoryRoot });
11
+ };
12
+ export const recipesCommand = async (recipeName, options, command) => {
16
13
  const { config, repositoryRoot } = command.netlify;
17
14
  const sanitizedRecipeName = basename(recipeName || '').toLowerCase();
18
15
  if (sanitizedRecipeName.length === 0) {
@@ -52,24 +49,3 @@ const recipesCommand = async (recipeName, options, command) => {
52
49
  }
53
50
  }
54
51
  };
55
- // @ts-expect-error TS(7031) FIXME: Binding element 'config' implicitly has an 'any' t... Remove this comment to see the full error message
56
- export const runRecipe = async ({ config, recipeName, repositoryRoot }) => {
57
- const recipe = await getRecipe(recipeName);
58
- return recipe.run({ config, repositoryRoot });
59
- };
60
- /**
61
- * Creates the `netlify recipes` command
62
- * @param {import('../base-command.mjs').default} program
63
- * @returns
64
- */
65
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
66
- export const createRecipesCommand = (program) => {
67
- createRecipesListCommand(program);
68
- program
69
- .command('recipes')
70
- .argument('[name]', 'name of the recipe')
71
- .description(`Create and modify files in a project using pre-defined recipes`)
72
- .option('-n, --name <name>', 'recipe name to use')
73
- .addExamples(['netlify recipes my-recipe', 'netlify recipes --name my-recipe'])
74
- .action(recipesCommand);
75
- };
@@ -0,0 +1,27 @@
1
+ import { Option } from 'commander';
2
+ import { normalizeContext } from '../../utils/env/index.js';
3
+ import { getGeoCountryArgParser } from '../../utils/validation.js';
4
+ export const createServeCommand = (program) => program
5
+ .command('serve')
6
+ .description('Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.')
7
+ .option('--context <context>', 'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")', normalizeContext)
8
+ .option('-p ,--port <port>', 'port of netlify dev', (value) => Number.parseInt(value))
9
+ .option('-d ,--dir <path>', 'dir with static files')
10
+ .option('-f ,--functions <folder>', 'specify a functions folder to serve')
11
+ .option('-o ,--offline', 'disables any features that require network access')
12
+ .addOption(new Option('--functionsPort <port>', 'Old, prefer --functions-port. Port of functions server')
13
+ .argParser((value) => Number.parseInt(value))
14
+ .hideHelp(true))
15
+ .option('--functions-port <port>', 'port of functions server', (value) => Number.parseInt(value))
16
+ .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')
17
+ .choices(['cache', 'mock', 'update'])
18
+ .default('cache'))
19
+ .addOption(new Option('--country <geoCountry>', 'Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables --geo=mock automatically)').argParser(getGeoCountryArgParser('netlify dev --geo=mock --country=FR')))
20
+ .addOption(new Option('--staticServerPort <port>', 'port of the static app server used when no framework is detected')
21
+ .argParser((value) => Number.parseInt(value))
22
+ .hideHelp())
23
+ .addExamples(['netlify serve', 'BROWSER=none netlify serve # disable browser auto opening'])
24
+ .action(async (options, command) => {
25
+ const { serve } = await import('./serve.js');
26
+ await serve(options, command);
27
+ });
@@ -1,26 +1,18 @@
1
1
  import process from 'process';
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 { chalk, exit, log, 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 { getInternalFunctionsDir } from '../../utils/functions/functions.mjs';
12
- import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs';
13
- import openBrowser from '../../utils/open-browser.mjs';
14
- import { generateInspectSettings, startProxyServer } from '../../utils/proxy-server.mjs';
15
- import { runBuildTimeline } from '../../utils/run-build.mjs';
16
- import { getGeoCountryArgParser } from '../../utils/validation.mjs';
17
- /**
18
- * The serve command
19
- * @param {import('commander').OptionValues} options
20
- * @param {import('../base-command.mjs').default} command
21
- */
22
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
23
- const serve = async (options, command) => {
2
+ import { getBlobsContext } from '../../lib/blobs/blobs.js';
3
+ import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.js';
4
+ import { startFunctionsServer } from '../../lib/functions/server.js';
5
+ import { printBanner } from '../../utils/banner.js';
6
+ import { chalk, exit, log, NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, normalizeConfig, } from '../../utils/command-helpers.js';
7
+ import detectServerSettings, { getConfigWithPlugins } from '../../utils/detect-server-settings.js';
8
+ import { getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.js';
9
+ import { getEnvelopeEnv } from '../../utils/env/index.js';
10
+ import { getInternalFunctionsDir } from '../../utils/functions/functions.js';
11
+ import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
12
+ import openBrowser from '../../utils/open-browser.js';
13
+ import { generateInspectSettings, startProxyServer } from '../../utils/proxy-server.js';
14
+ import { runBuildTimeline } from '../../utils/run-build.js';
15
+ export const serve = async (options, command) => {
24
16
  const { api, cachedConfig, config, repositoryRoot, site, siteInfo, state } = command.netlify;
25
17
  config.dev = { ...config.dev };
26
18
  config.build = { ...config.build };
@@ -136,32 +128,3 @@ const serve = async (options, command) => {
136
128
  process.env.DEPLOY_URL = url;
137
129
  printBanner({ url });
138
130
  };
139
- /**
140
- * Creates the `netlify serve` command
141
- * @param {import('../base-command.mjs').default} program
142
- * @returns
143
- */
144
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
145
- export const createServeCommand = (program) => program
146
- .command('serve')
147
- .description('Build the site for production and serve locally. This does not watch the code for changes, so if you need to rebuild your site then you must exit and run `serve` again.')
148
- .option('--context <context>', 'Specify a deploy context or branch for environment variables (contexts: "production", "deploy-preview", "branch-deploy", "dev")', normalizeContext)
149
- // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
150
- .option('-p ,--port <port>', 'port of netlify dev', (value) => Number.parseInt(value))
151
- .option('-d ,--dir <path>', 'dir with static files')
152
- .option('-f ,--functions <folder>', 'specify a functions folder to serve')
153
- .option('-o ,--offline', 'disables any features that require network access')
154
- .addOption(new Option('--functionsPort <port>', 'Old, prefer --functions-port. Port of functions server')
155
- .argParser((value) => Number.parseInt(value))
156
- .hideHelp(true))
157
- // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
158
- .option('--functions-port <port>', 'port of functions server', (value) => Number.parseInt(value))
159
- .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')
160
- .choices(['cache', 'mock', 'update'])
161
- .default('cache'))
162
- .addOption(new Option('--country <geoCountry>', 'Two-letter country code (https://ntl.fyi/country-codes) to use as mock geolocation (enables --geo=mock automatically)').argParser(getGeoCountryArgParser('netlify dev --geo=mock --country=FR')))
163
- .addOption(new Option('--staticServerPort <port>', 'port of the static app server used when no framework is detected')
164
- .argParser((value) => Number.parseInt(value))
165
- .hideHelp())
166
- .addExamples(['netlify serve', 'BROWSER=none netlify serve # disable browser auto opening'])
167
- .action(serve);
@@ -0,0 +1 @@
1
+ export { createSitesCommand } from './sites.js';
@@ -3,15 +3,15 @@ import pick from 'lodash/pick.js';
3
3
  // @ts-expect-error TS(7016) FIXME: Could not find a declaration file for module 'pars... Remove this comment to see the full error message
4
4
  import parseGitHubUrl from 'parse-github-url';
5
5
  import { render } from 'prettyjson';
6
- import { chalk, error, getTerminalLink, log, logJson, warn } from '../../utils/command-helpers.mjs';
6
+ import { chalk, error, getTerminalLink, log, logJson, warn } from '../../utils/command-helpers.js';
7
7
  // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
8
- import execa from '../../utils/execa.mjs';
9
- import getRepoData from '../../utils/get-repo-data.mjs';
10
- import { getGitHubToken } from '../../utils/init/config-github.mjs';
11
- import { configureRepo } from '../../utils/init/config.mjs';
12
- import { createRepo, getTemplatesFromGitHub, validateTemplate } from '../../utils/sites/utils.mjs';
13
- import { track } from '../../utils/telemetry/index.mjs';
14
- import { getSiteNameInput } from './sites-create.mjs';
8
+ import execa from '../../utils/execa.js';
9
+ import getRepoData from '../../utils/get-repo-data.js';
10
+ import { getGitHubToken } from '../../utils/init/config-github.js';
11
+ import { configureRepo } from '../../utils/init/config.js';
12
+ import { createRepo, getTemplatesFromGitHub, validateTemplate } from '../../utils/sites/utils.js';
13
+ import { track } from '../../utils/telemetry/index.js';
14
+ import { getSiteNameInput } from './sites-create.js';
15
15
  // @ts-expect-error TS(7006) FIXME: Parameter 'token' implicitly has an 'any' type.
16
16
  export const fetchTemplates = async (token) => {
17
17
  const templatesFromGithubOrg = await getTemplatesFromGitHub(token);
@@ -53,14 +53,7 @@ const getTemplateName = async ({ ghToken, options, repository }) => {
53
53
  };
54
54
  // @ts-expect-error TS(7031) FIXME: Binding element 'options' implicitly has an 'any' ... Remove this comment to see the full error message
55
55
  const getGitHubLink = ({ options, templateName }) => options.url || `https://github.com/${templateName}`;
56
- /**
57
- * The sites:create-template command
58
- * @param repository {string}
59
- * @param {import('commander').OptionValues} options
60
- * @param {import('../base-command.mjs').default} command
61
- */
62
- // @ts-expect-error TS(7006) FIXME: Parameter 'repository' implicitly has an 'any' typ... Remove this comment to see the full error message
63
- const sitesCreateTemplate = async (repository, options, command) => {
56
+ export const sitesCreateTemplate = async (repository, options, command) => {
64
57
  const { api } = command.netlify;
65
58
  await command.authenticate();
66
59
  const { globalConfig } = command.netlify;
@@ -214,25 +207,3 @@ const sitesCreateTemplate = async (repository, options, command) => {
214
207
  }
215
208
  return site;
216
209
  };
217
- /**
218
- * Creates the `netlify sites:create-template` command
219
- * @param {import('../base-command.mjs').default} program
220
- * @returns
221
- */
222
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
223
- export const createSitesFromTemplateCommand = (program) => program
224
- .command('sites:create-template')
225
- .description(`(Beta) Create a site from a starter template
226
- Create a site from a starter template.`)
227
- .option('-n, --name [name]', 'name of site')
228
- .option('-u, --url [url]', 'template url')
229
- .option('-a, --account-slug [slug]', 'account slug to create the site under')
230
- .option('-c, --with-ci', 'initialize CI hooks during site creation')
231
- .argument('[repository]', 'repository to use as starter template')
232
- .addHelpText('after', `(Beta) Create a site from starter template.`)
233
- .addExamples([
234
- 'netlify sites:create-template',
235
- 'netlify sites:create-template nextjs-blog-theme',
236
- 'netlify sites:create-template my-github-profile/my-template',
237
- ])
238
- .action(sitesCreateTemplate);
@@ -1,12 +1,11 @@
1
- import { InvalidArgumentError } from 'commander';
2
1
  import inquirer from 'inquirer';
3
2
  import pick from 'lodash/pick.js';
4
3
  import prettyjson from 'prettyjson';
5
- import { chalk, error, log, logJson, warn } from '../../utils/command-helpers.mjs';
6
- import getRepoData from '../../utils/get-repo-data.mjs';
7
- import { configureRepo } from '../../utils/init/config.mjs';
8
- import { track } from '../../utils/telemetry/index.mjs';
9
- import { link } from '../link/index.mjs';
4
+ import { chalk, error, log, logJson, warn } from '../../utils/command-helpers.js';
5
+ import getRepoData from '../../utils/get-repo-data.js';
6
+ import { configureRepo } from '../../utils/init/config.js';
7
+ import { track } from '../../utils/telemetry/index.js';
8
+ import { link } from '../link/link.js';
10
9
  // @ts-expect-error TS(7006) FIXME: Parameter 'name' implicitly has an 'any' type.
11
10
  export const getSiteNameInput = async (name) => {
12
11
  if (!name) {
@@ -22,12 +21,6 @@ export const getSiteNameInput = async (name) => {
22
21
  }
23
22
  return { name };
24
23
  };
25
- /**
26
- * The sites:create command
27
- * @param {import('commander').OptionValues} options
28
- * @param {import('../base-command.mjs').default} command
29
- */
30
- // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
31
24
  export const sitesCreate = async (options, command) => {
32
25
  const { api } = command.netlify;
33
26
  await command.authenticate();
@@ -138,29 +131,3 @@ export const sitesCreate = async (options, command) => {
138
131
  }
139
132
  return site;
140
133
  };
141
- const MAX_SITE_NAME_LENGTH = 63;
142
- // @ts-expect-error TS(7006) FIXME: Parameter 'value' implicitly has an 'any' type.
143
- const validateName = function (value) {
144
- // netlify sites:create --name <A string of more than 63 words>
145
- if (typeof value === 'string' && value.length > MAX_SITE_NAME_LENGTH) {
146
- throw new InvalidArgumentError(`--name should be less than 64 characters, input length: ${value.length}`);
147
- }
148
- return value;
149
- };
150
- /**
151
- * Creates the `netlify sites:create` command
152
- * @param {import('../base-command.mjs').default} program
153
- * @returns
154
- */
155
- // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
156
- export const createSitesCreateCommand = (program) => program
157
- .command('sites:create')
158
- .description(`Create an empty site (advanced)
159
- Create a blank site that isn't associated with any git remote. Will link the site to the current working directory.`)
160
- .option('-n, --name <name>', 'name of site', validateName)
161
- .option('-a, --account-slug <slug>', 'account slug to create the site under')
162
- .option('-c, --with-ci', 'initialize CI hooks during site creation')
163
- .option('-m, --manual', 'force manual CI setup. Used --with-ci flag')
164
- .option('--disable-linking', 'create the site without linking it to current directory')
165
- .addHelpText('after', `Create a blank site that isn't associated with any git remote. Will link the site to the current working directory.`)
166
- .action(sitesCreate);