netlify-cli 17.3.1 → 17.4.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 (210) hide show
  1. package/README.md +3 -139
  2. package/npm-shrinkwrap.json +82 -82
  3. package/package.json +16 -15
  4. package/src/commands/addons/addons-auth.mjs +27 -30
  5. package/src/commands/addons/addons-config.mjs +145 -154
  6. package/src/commands/addons/addons-create.mjs +94 -108
  7. package/src/commands/addons/addons-delete.mjs +36 -41
  8. package/src/commands/addons/addons-list.mjs +38 -42
  9. package/src/commands/addons/addons.mjs +26 -28
  10. package/src/commands/addons/index.mjs +1 -1
  11. package/src/commands/api/api.mjs +45 -53
  12. package/src/commands/api/index.mjs +1 -1
  13. package/src/commands/base-command.mjs +597 -684
  14. package/src/commands/blobs/blobs-delete.mjs +35 -0
  15. package/src/commands/blobs/blobs-get.mjs +44 -0
  16. package/src/commands/blobs/blobs-list.mjs +48 -0
  17. package/src/commands/blobs/blobs-set.mjs +54 -0
  18. package/src/commands/blobs/blobs.mjs +32 -0
  19. package/src/commands/blobs/index.mjs +1 -0
  20. package/src/commands/build/build.mjs +55 -67
  21. package/src/commands/build/index.mjs +1 -1
  22. package/src/commands/completion/completion.mjs +41 -46
  23. package/src/commands/completion/index.mjs +1 -1
  24. package/src/commands/deploy/deploy.mjs +675 -710
  25. package/src/commands/deploy/index.mjs +1 -1
  26. package/src/commands/dev/dev-exec.mjs +20 -32
  27. package/src/commands/dev/dev.mjs +217 -302
  28. package/src/commands/dev/index.mjs +1 -1
  29. package/src/commands/dev/types.d.ts +30 -0
  30. package/src/commands/env/env-clone.mjs +157 -184
  31. package/src/commands/env/env-get.mjs +49 -68
  32. package/src/commands/env/env-import.mjs +100 -119
  33. package/src/commands/env/env-list.mjs +104 -129
  34. package/src/commands/env/env-set.mjs +160 -185
  35. package/src/commands/env/env-unset.mjs +104 -122
  36. package/src/commands/env/env.mjs +28 -30
  37. package/src/commands/env/index.mjs +1 -1
  38. package/src/commands/functions/functions-build.mjs +29 -41
  39. package/src/commands/functions/functions-create.mjs +533 -601
  40. package/src/commands/functions/functions-invoke.mjs +193 -216
  41. package/src/commands/functions/functions-list.mjs +45 -55
  42. package/src/commands/functions/functions-serve.mjs +51 -61
  43. package/src/commands/functions/functions.mjs +26 -32
  44. package/src/commands/functions/index.mjs +1 -1
  45. package/src/commands/index.mjs +2 -2
  46. package/src/commands/init/index.mjs +1 -1
  47. package/src/commands/init/init.mjs +138 -167
  48. package/src/commands/integration/deploy.mjs +337 -399
  49. package/src/commands/integration/index.mjs +12 -13
  50. package/src/commands/link/index.mjs +1 -1
  51. package/src/commands/link/link.mjs +298 -317
  52. package/src/commands/lm/index.mjs +1 -1
  53. package/src/commands/lm/lm-info.mjs +23 -31
  54. package/src/commands/lm/lm-install.mjs +13 -17
  55. package/src/commands/lm/lm-setup.mjs +80 -84
  56. package/src/commands/lm/lm-uninstall.mjs +7 -12
  57. package/src/commands/lm/lm.mjs +18 -22
  58. package/src/commands/login/index.mjs +1 -1
  59. package/src/commands/login/login.mjs +35 -41
  60. package/src/commands/logout/index.mjs +1 -1
  61. package/src/commands/logout/logout.mjs +25 -31
  62. package/src/commands/main.mjs +166 -201
  63. package/src/commands/open/index.mjs +1 -1
  64. package/src/commands/open/open-admin.mjs +15 -18
  65. package/src/commands/open/open-site.mjs +16 -19
  66. package/src/commands/open/open.mjs +24 -27
  67. package/src/commands/recipes/common.mjs +23 -34
  68. package/src/commands/recipes/index.mjs +1 -1
  69. package/src/commands/recipes/recipes-list.mjs +13 -20
  70. package/src/commands/recipes/recipes.mjs +59 -72
  71. package/src/commands/serve/index.mjs +1 -1
  72. package/src/commands/serve/serve.mjs +142 -189
  73. package/src/commands/sites/index.mjs +2 -2
  74. package/src/commands/sites/sites-create-template.mjs +214 -236
  75. package/src/commands/sites/sites-create.mjs +145 -157
  76. package/src/commands/sites/sites-delete.mjs +75 -81
  77. package/src/commands/sites/sites-list.mjs +63 -66
  78. package/src/commands/sites/sites.mjs +18 -20
  79. package/src/commands/status/index.mjs +1 -1
  80. package/src/commands/status/status-hooks.mjs +32 -34
  81. package/src/commands/status/status.mjs +99 -106
  82. package/src/commands/switch/index.mjs +1 -1
  83. package/src/commands/switch/switch.mjs +32 -37
  84. package/src/commands/types.d.ts +31 -0
  85. package/src/commands/unlink/index.mjs +1 -1
  86. package/src/commands/unlink/unlink.mjs +23 -29
  87. package/src/commands/watch/index.mjs +1 -1
  88. package/src/commands/watch/watch.mjs +91 -105
  89. package/src/functions-templates/javascript/hello/{{name}}.js +2 -3
  90. package/src/lib/account.mjs +4 -5
  91. package/src/lib/api.mjs +22 -20
  92. package/src/lib/blobs/blobs.mjs +36 -45
  93. package/src/lib/build.mjs +82 -85
  94. package/src/lib/completion/constants.mjs +2 -4
  95. package/src/lib/completion/generate-autocompletion.mjs +33 -36
  96. package/src/lib/completion/get-autocompletion.mjs +31 -35
  97. package/src/lib/completion/index.mjs +1 -1
  98. package/src/lib/completion/script.mjs +12 -19
  99. package/src/lib/edge-functions/bootstrap.mjs +3 -5
  100. package/src/lib/edge-functions/consts.mjs +9 -10
  101. package/src/lib/edge-functions/deploy.mjs +28 -34
  102. package/src/lib/edge-functions/editor-helper.mjs +29 -42
  103. package/src/lib/edge-functions/headers.mjs +24 -26
  104. package/src/lib/edge-functions/internal.mjs +38 -44
  105. package/src/lib/edge-functions/proxy.mjs +229 -228
  106. package/src/lib/edge-functions/registry.mjs +473 -574
  107. package/src/lib/exec-fetcher.mjs +115 -122
  108. package/src/lib/fs.mjs +28 -27
  109. package/src/lib/functions/background.mjs +16 -20
  110. package/src/lib/functions/config.mjs +12 -9
  111. package/src/lib/functions/form-submissions-handler.mjs +143 -149
  112. package/src/lib/functions/local-proxy.mjs +40 -44
  113. package/src/lib/functions/memoized-build.mjs +19 -21
  114. package/src/lib/functions/netlify-function.mjs +269 -249
  115. package/src/lib/functions/registry.mjs +509 -568
  116. package/src/lib/functions/runtimes/go/index.mjs +62 -71
  117. package/src/lib/functions/runtimes/index.mjs +8 -15
  118. package/src/lib/functions/runtimes/js/builders/netlify-lambda.mjs +55 -64
  119. package/src/lib/functions/runtimes/js/builders/zisi.mjs +135 -154
  120. package/src/lib/functions/runtimes/js/constants.mjs +1 -1
  121. package/src/lib/functions/runtimes/js/index.mjs +92 -109
  122. package/src/lib/functions/runtimes/js/worker.mjs +43 -45
  123. package/src/lib/functions/runtimes/rust/index.mjs +64 -73
  124. package/src/lib/functions/scheduled.mjs +70 -88
  125. package/src/lib/functions/server.mjs +269 -327
  126. package/src/lib/functions/synchronous.mjs +118 -147
  127. package/src/lib/functions/utils.mjs +38 -46
  128. package/src/lib/geo-location.mjs +69 -81
  129. package/src/lib/http-agent.mjs +87 -90
  130. package/src/lib/images/proxy.mjs +97 -89
  131. package/src/lib/log.mjs +6 -9
  132. package/src/lib/path.mjs +2 -1
  133. package/src/lib/render-error-template.mjs +19 -20
  134. package/src/lib/settings.mjs +17 -19
  135. package/src/lib/spinner.mjs +21 -23
  136. package/src/lib/string.mjs +4 -2
  137. package/src/recipes/vscode/index.mjs +69 -85
  138. package/src/recipes/vscode/settings.mjs +53 -58
  139. package/src/utils/addons/compare.mjs +31 -32
  140. package/src/utils/addons/diffs/index.mjs +16 -17
  141. package/src/utils/addons/diffs/options.mjs +99 -101
  142. package/src/utils/addons/prepare.mjs +100 -97
  143. package/src/utils/addons/prompts.mjs +73 -76
  144. package/src/utils/addons/render.mjs +33 -36
  145. package/src/utils/addons/validation.mjs +19 -15
  146. package/src/utils/banner.mjs +11 -16
  147. package/src/utils/build-info.mjs +65 -66
  148. package/src/utils/command-helpers.mjs +185 -199
  149. package/src/utils/create-deferred.mjs +9 -12
  150. package/src/utils/create-stream-promise.mjs +54 -47
  151. package/src/utils/deploy/constants.mjs +9 -11
  152. package/src/utils/deploy/deploy-site.mjs +162 -182
  153. package/src/utils/deploy/hash-config.mjs +21 -21
  154. package/src/utils/deploy/hash-files.mjs +34 -38
  155. package/src/utils/deploy/hash-fns.mjs +149 -154
  156. package/src/utils/deploy/hasher-segments.mjs +58 -52
  157. package/src/utils/deploy/upload-files.mjs +99 -113
  158. package/src/utils/deploy/util.mjs +85 -91
  159. package/src/utils/detect-server-settings.mjs +236 -268
  160. package/src/utils/dev.mjs +163 -178
  161. package/src/utils/dot-env.mjs +37 -42
  162. package/src/utils/env/index.mjs +148 -148
  163. package/src/utils/execa.mjs +9 -13
  164. package/src/utils/feature-flags.mjs +6 -5
  165. package/src/utils/framework-server.mjs +43 -52
  166. package/src/utils/functions/constants.mjs +1 -1
  167. package/src/utils/functions/functions.mjs +30 -40
  168. package/src/utils/functions/get-functions.mjs +28 -29
  169. package/src/utils/functions/index.mjs +3 -3
  170. package/src/utils/get-global-config.mjs +33 -36
  171. package/src/utils/get-package-json.mjs +14 -15
  172. package/src/utils/get-repo-data.mjs +54 -64
  173. package/src/utils/get-site.mjs +14 -14
  174. package/src/utils/gh-auth.mjs +79 -100
  175. package/src/utils/gitignore.mjs +37 -40
  176. package/src/utils/headers.mjs +33 -35
  177. package/src/utils/hooks/requires-site-info.mjs +26 -22
  178. package/src/utils/init/config-github.mjs +207 -219
  179. package/src/utils/init/config-manual.mjs +83 -100
  180. package/src/utils/init/config.mjs +25 -26
  181. package/src/utils/init/node-version.mjs +23 -30
  182. package/src/utils/init/plugins.mjs +12 -8
  183. package/src/utils/init/utils.mjs +152 -172
  184. package/src/utils/live-tunnel.mjs +118 -141
  185. package/src/utils/lm/install.mjs +220 -259
  186. package/src/utils/lm/requirements.mjs +54 -63
  187. package/src/utils/lm/steps.mjs +31 -31
  188. package/src/utils/lm/ui.mjs +13 -20
  189. package/src/utils/open-browser.mjs +31 -32
  190. package/src/utils/parse-raw-flags.mjs +39 -35
  191. package/src/utils/proxy-server.mjs +84 -71
  192. package/src/utils/proxy.mjs +696 -750
  193. package/src/utils/read-repo-url.mjs +48 -47
  194. package/src/utils/redirects.mjs +49 -49
  195. package/src/utils/request-id.mjs +2 -4
  196. package/src/utils/rules-proxy.mjs +96 -100
  197. package/src/utils/run-build.mjs +109 -132
  198. package/src/utils/shell.mjs +99 -106
  199. package/src/utils/sign-redirect.mjs +14 -14
  200. package/src/utils/sites/utils.mjs +48 -55
  201. package/src/utils/state-config.mjs +101 -101
  202. package/src/utils/static-server.mjs +28 -34
  203. package/src/utils/telemetry/index.mjs +2 -2
  204. package/src/utils/telemetry/report-error.mjs +45 -49
  205. package/src/utils/telemetry/request.mjs +36 -43
  206. package/src/utils/telemetry/telemetry.mjs +90 -105
  207. package/src/utils/telemetry/utils.mjs +5 -6
  208. package/src/utils/telemetry/validation.mjs +55 -53
  209. package/src/utils/types.d.ts +46 -0
  210. package/src/utils/validation.mjs +10 -13
