netlify-cli 12.2.9 → 12.2.11

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 (139) hide show
  1. package/npm-shrinkwrap.json +255 -1458
  2. package/package.json +3 -7
  3. package/src/commands/addons/addons-auth.mjs +2 -3
  4. package/src/commands/addons/addons-config.mjs +2 -3
  5. package/src/commands/addons/addons-create.mjs +2 -3
  6. package/src/commands/addons/addons-delete.mjs +1 -3
  7. package/src/commands/addons/addons-list.mjs +1 -3
  8. package/src/commands/api/api.mjs +1 -3
  9. package/src/commands/base-command.mjs +3 -3
  10. package/src/commands/build/build.mjs +3 -3
  11. package/src/commands/deploy/deploy.mjs +13 -16
  12. package/src/commands/dev/dev-exec.mjs +2 -3
  13. package/src/commands/dev/dev.mjs +15 -21
  14. package/src/commands/env/env-clone.mjs +2 -3
  15. package/src/commands/env/env-get.mjs +2 -3
  16. package/src/commands/env/env-import.mjs +2 -3
  17. package/src/commands/env/env-list.mjs +2 -4
  18. package/src/commands/env/env-set.mjs +3 -8
  19. package/src/commands/env/env-unset.mjs +2 -3
  20. package/src/commands/functions/functions-build.mjs +1 -3
  21. package/src/commands/functions/functions-create.mjs +3 -3
  22. package/src/commands/functions/functions-invoke.mjs +1 -3
  23. package/src/commands/functions/functions-list.mjs +1 -3
  24. package/src/commands/functions/functions-serve.mjs +1 -2
  25. package/src/commands/functions/functions.mjs +1 -1
  26. package/src/commands/graph/graph-config-write.mjs +1 -3
  27. package/src/commands/graph/graph-edit.mjs +2 -3
  28. package/src/commands/graph/graph-handler.mjs +1 -3
  29. package/src/commands/graph/graph-init.mjs +2 -3
  30. package/src/commands/graph/graph-library.mjs +1 -3
  31. package/src/commands/graph/graph-operations.mjs +1 -3
  32. package/src/commands/graph/graph-pull.mjs +1 -3
  33. package/src/commands/init/init.mjs +2 -4
  34. package/src/commands/link/link.mjs +1 -3
  35. package/src/commands/lm/lm-setup.mjs +2 -3
  36. package/src/commands/login/login.mjs +1 -3
  37. package/src/commands/logout/logout.mjs +1 -3
  38. package/src/commands/main.mjs +3 -3
  39. package/src/commands/open/open-admin.mjs +2 -3
  40. package/src/commands/open/open-site.mjs +2 -3
  41. package/src/commands/open/open.mjs +1 -3
  42. package/src/commands/recipes/recipes.mjs +3 -3
  43. package/src/commands/sites/sites-create-template.mjs +7 -8
  44. package/src/commands/sites/sites-create.mjs +2 -4
  45. package/src/commands/sites/sites-delete.mjs +1 -3
  46. package/src/commands/sites/sites-list.mjs +1 -3
  47. package/src/commands/status/status-hooks.mjs +1 -3
  48. package/src/commands/status/status.mjs +1 -3
  49. package/src/commands/switch/switch.mjs +1 -3
  50. package/src/commands/unlink/unlink.mjs +1 -3
  51. package/src/commands/watch/watch.mjs +1 -3
  52. package/src/lib/account.mjs +14 -0
  53. package/src/lib/api.mjs +1 -1
  54. package/src/lib/completion/generate-autocompletion.mjs +1 -1
  55. package/src/lib/edge-functions/consts.mjs +4 -0
  56. package/src/lib/edge-functions/{deploy.cjs → deploy.mjs} +7 -13
  57. package/src/lib/edge-functions/{headers.cjs → headers.mjs} +3 -1
  58. package/src/lib/edge-functions/{internal.cjs → internal.mjs} +24 -20
  59. package/src/lib/edge-functions/{proxy.cjs → proxy.mjs} +18 -20
  60. package/src/lib/edge-functions/{registry.cjs → registry.mjs} +16 -7
  61. package/src/lib/{exec-fetcher.cjs → exec-fetcher.mjs} +17 -12
  62. package/src/lib/functions/{background.cjs → background.mjs} +4 -6
  63. package/src/lib/functions/{config.cjs → config.mjs} +1 -3
  64. package/src/lib/functions/form-submissions-handler.mjs +2 -2
  65. package/src/lib/functions/{local-proxy.cjs → local-proxy.mjs} +4 -6
  66. package/src/lib/functions/{memoized-build.cjs → memoized-build.mjs} +1 -3
  67. package/src/lib/functions/{netlify-function.cjs → netlify-function.mjs} +5 -8
  68. package/src/lib/functions/{registry.cjs → registry.mjs} +12 -14
  69. package/src/lib/functions/runtimes/go/{index.cjs → index.mjs} +10 -10
  70. package/src/lib/functions/runtimes/{index.cjs → index.mjs} +12 -7
  71. package/src/lib/functions/runtimes/js/builders/{netlify-lambda.cjs → netlify-lambda.mjs} +13 -10
  72. package/src/lib/functions/runtimes/js/builders/{zisi.cjs → zisi.mjs} +15 -13
  73. package/src/lib/functions/runtimes/js/{index.cjs → index.mjs} +12 -12
  74. package/src/lib/functions/runtimes/rust/{index.cjs → index.mjs} +15 -15
  75. package/src/lib/functions/scheduled.mjs +1 -1
  76. package/src/lib/functions/server.mjs +6 -7
  77. package/src/lib/functions/{synchronous.cjs → synchronous.mjs} +5 -7
  78. package/src/lib/functions/{utils.cjs → utils.mjs} +6 -21
  79. package/src/lib/{geo-location.cjs → geo-location.mjs} +3 -5
  80. package/src/lib/http-agent.mjs +1 -1
  81. package/src/lib/{log.cjs → log.mjs} +3 -7
  82. package/src/lib/one-graph/cli-client.mjs +2 -2
  83. package/src/lib/one-graph/cli-netlify-graph.mjs +2 -3
  84. package/src/lib/path.mjs +1 -0
  85. package/src/lib/{render-error-remplate.cjs → render-error-template.mjs} +8 -4
  86. package/src/lib/{string.cjs → string.mjs} +1 -3
  87. package/src/recipes/vscode/index.mjs +1 -1
  88. package/src/utils/addons/diffs/options.mjs +1 -1
  89. package/src/utils/addons/prepare.mjs +1 -1
  90. package/src/utils/addons/prompts.mjs +1 -1
  91. package/src/utils/addons/render.mjs +1 -1
  92. package/src/utils/{command-helpers.cjs → command-helpers.mjs} +45 -64
  93. package/src/utils/{deferred.cjs → create-deferred.mjs} +1 -1
  94. package/src/utils/deploy/constants.mjs +19 -0
  95. package/src/utils/deploy/{deploy-site.cjs → deploy-site.mjs} +15 -17
  96. package/src/utils/deploy/{hash-files.cjs → hash-files.mjs} +7 -5
  97. package/src/utils/deploy/{hash-fns.cjs → hash-fns.mjs} +11 -8
  98. package/src/utils/deploy/{hasher-segments.cjs → hasher-segments.mjs} +10 -17
  99. package/src/utils/deploy/{upload-files.cjs → upload-files.mjs} +5 -5
  100. package/src/utils/deploy/{util.cjs → util.mjs} +8 -20
  101. package/src/utils/detect-server-settings.mjs +2 -2
  102. package/src/utils/{dev.cjs → dev.mjs} +13 -21
  103. package/src/utils/{dot-env.cjs → dot-env.mjs} +7 -9
  104. package/src/utils/env/{index.cjs → index.mjs} +11 -24
  105. package/src/utils/execa.mjs +17 -0
  106. package/src/utils/get-global-config.mjs +40 -0
  107. package/src/utils/get-repo-data.mjs +1 -1
  108. package/src/utils/{gh-auth.cjs → gh-auth.mjs} +10 -12
  109. package/src/utils/gitignore.mjs +1 -1
  110. package/src/utils/{headers.cjs → headers.mjs} +4 -11
  111. package/src/utils/init/{config-github.cjs → config-github.mjs} +6 -8
  112. package/src/utils/init/{config-manual.cjs → config-manual.mjs} +4 -4
  113. package/src/utils/init/{config.cjs → config.mjs} +4 -5
  114. package/src/utils/init/{frameworks.cjs → frameworks.mjs} +2 -5
  115. package/src/utils/init/{node-version.cjs → node-version.mjs} +6 -8
  116. package/src/utils/init/{plugins.cjs → plugins.mjs} +3 -5
  117. package/src/utils/init/{utils.cjs → utils.mjs} +27 -23
  118. package/src/utils/live-tunnel.mjs +3 -3
  119. package/src/utils/lm/install.mjs +3 -3
  120. package/src/utils/lm/requirements.mjs +1 -1
  121. package/src/utils/lm/steps.mjs +1 -1
  122. package/src/utils/lm/ui.mjs +1 -1
  123. package/src/utils/{open-browser.cjs → open-browser.mjs} +5 -5
  124. package/src/utils/{parse-raw-flags.cjs → parse-raw-flags.mjs} +2 -7
  125. package/src/utils/proxy.mjs +14 -10
  126. package/src/utils/{redirects.cjs → redirects.mjs} +3 -7
  127. package/src/utils/{rules-proxy.cjs → rules-proxy.mjs} +19 -19
  128. package/src/utils/sites/{utils.cjs → utils.mjs} +6 -6
  129. package/src/utils/telemetry/telemetry.mjs +2 -2
  130. package/src/utils/telemetry/validation.mjs +1 -1
  131. package/src/lib/account.cjs +0 -9
  132. package/src/lib/edge-functions/consts.cjs +0 -11
  133. package/src/lib/edge-functions/index.cjs +0 -6
  134. package/src/lib/path.cjs +0 -3
  135. package/src/utils/deploy/constants.cjs +0 -31
  136. package/src/utils/deploy/index.cjs +0 -4
  137. package/src/utils/execa.cjs +0 -12
  138. package/src/utils/get-global-config.cjs +0 -47
  139. package/src/utils/index.cjs +0 -22
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "12.2.9",
4
+ "version": "12.2.11",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "contributors": [
@@ -212,7 +212,6 @@
212
212
  "test:init:hugo-deps": "npm ci --prefix tests/integration/hugo-site --no-audit",
213
213
  "test:dev:ava": "ava --verbose",
214
214
  "test:dev:vitest": "vitest run",
215
- "test:ci:ava:unit": "c8 -r json ava --no-worker-threads tests/unit/ tools/",
216
215
  "test:ci:ava:integration": "c8 -r json ava --concurrency 1 --no-worker-threads tests/integration/",
217
216
  "test:ci:vitest:unit": "vitest run --coverage tests/unit/",
218
217
  "test:ci:vitest:integration": "vitest run --coverage --no-threads tests/integration/",
@@ -231,9 +230,9 @@
231
230
  "prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
232
231
  },