@@ -1,40 +1,32 @@
1
- // @ts-check
2
- import { Listr } from 'listr2'
3
-
4
- import {
5
- checkGitLFSVersionStep,
6
- checkGitVersionStep,
7
- checkHelperVersionStep,
8
- checkLFSFiltersStep,
9
- } from '../../utils/lm/steps.mjs'
10
-
1
+ import { Listr } from 'listr2';
2
+ import { checkGitLFSVersionStep, checkGitVersionStep, checkHelperVersionStep, checkLFSFiltersStep, } from '../../utils/lm/steps.mjs';
11
3
  /**
12
4
  * The lm:info command
13
5
  */
14
6
  const lmInfo = async () => {
15
- const steps = [
16
- checkGitVersionStep,
17
- checkGitLFSVersionStep,
18
- checkLFSFiltersStep((ctx, task, installed) => {
19
- if (!installed) {
20
- throw new Error('Git LFS filters are not installed, run `git lfs install` to install them')
21
- }
22
- }),
23
- checkHelperVersionStep,
24
- ]
25
-
26
- const tasks = new Listr(steps, { concurrent: true, exitOnError: false })
27
- try {
28
- await tasks.run()
29
- } catch {
30
- // an error is already reported when a task fails
31
- }
32
- }
33
-
7
+ const steps = [
8
+ checkGitVersionStep,
9
+ checkGitLFSVersionStep,
10
+ // @ts-expect-error TS(7006) FIXME: Parameter 'ctx' implicitly has an 'any' type.
11
+ checkLFSFiltersStep((ctx, task, installed) => {
12
+ if (!installed) {
13
+ throw new Error('Git LFS filters are not installed, run `git lfs install` to install them');
14
+ }
15
+ }),
16
+ checkHelperVersionStep,
17
+ ];
18
+ const tasks = new Listr(steps, { concurrent: true, exitOnError: false });
19
+ try {
20
+ await tasks.run();
21
+ }
22
+ catch {
23
+ // an error is already reported when a task fails
24
+ }
25
+ };
34
26
  /**
35
27
  * Creates the `netlify lm:info` command
36
28
  * @param {import('../base-command.mjs').default} program
37
29
  * @returns
38
30
  */
39
- export const createLmInfoCommand = (program) =>
40
- program.command('lm:info', { hidden: true }).description('Show large media requirements information.').action(lmInfo)
31
+ // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
32
+ export const createLmInfoCommand = (program) => program.command('lm:info', { hidden: true }).description('Show large media requirements information.').action(lmInfo);
@@ -1,31 +1,27 @@
1
- // @ts-check
2
- import { installPlatform } from '../../utils/lm/install.mjs'
3
- import { printBanner } from '../../utils/lm/ui.mjs'
4
-
1
+ import { installPlatform } from '../../utils/lm/install.mjs';
2
+ import { printBanner } from '../../utils/lm/ui.mjs';
5
3
  /**
6
4
  * The lm:install command
7
5
  * @param {import('commander').OptionValues} options
8
6
  */
7
+ // @ts-expect-error TS(7031) FIXME: Binding element 'force' implicitly has an 'any' ty... Remove this comment to see the full error message
9
8
  const lmInstall = async ({ force }) => {
10
- const installed = await installPlatform({ force })
11
- if (installed) {
12
- printBanner(force)
13
- }
14
- }
15
-
9
+ const installed = await installPlatform({ force });
10
+ if (installed) {
11
+ printBanner(force);
12
+ }
13
+ };
16
14
  /**
17
15
  * Creates the `netlify lm:install` command
18
16
  * @param {import('../base-command.mjs').default} program
19
17
  * @returns
20
18
  */