233
232
  "dependencies": {
234
- "@netlify/build": "^28.4.5",
233
+ "@netlify/build": "^29.1.1",
235
234
  "@netlify/config": "^20.0.2",
236
- "@netlify/edge-bundler": "^5.3.1",
235
+ "@netlify/edge-bundler": "^6.0.0",
237
236
  "@netlify/framework-info": "^9.5.2",
238
237
  "@netlify/local-functions-proxy": "^1.1.1",
239
238
  "@netlify/zip-it-and-ship-it": "^8.1.0",
@@ -295,7 +294,6 @@
295
294
  "lodash": "^4.17.20",
296
295
  "log-symbols": "^4.0.0",
297
296
  "log-update": "^5.0.0",
298
- "memoize-one": "^6.0.0",
299
297
  "minimist": "^1.2.5",
300
298
  "multiparty": "^4.2.1",
301
299
  "netlify": "^13.0.2",
@@ -305,7 +303,6 @@
305
303
  "netlify-redirector": "^0.3.1",
306
304
  "node-fetch": "^2.6.0",
307
305
  "node-version-alias": "^1.0.1",
308
- "omit.js": "^2.0.2",
309
306
  "ora": "^5.0.0",
310
307
  "p-filter": "^2.1.0",
311
308
  "p-map": "^4.0.0",
@@ -357,7 +354,6 @@
357
354
  "serialize-javascript": "^6.0.0",
358
355
  "sinon": "^14.0.0",
359
356
  "strip-ansi": "^6.0.0",
360
- "supertest": "^6.1.6",
361
357
  "temp-dir": "^2.0.0",
362
358
  "tomlify-j0.4": "^3.0.0",
363
359
  "tree-kill": "^1.2.2",
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
2
  import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.mjs'
3
- import utils from '../../utils/index.cjs'
4
-
5
- const { exit, log, openBrowser } = utils
3
+ import { exit, log } from '../../utils/command-helpers.mjs'
4
+ import openBrowser from '../../utils/open-browser.mjs'
6
5
 
7
6
  /**
8
7
  * The addons:auth command
@@ -8,9 +8,8 @@ import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepar
8
8
  import generatePrompts from '../../utils/addons/prompts.mjs'
9
9
  import { renderConfigValues } from '../../utils/addons/render.mjs'
10
10
  import { missingConfigValues, requiredConfigValues, updateConfigValues } from '../../utils/addons/validation.mjs'
11
- import utils from '../../utils/index.cjs'
12
-
13
- const { chalk, error, log, parseRawFlags } = utils
11
+ import { chalk, error, log } from '../../utils/command-helpers.mjs'
12
+ import { parseRawFlags } from '../../utils/parse-raw-flags.mjs'
14
13
 
15
14
  const update = async function ({ addonName, api, currentConfig, instanceId, newConfig, siteId }) {
16
15
  const codeDiff = diffValues(currentConfig, newConfig)
@@ -6,9 +6,8 @@ import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepar
6
6
  import generatePrompts from '../../utils/addons/prompts.mjs'
7
7
  import { renderConfigValues, renderMissingValues } from '../../utils/addons/render.mjs'
8
8
  import { missingConfigValues, requiredConfigValues, updateConfigValues } from '../../utils/addons/validation.mjs'
9
- import utils from '../../utils/index.cjs'
10
-
11
- const { chalk, error, log, parseRawFlags } = utils
9
+ import { chalk, error, log } from '../../utils/command-helpers.mjs'
10
+ import { parseRawFlags } from '../../utils/parse-raw-flags.mjs'
12
11
 
13
12
  const createAddon = async ({ addonName, api, config, siteData, siteId }) => {
14
13
  try {
@@ -2,9 +2,7 @@
2
2
  import inquirer from 'inquirer'
3
3
 
4
4
  import { ADDON_VALIDATION, prepareAddonCommand } from '../../utils/addons/prepare.mjs'
5
- import utils from '../../utils/index.cjs'
6
-
7
- const { error, exit, log } = utils
5
+ import { error, exit, log } from '../../utils/command-helpers.mjs'
8
6
 
9
7
  /**
10
8
  * The addons:delete command
@@ -2,9 +2,7 @@
2
2
  import AsciiTable from 'ascii-table'
3
3
 
4
4
  import { prepareAddonCommand } from '../../utils/addons/prepare.mjs'
5
- import utils from '../../utils/index.cjs'
6
-
7
- const { log, logJson } = utils
5
+ import { log, logJson } from '../../utils/command-helpers.mjs'
8
6
 
9
7
  /**
10
8
  * The addons:list command
@@ -2,9 +2,7 @@
2
2
  import AsciiTable from 'ascii-table'
3
3
  import { methods } from 'netlify'
4
4
 
5
- import utils from '../../utils/index.cjs'
6
-
7
- const { chalk, error, exit, log, logJson } = utils
5
+ import { chalk, error, exit, log, logJson } from '../../utils/command-helpers.mjs'
8
6
 
9
7
  /**
10
8
  * The api command
@@ -22,9 +22,9 @@ import {
22
22
  pollForToken,
23
23
  sortOptions,
24
24
  warn,
25
- } from '../utils/command-helpers.cjs'
26
- import getGlobalConfig from '../utils/get-global-config.cjs'
27
- import { openBrowser } from '../utils/open-browser.cjs'
25
+ } from '../utils/command-helpers.mjs'
26
+ import getGlobalConfig from '../utils/get-global-config.mjs'
27
+ import openBrowser from '../utils/open-browser.mjs'
28
28
  import StateConfig from '../utils/state-config.mjs'
29
29
  import { identify, track } from '../utils/telemetry/index.mjs'
30
30
 
@@ -2,9 +2,9 @@
2
2
  import process from 'process'
3
3
 
4
4
  import { getBuildOptions, runBuild } from '../../lib/build.mjs'
5
- import utils from '../../utils/index.cjs'
6
-
7
- const { error, exit, generateNetlifyGraphJWT, getEnvelopeEnv, getToken, normalizeContext } = utils
5
+ import { error, exit, getToken } from '../../utils/command-helpers.mjs'
6
+ import { generateNetlifyGraphJWT } from '../../utils/dev.mjs'
7
+ import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs'
8
8
 
9
9
  /**
10
10
  * @param {import('../../lib/build.mjs').BuildConfig} options
@@ -12,30 +12,27 @@ import prettyjson from 'prettyjson'
12
12
 
13
13
  import { cancelDeploy } from '../../lib/api.mjs'
14
14
  import { getBuildOptions, runBuild } from '../../lib/build.mjs'
15
- import { normalizeFunctionsConfig } from '../../lib/functions/config.cjs'
16
- import { getLogMessage } from '../../lib/log.cjs'
15
+ import { normalizeFunctionsConfig } from '../../lib/functions/config.mjs'
16
+ import { getLogMessage } from '../../lib/log.mjs'
17
17
  import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
18
- import { getFunctionsManifestPath, getInternalFunctionsDir } from '../../utils/functions/index.mjs'
19
- import utils from '../../utils/index.cjs'
20
- import { link } from '../link/index.mjs'
21
- import { sitesCreate } from '../sites/index.mjs'
22
-
23
- const {
24
- NETLIFYDEV,
25
- NETLIFYDEVERR,
26
- NETLIFYDEVLOG,
18
+ import {
27
19
  chalk,
28
- deploySite,
29
20
  error,
30
21
  exit,
31
22
  getToken,
32
23
  log,
33
24
  logJson,
34
- openBrowser,
25
+ NETLIFYDEV,
26
+ NETLIFYDEVERR,
27
+ NETLIFYDEVLOG,
35
28
  warn,
36
- } = utils
37
-
38
- const DEFAULT_DEPLOY_TIMEOUT = 1.2e6
29
+ } from '../../utils/command-helpers.mjs'
30
+ import { DEFAULT_DEPLOY_TIMEOUT } from '../../utils/deploy/constants.mjs'
31
+ import { deploySite } from '../../utils/deploy/deploy-site.mjs'
32
+ import { getFunctionsManifestPath, getInternalFunctionsDir } from '../../utils/functions/index.mjs'
33
+ import openBrowser from '../../utils/open-browser.mjs'
34
+ import { link } from '../link/index.mjs'
35
+ import { sitesCreate } from '../sites/index.mjs'
39
36
 
40
37
  const triggerDeploy = async ({ api, options, siteData, siteId }) => {
41
38
  try {
@@ -1,8 +1,7 @@
1
1
  import execa from 'execa'
2
2
 
3
- import utils from '../../utils/index.cjs'
4
-
5
- const { getEnvelopeEnv, injectEnvVariables, normalizeContext } = utils
3
+ import { injectEnvVariables } from '../../utils/dev.mjs'
4
+ import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs'
6
5
 
7
6
  /**
8
7
  * The dev:exec command
@@ -27,36 +27,30 @@ import {
27
27
  readGraphQLOperationsSourceFile,
28
28
  } from '../../lib/one-graph/cli-netlify-graph.mjs'
29
29
  import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
30
- import detectServerSettings from '../../utils/detect-server-settings.mjs'
31
- import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
32
- import utils from '../../utils/index.cjs'
33
- import { startLiveTunnel } from '../../utils/live-tunnel.mjs'
34
- import { startProxy } from '../../utils/proxy.mjs'
35
-
36
- import { createDevExecCommand } from './dev-exec.mjs'
37
-
38
- const {
30
+ import {
39
31
  BANG,
40
- NETLIFYDEV,
41
- NETLIFYDEVERR,
42
- NETLIFYDEVLOG,
43
- NETLIFYDEVWARN,
44
32
  chalk,
45
33
  error,
46
34
  exit,
47
- generateNetlifyGraphJWT,
48
- getEnvelopeEnv,
49
- getSiteInformation,
50
35
  getToken,
51
- injectEnvVariables,
52
36
  log,
37
+ NETLIFYDEV,
38
+ NETLIFYDEVERR,
39
+ NETLIFYDEVLOG,
40
+ NETLIFYDEVWARN,
53
41
  normalizeConfig,
54
- normalizeContext,
55
- openBrowser,
56
- processOnExit,
57
42
  warn,
58
43
  watchDebounced,
59
- } = utils
44
+ } from '../../utils/command-helpers.mjs'
45
+ import detectServerSettings from '../../utils/detect-server-settings.mjs'
46
+ import { generateNetlifyGraphJWT, getSiteInformation, injectEnvVariables, processOnExit } from '../../utils/dev.mjs'
47
+ import { getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs'
48
+ import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
49
+ import { startLiveTunnel } from '../../utils/live-tunnel.mjs'
50
+ import openBrowser from '../../utils/open-browser.mjs'
51
+ import { startProxy } from '../../utils/proxy.mjs'
52
+
53
+ import { createDevExecCommand } from './dev-exec.mjs'
60
54
 
61
55
  const netlifyBuildPromise = import('@netlify/build')
62
56
 
@@ -1,7 +1,6 @@
1
1
  // @ts-check
2
- import utils from '../../utils/index.cjs'
3
-
4
- const { chalk, error: logError, log, translateFromEnvelopeToMongo, translateFromMongoToEnvelope } = utils
2
+ import { chalk, error as logError, log } from '../../utils/command-helpers.mjs'
3
+ import { translateFromEnvelopeToMongo, translateFromMongoToEnvelope } from '../../utils/env/index.mjs'
5
4
 
6
5
  const safeGetSite = async (api, siteId) => {
7
6
  try {
@@ -1,9 +1,8 @@
1
1
  // @ts-check
2
2
  import { Option } from 'commander'
3
3
 
4
- import utils from '../../utils/index.cjs'
5
-
6
- const { AVAILABLE_CONTEXTS, chalk, error, getEnvelopeEnv, log, logJson, normalizeContext } = utils
4
+ import { chalk, error, log, logJson } from '../../utils/command-helpers.mjs'
5
+ import { AVAILABLE_CONTEXTS, getEnvelopeEnv, normalizeContext } from '../../utils/env/index.mjs'
7
6
 
8
7
  /**
9
8
  * The env:get command
@@ -4,9 +4,8 @@ import { readFile } from 'fs/promises'
4
4
  import AsciiTable from 'ascii-table'
5
5
  import dotenv from 'dotenv'
6
6
 
7
- import utils from '../../utils/index.cjs'
8
-
9
- const { exit, log, logJson, translateFromEnvelopeToMongo, translateFromMongoToEnvelope } = utils
7
+ import { exit, log, logJson } from '../../utils/command-helpers.mjs'
8
+ import { translateFromEnvelopeToMongo, translateFromMongoToEnvelope } from '../../utils/env/index.mjs'
10
9
 
11
10
  /**
12
11
  * The env:import command
@@ -6,10 +6,8 @@ import { Option } from 'commander'
6
6
  import inquirer from 'inquirer'
7
7
  import logUpdate from 'log-update'
8
8
 
9
- import utils from '../../utils/index.cjs'
10
-
11
- const { AVAILABLE_CONTEXTS, chalk, error, getEnvelopeEnv, getHumanReadableScopes, log, logJson, normalizeContext } =
12
- utils
9
+ import { chalk, error, log, logJson } from '../../utils/command-helpers.mjs'
10
+ import { AVAILABLE_CONTEXTS, getEnvelopeEnv, getHumanReadableScopes, normalizeContext } from '../../utils/env/index.mjs'
13
11
 
14
12
  const MASK_LENGTH = 50
15
13
  const MASK = '*'.repeat(MASK_LENGTH)
@@ -1,18 +1,13 @@
1
1
  // @ts-check
2
2
  import { Option } from 'commander'
3
3
 
4
- import utils from '../../utils/index.cjs'
5
-
6
- const {
4
+ import { chalk, error, log, logJson } from '../../utils/command-helpers.mjs'
5
+ import {
7
6
  AVAILABLE_CONTEXTS,
8
7
  AVAILABLE_SCOPES,
9
- chalk,
10
- error,
11
- log,
12
- logJson,
13
8
  normalizeContext,
14
9
  translateFromEnvelopeToMongo,
15
- } = utils
10
+ } from '../../utils/env/index.mjs'
16
11
 
17
12
  /**
18
13
  * The env:set command
@@ -1,7 +1,6 @@
1
1
  // @ts-check
2
- import utils from '../../utils/index.cjs'
3
-
4
- const { AVAILABLE_CONTEXTS, chalk, error, log, logJson, normalizeContext, translateFromEnvelopeToMongo } = utils
2
+ import { chalk, error, log, logJson } from '../../utils/command-helpers.mjs'
3
+ import { AVAILABLE_CONTEXTS, normalizeContext, translateFromEnvelopeToMongo } from '../../utils/env/index.mjs'
5
4
 
6
5
  /**
7
6
  * The env:unset command
@@ -1,10 +1,8 @@
1
1
  // @ts-check
2
2
  import { mkdir } from 'fs/promises'
3
3
 
4
+ import { NETLIFYDEVERR, NETLIFYDEVLOG, exit, log } from '../../utils/command-helpers.mjs'
4
5
  import { getFunctionsDir } from '../../utils/functions/index.mjs'
5
- import utils from '../../utils/index.cjs'
6
-
7
- const { NETLIFYDEVERR, NETLIFYDEVLOG, exit, log } = utils
8
6
 
9
7
  /**
10
8
  * The functions:build command
@@ -17,13 +17,13 @@ import fetch from 'node-fetch'
17
17
  import ora from 'ora'
18
18
 
19
19
  import { getAddons, getCurrentAddon, getSiteData } from '../../utils/addons/prepare.mjs'
20
- import utils from '../../utils/index.cjs'
20
+ import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, log } from '../../utils/command-helpers.mjs'
21
+ import { injectEnvVariables } from '../../utils/dev.mjs'
22
+ import execa from '../../utils/execa.mjs'
21
23
  import { readRepoURL, validateRepoURL } from '../../utils/read-repo-url.mjs'
22
24
 
23
25
  const copyTemplateDir = promisify(copyTemplateDirOriginal)
24
26
 
25
- const { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, execa, injectEnvVariables, log } = utils
26
-
27
27
  const require = createRequire(import.meta.url)
28
28
 
29
29
  const templatesDir = path.resolve(dirname(fileURLToPath(import.meta.url)), '../../functions-templates')
@@ -7,10 +7,8 @@ import process from 'process'
7
7
  import inquirer from 'inquirer'
8
8
  import fetch from 'node-fetch'
9
9
 
10
+ import { NETLIFYDEVWARN, chalk, error, exit } from '../../utils/command-helpers.mjs'
10
11
  import { BACKGROUND, CLOCKWORK_USERAGENT, getFunctions } from '../../utils/functions/index.mjs'
11
- import utils from '../../utils/index.cjs'
12
-
13
- const { NETLIFYDEVWARN, chalk, error, exit } = utils
14
12
 
15
13
  const require = createRequire(import.meta.url)
16
14
 
@@ -1,10 +1,8 @@
1
1
  // @ts-check
2
2
  import AsciiTable from 'ascii-table'
3
3
 
4
+ import { error, exit, log, logJson, warn } from '../../utils/command-helpers.mjs'
4
5
  import { getFunctions, getFunctionsDir } from '../../utils/functions/index.mjs'
5
- import utils from '../../utils/index.cjs'
6
-
7
- const { error, exit, log, logJson, warn } = utils
8
6
 
9
7
  const normalizeFunction = function (deployedFunctions, { name, urlPath: url }) {
10
8
  const isDeployed = deployedFunctions.some((deployedFunction) => deployedFunction.n === name)
@@ -2,10 +2,9 @@
2
2
  import { join } from 'path'
3
3
 
4
4
  import { startFunctionsServer } from '../../lib/functions/server.mjs'
5
+ import { acquirePort, getSiteInformation, injectEnvVariables } from '../../utils/dev.mjs'
5
6
  import { getFunctionsDir } from '../../utils/functions/index.mjs'
6
- import utils from '../../utils/index.cjs'
7
7
 
8
- const { acquirePort, getSiteInformation, injectEnvVariables } = utils
9
8
  const DEFAULT_PORT = 9999
10
9
 
11
10
  /**
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- import { chalk } from '../../utils/command-helpers.cjs'
2
+ import { chalk } from '../../utils/command-helpers.mjs'
3
3
 
4
4
  import { createFunctionsBuildCommand } from './functions-build.mjs'
5
5
  import { createFunctionsCreateCommand } from './functions-create.mjs'
@@ -4,9 +4,7 @@ import path from 'path'
4
4
  import process from 'process'
5
5
 
6
6
  import { getNetlifyGraphConfig } from '../../lib/one-graph/cli-netlify-graph.mjs'
7
- import utils from '../../utils/index.cjs'
8
-
9
- const { NETLIFYDEVERR, chalk, error, log } = utils
7
+ import { NETLIFYDEVERR, chalk, error, log } from '../../utils/command-helpers.mjs'
10
8
 
11
9
  /**
12
10
  * Creates the `netlify graph:config:write` command
@@ -8,10 +8,9 @@ import {
8
8
  getNetlifyGraphConfig,
9
9
  readGraphQLOperationsSourceFile,
10
10
  } from '../../lib/one-graph/cli-netlify-graph.mjs'
11
- import utils from '../../utils/index.cjs'
12
- import { openBrowser } from '../../utils/open-browser.cjs'
11
+ import { NETLIFYDEVERR, chalk, error, log } from '../../utils/command-helpers.mjs'
12
+ import openBrowser from '../../utils/open-browser.mjs'
13
13
 
14
- const { NETLIFYDEVERR, chalk, error, log } = utils
15
14
  const { ensureAppForSite, executeCreatePersistedQueryMutation } = OneGraphCliClient
16
15
 
17
16
  /**
@@ -11,9 +11,7 @@ import {
11
11
  getNetlifyGraphConfig,
12
12
  readGraphQLSchemaFile,
13
13
  } from '../../lib/one-graph/cli-netlify-graph.mjs'
14
- import utils from '../../utils/index.cjs'
15
-
16
- const { error, log } = utils
14
+ import { error, log } from '../../utils/command-helpers.mjs'
17
15
 
18
16
  /**
19
17
  * Creates the `netlify graph:handler` command
@@ -7,9 +7,8 @@ import { v4 as uuidv4 } from 'uuid'
7
7
 
8
8
  import { OneGraphCliClient, ensureCLISession } from '../../lib/one-graph/cli-client.mjs'
9
9
  import { getNetlifyGraphConfig } from '../../lib/one-graph/cli-netlify-graph.mjs'
10
- import utils from '../../utils/index.cjs'
11
-
12
- const { NETLIFYDEVERR, chalk, error, exit, getToken, log, translateFromEnvelopeToMongo } = utils
10
+ import { NETLIFYDEVERR, chalk, error, exit, getToken, log } from '../../utils/command-helpers.mjs'
11
+ import { translateFromEnvelopeToMongo } from '../../utils/env/index.mjs'
13
12
 
14
13
  const { ensureAppForSite, executeCreateApiTokenMutation } = OneGraphCliClient
15
14
 
@@ -12,9 +12,7 @@ import {
12
12
  readGraphQLOperationsSourceFile,
13
13
  readGraphQLSchemaFile,
14
14
  } from '../../lib/one-graph/cli-netlify-graph.mjs'
15
- import utils from '../../utils/index.cjs'
16
-
17
- const { NETLIFYDEVERR, chalk, error, log } = utils
15
+ import { NETLIFYDEVERR, chalk, error, log } from '../../utils/command-helpers.mjs'
18
16
 
19
17
  /**
20
18
  * Creates the `netlify graph:library` command
@@ -7,9 +7,7 @@ import {
7
7
  getNetlifyGraphConfig,
8
8
  readGraphQLOperationsSourceFile,
9
9
  } from '../../lib/one-graph/cli-netlify-graph.mjs'
10
- import utils from '../../utils/index.cjs'
11
-
12
- const { log } = utils
10
+ import { log } from '../../utils/command-helpers.mjs'
13
11
 
14
12
  const { parse } = GraphQL
15
13
 
@@ -13,9 +13,7 @@ import {
13
13
  refetchAndGenerateFromOneGraph,
14
14
  } from '../../lib/one-graph/cli-client.mjs'
15
15
  import { buildSchema, getNetlifyGraphConfig, readGraphQLSchemaFile } from '../../lib/one-graph/cli-netlify-graph.mjs'
16
- import utils from '../../utils/index.cjs'
17
-
18
- const { NETLIFYDEVERR, chalk, error, log, warn } = utils
16
+ import { NETLIFYDEVERR, chalk, error, log, warn } from '../../utils/command-helpers.mjs'
19
17
 
20
18
  /**
21
19
  * Creates the `netlify graph:pull` command
@@ -3,16 +3,14 @@ import dotProp from 'dot-prop'
3
3
  import inquirer from 'inquirer'
4
4
  import isEmpty from 'lodash/isEmpty.js'
5
5
 
6
+ import { chalk, exit, log } from '../../utils/command-helpers.mjs'
6
7
  import getRepoData from '../../utils/get-repo-data.mjs'
7
8
  import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
8
- import utils from '../../utils/index.cjs'
9
- import { configureRepo } from '../../utils/init/config.cjs'
9
+ import { configureRepo } from '../../utils/init/config.mjs'
10
10
  import { track } from '../../utils/telemetry/index.mjs'
11
11
  import { link } from '../link/index.mjs'
12
12
  import { sitesCreate } from '../sites/index.mjs'
13
13
 
14
- const { chalk, exit, log } = utils
15
-
16
14
  const persistState = ({ siteInfo, state }) => {
17
15
  // Save to .netlify/state.json file
18
16
  state.set('siteId', siteInfo.id)
@@ -2,13 +2,11 @@
2
2
  import inquirer from 'inquirer'
3
3
 
4
4
  import { listSites } from '../../lib/api.mjs'
5
+ import { chalk, error, exit, log } from '../../utils/command-helpers.mjs'
5
6
  import getRepoData from '../../utils/get-repo-data.mjs'
6
7
  import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
7
- import utils from '../../utils/index.cjs'
8
8
  import { track } from '../../utils/telemetry/index.mjs'
9
9
 
10
- const { chalk, error, exit, log } = utils
11
-
12
10
  /**
13
11
  *
14
12
  * @param {import('../base-command.mjs').NetlifyOptions} netlify
@@ -1,13 +1,12 @@
1
1
  // @ts-check
2
2
  import Listr from 'listr'
3
3
 
4
- import utils from '../../utils/index.cjs'
4
+ import { error } from '../../utils/command-helpers.mjs'
5
+ import execa from '../../utils/execa.mjs'
5
6
  import { installPlatform } from '../../utils/lm/install.mjs'
6
7
  import { checkHelperVersion } from '../../utils/lm/requirements.mjs'
7
8
  import { printBanner } from '../../utils/lm/ui.mjs'
8
9
 
9
- const { error, execa } = utils
10
-
11
10
  const installHelperIfMissing = async function ({ force }) {
12
11
  let installHelper = false
13
12
  try {
@@ -1,7 +1,5 @@
1
1
  // @ts-check
2
- import utils from '../../utils/index.cjs'
3
-
4
- const { chalk, exit, getToken, log } = utils
2
+ import { chalk, exit, getToken, log } from '../../utils/command-helpers.mjs'
5
3
 
6
4
  const msg = function (location) {
7
5
  switch (location) {
@@ -1,9 +1,7 @@
1
1
  // @ts-check
2
- import utils from '../../utils/index.cjs'
2
+ import { exit, getToken, log } from '../../utils/command-helpers.mjs'
3
3
  import { track } from '../../utils/telemetry/index.mjs'
4
4
 
5
- const { exit, getToken, log } = utils
6
-
7
5
  /**
8
6
  * The logout command
9
7
  * @param {import('commander').OptionValues} options
@@ -5,8 +5,10 @@ import { Option } from 'commander'
5
5
  import inquirer from 'inquirer'
6
6
  import { findBestMatch } from 'string-similarity'
7
7
 
8
+ import { BANG, chalk, error, exit, log, NETLIFY_CYAN, USER_AGENT, warn } from '../utils/command-helpers.mjs'
9
+ import execa from '../utils/execa.mjs'
10
+ import getGlobalConfig from '../utils/get-global-config.mjs'
8
11
  import getPackageJson from '../utils/get-package-json.mjs'
9
- import utils from '../utils/index.cjs'
10
12
  import { track } from '../utils/telemetry/index.mjs'
11
13
 
12
14
  import { createAddonsCommand } from './addons/index.mjs'
@@ -32,8 +34,6 @@ import { createSwitchCommand } from './switch/index.mjs'
32
34
  import { createUnlinkCommand } from './unlink/index.mjs'
33
35
  import { createWatchCommand } from './watch/index.mjs'
34
36
 
35
- const { BANG, NETLIFY_CYAN, USER_AGENT, chalk, error, execa, exit, getGlobalConfig, log, warn } = utils
36
-
37
37
  const SUGGESTION_TIMEOUT = 1e4
38
38
 
39
39
  const getVersionPage = async () => {
@@ -1,6 +1,5 @@
1
- import utils from '../../utils/index.cjs'
2
-
3
- const { error, exit, log, openBrowser, warn } = utils
1
+ import { error, exit, log, warn } from '../../utils/command-helpers.mjs'
2
+ import openBrowser from '../../utils/open-browser.mjs'
4
3
 
5
4
  /**
6
5
  * The open:admin command
@@ -1,6 +1,5 @@
1
- import utils from '../../utils/index.cjs'
2
-
3
- const { error, exit, log, openBrowser, warn } = utils
1
+ import { error, exit, log, warn } from '../../utils/command-helpers.mjs'
2
+ import openBrowser from '../../utils/open-browser.mjs'
4
3
 
5
4
  /**
6
5
  * The open:site command