21
- export const createLmInstallCommand = (program) =>
22
- program
19
+ // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
20
+ export const createLmInstallCommand = (program) => program
23
21
  .command('lm:install', { hidden: true })
24
22
  .alias('lm:init')
25
- .description(
26
- `Configures your computer to use Netlify Large Media
23
+ .description(`Configures your computer to use Netlify Large Media
27
24
  It installs the required credentials helper for Git,
28
- and configures your Git environment with the right credentials.`,
29
- )
25
+ and configures your Git environment with the right credentials.`)
30
26
  .option('-f, --force', 'Force the credentials helper installation')
31
- .action(lmInstall)
27
+ .action(lmInstall);
@@ -1,105 +1,101 @@
1
- // @ts-check
2
- import { Listr } from 'listr2'
3
-
4
- import { error } from '../../utils/command-helpers.mjs'
5
- import execa from '../../utils/execa.mjs'
6
- import { installPlatform } from '../../utils/lm/install.mjs'
7
- import { checkHelperVersion } from '../../utils/lm/requirements.mjs'
8
- import { printBanner } from '../../utils/lm/ui.mjs'
9
-
1
+ import { Listr } from 'listr2';
2
+ import { error } from '../../utils/command-helpers.mjs';
3
+ // @ts-expect-error TS(7034) FIXME: Variable 'execa' implicitly has type 'any' in some... Remove this comment to see the full error message
4
+ import execa from '../../utils/execa.mjs';
5
+ import { installPlatform } from '../../utils/lm/install.mjs';
6
+ import { checkHelperVersion } from '../../utils/lm/requirements.mjs';
7
+ import { printBanner } from '../../utils/lm/ui.mjs';
8
+ // @ts-expect-error TS(7031) FIXME: Binding element 'force' implicitly has an 'any' ty... Remove this comment to see the full error message
10
9
  const installHelperIfMissing = async function ({ force }) {
11
- let installHelper = false
12
- try {
13
- const version = await checkHelperVersion()
14
- if (!version) {
15
- installHelper = true
10
+ let installHelper = false;
11
+ try {
12
+ const version = await checkHelperVersion();
13
+ if (!version) {
14
+ installHelper = true;
15
+ }
16
+ }
17
+ catch {
18
+ installHelper = true;
19
+ }
20
+ if (installHelper) {
21
+ return installPlatform({ force });
16
22
  }
17
- } catch {
18
- installHelper = true
19
- }
20
-
21
- if (installHelper) {
22
- return installPlatform({ force })
23
- }
24
-
25
- return false
26
- }
27
-
23
+ return false;
24
+ };
25
+ // @ts-expect-error TS(7006) FIXME: Parameter 'siteId' implicitly has an 'any' type.
28
26
  const provisionService = async function (siteId, api) {
29
- const addonName = 'large-media'
30
-
31
- if (!siteId) {
32
- throw new Error('No site id found, please run inside a site folder or `netlify link`')
33
- }
34
- try {
35
- await api.createServiceInstance({
36
- siteId,
37
- addon: addonName,
38
- body: {},
39
- })
40
- } catch (error_) {
41
- // error is JSONHTTPError
42
- throw new Error(error_.json.error)
43
- }
44
- }
45
-
27
+ const addonName = 'large-media';
28
+ if (!siteId) {
29
+ throw new Error('No site id found, please run inside a site folder or `netlify link`');
30
+ }
31
+ try {
32
+ await api.createServiceInstance({
33
+ siteId,
34
+ addon: addonName,
35
+ body: {},
36
+ });
37
+ }
38
+ catch (error_) {
39
+ // error is JSONHTTPError
40
+ // @ts-expect-error TS(2571) FIXME: Object is of type 'unknown'.
41
+ throw new Error(error_.json.error);
42
+ }
43
+ };
44
+ // @ts-expect-error TS(7006) FIXME: Parameter 'siteId' implicitly has an 'any' type.
46
45
  const configureLFSURL = async function (siteId, api) {
47
- const siteInfo = await api.getSite({ siteId })
48
- const url = `https://${siteInfo.id_domain}/.netlify/large-media`
49
-
50
- return execa('git', ['config', '-f', '.lfsconfig', 'lfs.url', url])
51
- }
52
-
46
+ const siteInfo = await api.getSite({ siteId });
47
+ const url = `https://${siteInfo.id_domain}/.netlify/large-media`;
48
+ // @ts-expect-error TS(7005) FIXME: Variable 'execa' implicitly has an 'any' type.
49
+ return execa('git', ['config', '-f', '.lfsconfig', 'lfs.url', url]);
50
+ };
53
51
  /**
54
52
  * The lm:setup command
55
53
  * @param {import('commander').OptionValues} options
56
54
  * @param {import('../base-command.mjs').default} command
57
55
  */
56
+ // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
58
57
  const lmSetup = async (options, command) => {
59
- await command.authenticate()
60
-
61
- const { api, site } = command.netlify
62
-
63
- let helperInstalled = false
64
- if (!options.skipInstall) {
65
- try {
66
- helperInstalled = await installHelperIfMissing({ force: options.forceInstall })
67
- } catch (error_) {
68
- error(error_)
58
+ await command.authenticate();
59
+ const { api, site } = command.netlify;
60
+ let helperInstalled = false;
61
+ if (!options.skipInstall) {
62
+ try {
63
+ helperInstalled = await installHelperIfMissing({ force: options.forceInstall });
64
+ }
65
+ catch (error_) {
66
+ // @ts-expect-error TS(2345) FIXME: Argument of type 'unknown' is not assignable to pa... Remove this comment to see the full error message
67
+ error(error_);
68
+ }
69
+ }
70
+ const tasks = new Listr([
71
+ {
72
+ title: 'Provisioning Netlify Large Media',
73
+ async task() {
74
+ await provisionService(site.id, api);
75
+ },
76
+ },
77
+ {
78
+ title: 'Configuring Git LFS for this site',
79
+ async task() {
80
+ await configureLFSURL(site.id, api);
81
+ },
82
+ },
83
+ ]);
84
+ await tasks.run().catch(() => { });
85
+ if (helperInstalled) {
86
+ printBanner(options.forceInstall);
69
87
  }
70
- }
71
-
72
- const tasks = new Listr([
73
- {
74
- title: 'Provisioning Netlify Large Media',
75
- async task() {
76
- await provisionService(site.id, api)
77
- },
78
- },
79
- {
80
- title: 'Configuring Git LFS for this site',
81
- async task() {
82
- await configureLFSURL(site.id, api)
83
- },
84
- },
85
- ])
86
- await tasks.run().catch(() => {})
87
-
88
- if (helperInstalled) {
89
- printBanner(options.forceInstall)
90
- }
91
- }
92
-
88
+ };
93
89
  /**
94
90
  * Creates the `netlify lm:setup` command
95
91
  * @param {import('../base-command.mjs').default} program
96
92
  * @returns
97
93
  */
98
- export const createLmSetupCommand = (program) =>
99
- program
94
+ // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
95
+ export const createLmSetupCommand = (program) => program
100
96
  .command('lm:setup', { hidden: true })
101
97
  .description('Configures your site to use Netlify Large Media')
102
98
  .option('-s, --skip-install', 'Skip the credentials helper installation check')
103
99
  .option('-f, --force-install', 'Force the credentials helper installation')
104
100
  .addHelpText('after', 'It runs the install command if you have not installed the dependencies yet.')
105
- .action(lmSetup)
101
+ .action(lmSetup);
@@ -1,23 +1,18 @@
1
- // @ts-check
2
- import { uninstall } from '../../utils/lm/install.mjs'
3
-
1
+ import { uninstall } from '../../utils/lm/install.mjs';
4
2
  /**
5
3
  * The lm:uninstall command
6
4
  */
7
5
  const lmUninstall = async () => {
8
- await uninstall()
9
- }
10
-
6
+ await uninstall();
7
+ };
11
8
  /**
12
9
  * Creates the `netlify lm:uninstall` command
13
10
  * @param {import('../base-command.mjs').default} program
14
11
  * @returns
15
12
  */
16
- export const createLmUninstallCommand = (program) =>
17
- program
13
+ // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
14
+ export const createLmUninstallCommand = (program) => program
18
15
  .command('lm:uninstall', { hidden: true })
19
16
  .alias('lm:remove')
20
- .description(
21
- 'Uninstalls Netlify git credentials helper and cleans up any related configuration changes made by the install command.',
22
- )
23
- .action(lmUninstall)
17
+ .description('Uninstalls Netlify git credentials helper and cleans up any related configuration changes made by the install command.')
18
+ .action(lmUninstall);
@@ -1,34 +1,30 @@
1
- // @ts-check
2
- import { createLmInfoCommand } from './lm-info.mjs'
3
- import { createLmInstallCommand } from './lm-install.mjs'
4
- import { createLmSetupCommand } from './lm-setup.mjs'
5
- import { createLmUninstallCommand } from './lm-uninstall.mjs'
6
-
1
+ import { createLmInfoCommand } from './lm-info.mjs';
2
+ import { createLmInstallCommand } from './lm-install.mjs';
3
+ import { createLmSetupCommand } from './lm-setup.mjs';
4
+ import { createLmUninstallCommand } from './lm-uninstall.mjs';
7
5
  /**
8
6
  * The lm command
9
7
  * @param {import('commander').OptionValues} options
10
8
  * @param {import('../base-command.mjs').default} command
11
9
  */
10
+ // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
12
11
  const lm = (options, command) => {
13
- command.help()
14
- }
15
-
12
+ command.help();
13
+ };
16
14
  /**
17
15
  * Creates the `netlify lm` command
18
16
  * @param {import('../base-command.mjs').default} program
19
17
  * @returns
20
18
  */
19
+ // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
21
20
  export const createLmCommand = (program) => {
22
- createLmInfoCommand(program)
23
- createLmInstallCommand(program)
24
- createLmSetupCommand(program)
25
- createLmUninstallCommand(program)
26
-
27
- program
28
- .command('lm', { hidden: true })
29
- .description(
30
- '[Deprecated and will be removed from future versions] Handle Netlify Large Media operations\nThe lm command will help you manage large media for a site',
31
- )
32
- .addExamples(['netlify lm:info', 'netlify lm:install', 'netlify lm:setup'])
33
- .action(lm)
34
- }
21
+ createLmInfoCommand(program);
22
+ createLmInstallCommand(program);
23
+ createLmSetupCommand(program);
24
+ createLmUninstallCommand(program);
25
+ program
26
+ .command('lm', { hidden: true })
27
+ .description('[Deprecated and will be removed from future versions] Handle Netlify Large Media operations\nThe lm command will help you manage large media for a site')
28
+ .addExamples(['netlify lm:info', 'netlify lm:install', 'netlify lm:setup'])
29
+ .action(lm);
30
+ };
@@ -1 +1 @@
1
- export { createLoginCommand, login } from './login.mjs'
1
+ export { createLoginCommand, login } from './login.mjs';
@@ -1,55 +1,49 @@
1
- // @ts-check
2
- import { chalk, exit, getToken, log } from '../../utils/command-helpers.mjs'
3
-
1
+ import { chalk, exit, getToken, log } from '../../utils/command-helpers.mjs';
2
+ // @ts-expect-error TS(7006) FIXME: Parameter 'location' implicitly has an 'any' type.
4
3
  const msg = function (location) {
5
- switch (location) {
6
- case 'env':
7
- return 'via process.env.NETLIFY_AUTH_TOKEN set in your terminal session'
8
- case 'flag':
9
- return 'via CLI --auth flag'
10
- case 'config':
11
- return 'via netlify config on your machine'
12
- default:
13
- return ''
14
- }
15
- }
16
-
4
+ switch (location) {
5
+ case 'env':
6
+ return 'via process.env.NETLIFY_AUTH_TOKEN set in your terminal session';
7
+ case 'flag':
8
+ return 'via CLI --auth flag';
9
+ case 'config':
10
+ return 'via netlify config on your machine';
11
+ default:
12
+ return '';
13
+ }
14
+ };
17
15
  /**
18
16
  * The login command
19
17
  * @param {import('commander').OptionValues} options
20
18
  * @param {import('../base-command.mjs').default} command
21
19
  */
20
+ // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
22
21
  export const login = async (options, command) => {
23
- const [accessToken, location] = await getToken()
24
-
25
- command.setAnalyticsPayload({ new: options.new })
26
-
27
- if (accessToken && !options.new) {
28
- log(`Already logged in ${msg(location)}`)
29
- log()
30
- log(`Run ${chalk.cyanBright('netlify status')} for account details`)
31
- log()
32
- log(`or run ${chalk.cyanBright('netlify switch')} to switch accounts`)
33
- log()
34
- log(`To see all available commands run: ${chalk.cyanBright('netlify help')}`)
35
- log()
36
- return exit()
37
- }
38
-
39
- await command.expensivelyAuthenticate()
40
- }
41
-
22
+ // @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
23
+ const [accessToken, location] = await getToken();
24
+ command.setAnalyticsPayload({ new: options.new });
25
+ if (accessToken && !options.new) {
26
+ log(`Already logged in ${msg(location)}`);
27
+ log();
28
+ log(`Run ${chalk.cyanBright('netlify status')} for account details`);
29
+ log();
30
+ log(`or run ${chalk.cyanBright('netlify switch')} to switch accounts`);
31
+ log();
32
+ log(`To see all available commands run: ${chalk.cyanBright('netlify help')}`);
33
+ log();
34
+ return exit();
35
+ }
36
+ await command.expensivelyAuthenticate();
37
+ };
42
38
  /**
43
39
  * Creates the `netlify login` command
44
40
  * @param {import('../base-command.mjs').default} program
45
41
  * @returns
46
42
  */
47
- export const createLoginCommand = (program) =>
48
- program
43
+ // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
44
+ export const createLoginCommand = (program) => program
49
45
  .command('login')
50
- .description(
51
- `Login to your Netlify account
52
- Opens a web browser to acquire an OAuth token.`,
53
- )
46
+ .description(`Login to your Netlify account
47
+ Opens a web browser to acquire an OAuth token.`)
54
48
  .option('--new', 'Login to new Netlify account')
55
- .action(login)
49
+ .action(login);
@@ -1 +1 @@
1
- export { createLogoutCommand } from './logout.mjs'
1
+ export { createLogoutCommand } from './logout.mjs';
@@ -1,42 +1,36 @@
1
- // @ts-check
2
- import { exit, getToken, log } from '../../utils/command-helpers.mjs'
3
- import { track } from '../../utils/telemetry/index.mjs'
4
-
1
+ import { exit, getToken, log } from '../../utils/command-helpers.mjs';
2
+ import { track } from '../../utils/telemetry/index.mjs';
5
3
  /**
6
4
  * The logout command
7
5
  * @param {import('commander').OptionValues} options
8
6
  * @param {import('../base-command.mjs').default} command
9
7
  */
8
+ // @ts-expect-error TS(7006) FIXME: Parameter 'options' implicitly has an 'any' type.
10
9
  const logout = async (options, command) => {
11
- const [accessToken, location] = await getToken()
12
-
13
- if (!accessToken) {
14
- log(`Already logged out`)
15
- log()
16
- log('To login run "netlify login"')
17
- exit()
18
- }
19
-
20
- await track('user_logout')
21
-
22
- // unset userID without deleting key
23
- command.netlify.globalConfig.set('userId', null)
24
-
25
- if (location === 'env') {
26
- log('The "process.env.NETLIFY_AUTH_TOKEN" is still set in your terminal session')
27
- log()
28
- log('To logout completely, unset the environment variable')
29
- log()
30
- exit()
31
- }
32
-
33
- log(`Logging you out of Netlify. Come back soon!`)
34
- }
35
-
10
+ // @ts-expect-error TS(2554) FIXME: Expected 1 arguments, but got 0.
11
+ const [accessToken, location] = await getToken();
12
+ if (!accessToken) {
13
+ log(`Already logged out`);
14
+ log();
15
+ log('To login run "netlify login"');
16
+ exit();
17
+ }
18
+ await track('user_logout');
19
+ // unset userID without deleting key
20
+ command.netlify.globalConfig.set('userId', null);
21
+ if (location === 'env') {
22
+ log('The "process.env.NETLIFY_AUTH_TOKEN" is still set in your terminal session');
23
+ log();
24
+ log('To logout completely, unset the environment variable');
25
+ log();
26
+ exit();
27
+ }
28
+ log(`Logging you out of Netlify. Come back soon!`);
29
+ };
36
30
  /**
37
31
  * Creates the `netlify logout` command
38
32
  * @param {import('../base-command.mjs').default} program
39
33
  * @returns
40
34
  */
41
- export const createLogoutCommand = (program) =>
42
- program.command('logout', { hidden: true }).description('Logout of your Netlify account').action(logout)
35
+ // @ts-expect-error TS(7006) FIXME: Parameter 'program' implicitly has an 'any' type.
36
+ export const createLogoutCommand = (program) => program.command('logout', { hidden: true }).description('Logout of your Netlify account').action(logout);