netlify-cli 12.2.6 → 12.2.8

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 (112) hide show
  1. package/bin/run.mjs +2 -3
  2. package/npm-shrinkwrap.json +249 -126
  3. package/package.json +4 -4
  4. package/scripts/postinstall.mjs +2 -2
  5. package/src/commands/base-command.mjs +8 -12
  6. package/src/commands/build/build.mjs +2 -2
  7. package/src/commands/completion/completion.mjs +3 -3
  8. package/src/commands/deploy/deploy.mjs +4 -5
  9. package/src/commands/dev/{dev-exec.cjs → dev-exec.mjs} +5 -5
  10. package/src/commands/dev/{dev.cjs → dev.mjs} +32 -32
  11. package/src/commands/dev/index.mjs +1 -0
  12. package/src/commands/env/{env-clone.cjs → env-clone.mjs} +7 -16
  13. package/src/commands/env/{env-get.cjs → env-get.mjs} +5 -13
  14. package/src/commands/env/{env-import.cjs → env-import.mjs} +8 -15
  15. package/src/commands/env/{env-list.cjs → env-list.mjs} +13 -25
  16. package/src/commands/env/{env-set.cjs → env-set.mjs} +5 -5
  17. package/src/commands/env/{env-unset.cjs → env-unset.mjs} +4 -12
  18. package/src/commands/env/{env.cjs → env.mjs} +7 -9
  19. package/src/commands/env/index.mjs +1 -0
  20. package/src/commands/functions/functions-build.mjs +2 -1
  21. package/src/commands/functions/functions-create.mjs +2 -12
  22. package/src/commands/functions/functions-invoke.mjs +2 -1
  23. package/src/commands/functions/functions-list.mjs +2 -1
  24. package/src/commands/functions/functions-serve.mjs +3 -2
  25. package/src/commands/graph/{graph-config-write.cjs → graph-config-write.mjs} +8 -8
  26. package/src/commands/graph/{graph-edit.cjs → graph-edit.mjs} +9 -14
  27. package/src/commands/graph/{graph-handler.cjs → graph-handler.mjs} +6 -6
  28. package/src/commands/graph/{graph-init.cjs → graph-init.mjs} +12 -20
  29. package/src/commands/graph/{graph-library.cjs → graph-library.mjs} +8 -8
  30. package/src/commands/graph/{graph-operations.cjs → graph-operations.mjs} +7 -7
  31. package/src/commands/graph/{graph-pull.cjs → graph-pull.mjs} +8 -12
  32. package/src/commands/graph/{graph.cjs → graph.mjs} +8 -10
  33. package/src/commands/graph/index.mjs +1 -0
  34. package/src/commands/init/init.mjs +5 -2
  35. package/src/commands/link/index.mjs +1 -0
  36. package/src/commands/link/{link.cjs → link.mjs} +15 -13
  37. package/src/commands/lm/index.mjs +1 -0
  38. package/src/commands/lm/{lm-info.cjs → lm-info.mjs} +4 -6
  39. package/src/commands/lm/{lm-install.cjs → lm-install.mjs} +3 -5
  40. package/src/commands/lm/{lm-setup.cjs → lm-setup.mjs} +8 -8
  41. package/src/commands/lm/{lm-uninstall.cjs → lm-uninstall.mjs} +2 -4
  42. package/src/commands/lm/{lm.cjs → lm.mjs} +5 -7
  43. package/src/commands/logout/logout.mjs +2 -1
  44. package/src/commands/main.mjs +10 -12
  45. package/src/commands/recipes/common.mjs +36 -0
  46. package/src/commands/recipes/index.mjs +1 -0
  47. package/src/commands/recipes/{recipes-list.cjs → recipes-list.mjs} +3 -5
  48. package/src/commands/recipes/{recipes.cjs → recipes.mjs} +12 -10
  49. package/src/commands/sites/sites-create-template.mjs +3 -1
  50. package/src/commands/sites/sites-create.mjs +4 -2
  51. package/src/commands/sites/sites-list.mjs +1 -1
  52. package/src/commands/unlink/unlink.mjs +2 -1
  53. package/src/functions-templates/go/hello-world/go.mod +1 -1
  54. package/src/functions-templates/javascript/stripe-charge/package-lock.json +6 -6
  55. package/src/functions-templates/javascript/stripe-subscription/package-lock.json +6 -6
  56. package/src/functions-templates/javascript/token-hider/package-lock.json +6 -6
  57. package/src/functions-templates/rust/hello-world/Cargo.toml +1 -1
  58. package/src/functions-templates/typescript/hello-world/package-lock.json +6 -6
  59. package/src/lib/account.cjs +0 -3
  60. package/src/lib/{api.cjs → api.mjs} +3 -5
  61. package/src/lib/{build.cjs → build.mjs} +9 -9
  62. package/src/lib/completion/constants.mjs +4 -0
  63. package/src/lib/completion/{generate-autocompletion.cjs → generate-autocompletion.mjs} +6 -6
  64. package/src/lib/completion/{script.cjs → get-autocompletion.mjs} +1 -25
  65. package/src/lib/completion/index.mjs +1 -0
  66. package/src/lib/completion/script.mjs +35 -0
  67. package/src/lib/edge-functions/{editor-helper.cjs → editor-helper.mjs} +4 -6
  68. package/src/lib/edge-functions/index.cjs +1 -2
  69. package/src/lib/exec-fetcher.cjs +0 -2
  70. package/src/lib/functions/{form-submissions-handler.cjs → form-submissions-handler.mjs} +26 -28
  71. package/src/lib/functions/{scheduled.cjs → scheduled.mjs} +6 -8
  72. package/src/lib/functions/{server.cjs → server.mjs} +20 -29
  73. package/src/lib/geo-location.cjs +1 -1
  74. package/src/lib/{http-agent.cjs → http-agent.mjs} +7 -8
  75. package/src/lib/one-graph/{cli-client.cjs → cli-client.mjs} +46 -74
  76. package/src/lib/one-graph/{cli-netlify-graph.cjs → cli-netlify-graph.mjs} +35 -43
  77. package/src/recipes/vscode/{index.cjs → index.mjs} +7 -9
  78. package/src/recipes/vscode/{settings.cjs → settings.mjs} +10 -12
  79. package/src/utils/{create-stream-promise.cjs → create-stream-promise.mjs} +2 -2
  80. package/src/utils/{detect-server-settings.cjs → detect-server-settings.mjs} +14 -20
  81. package/src/utils/functions/constants.mjs +1 -0
  82. package/src/utils/functions/{functions.cjs → functions.mjs} +6 -8
  83. package/src/utils/functions/{get-functions.cjs → get-functions.mjs} +4 -25
  84. package/src/utils/functions/index.mjs +3 -0
  85. package/src/utils/get-package-json.mjs +16 -0
  86. package/src/utils/{get-repo-data.cjs → get-repo-data.mjs} +15 -12
  87. package/src/utils/{gitignore.cjs → gitignore.mjs} +6 -8
  88. package/src/utils/index.cjs +0 -20
  89. package/src/utils/{live-tunnel.cjs → live-tunnel.mjs} +8 -10
  90. package/src/utils/lm/{install.cjs → install.mjs} +26 -25
  91. package/src/utils/lm/{requirements.cjs → requirements.mjs} +6 -13
  92. package/src/utils/lm/{steps.cjs → steps.mjs} +6 -8
  93. package/src/utils/lm/{ui.cjs → ui.mjs} +5 -7
  94. package/src/utils/{proxy.cjs → proxy.mjs} +31 -34
  95. package/src/utils/{read-repo-url.cjs → read-repo-url.mjs} +6 -11
  96. package/src/utils/{state-config.cjs → state-config.mjs} +8 -10
  97. package/src/utils/telemetry/index.mjs +1 -0
  98. package/src/utils/telemetry/{request.cjs → request.mjs} +5 -3
  99. package/src/utils/telemetry/{telemetry.cjs → telemetry.mjs} +12 -14
  100. package/src/utils/telemetry/{validation.cjs → validation.mjs} +2 -2
  101. package/src/commands/dev/index.cjs +0 -5
  102. package/src/commands/env/index.cjs +0 -5
  103. package/src/commands/graph/index.cjs +0 -5
  104. package/src/commands/link/index.cjs +0 -6
  105. package/src/commands/lm/index.cjs +0 -5
  106. package/src/commands/recipes/common.cjs +0 -33
  107. package/src/commands/recipes/index.cjs +0 -8
  108. package/src/lib/completion/constants.cjs +0 -6
  109. package/src/lib/completion/index.cjs +0 -5
  110. package/src/utils/functions/constants.cjs +0 -5
  111. package/src/utils/functions/index.cjs +0 -12
  112. package/src/utils/telemetry/index.cjs +0 -5
@@ -1,14 +1,13 @@
1
1
  // @ts-check
2
- import { readFile } from 'fs/promises'
3
2
  import process from 'process'
4
- import { fileURLToPath } from 'url'
5
3
 
6
4
  import { Option } from 'commander'
7
5
  import inquirer from 'inquirer'
8
6
  import { findBestMatch } from 'string-similarity'
9
7
 
10
- // TODO: use named imports again once the imported file is esm
8
+ import getPackageJson from '../utils/get-package-json.mjs'
11
9
  import utils from '../utils/index.cjs'
10
+ import { track } from '../utils/telemetry/index.mjs'
12
11
 
13
12
  import { createAddonsCommand } from './addons/index.mjs'
14
13
  import { createApiCommand } from './api/index.mjs'
@@ -16,24 +15,24 @@ import BaseCommand from './base-command.mjs'
16
15
  import { createBuildCommand } from './build/index.mjs'
17
16
  import { createCompletionCommand } from './completion/index.mjs'
18
17
  import { createDeployCommand } from './deploy/index.mjs'
19
- import { createDevCommand } from './dev/index.cjs'
20
- import { createEnvCommand } from './env/index.cjs'
18
+ import { createDevCommand } from './dev/index.mjs'
19
+ import { createEnvCommand } from './env/index.mjs'
21
20
  import { createFunctionsCommand } from './functions/index.mjs'
22
- import { createGraphCommand } from './graph/index.cjs'
21
+ import { createGraphCommand } from './graph/index.mjs'
23
22
  import { createInitCommand } from './init/index.mjs'
24
- import { createLinkCommand } from './link/index.cjs'
25
- import { createLmCommand } from './lm/index.cjs'
23
+ import { createLinkCommand } from './link/index.mjs'
24
+ import { createLmCommand } from './lm/index.mjs'
26
25
  import { createLoginCommand } from './login/index.mjs'
27
26
  import { createLogoutCommand } from './logout/index.mjs'
28
27
  import { createOpenCommand } from './open/index.mjs'
29
- import { createRecipesCommand, createRecipesListCommand } from './recipes/index.cjs'
28
+ import { createRecipesCommand } from './recipes/index.mjs'
30
29
  import { createSitesCommand } from './sites/index.mjs'
31
30
  import { createStatusCommand } from './status/index.mjs'
32
31
  import { createSwitchCommand } from './switch/index.mjs'
33
32
  import { createUnlinkCommand } from './unlink/index.mjs'
34
33
  import { createWatchCommand } from './watch/index.mjs'
35
34
 
36
- const { BANG, NETLIFY_CYAN, USER_AGENT, chalk, error, execa, exit, getGlobalConfig, log, track, warn } = utils
35
+ const { BANG, NETLIFY_CYAN, USER_AGENT, chalk, error, execa, exit, getGlobalConfig, log, warn } = utils
37
36
 
38
37
  const SUGGESTION_TIMEOUT = 1e4
39
38
 
@@ -90,7 +89,7 @@ const mainCommand = async function (options, command) {
90
89
 
91
90
  // if no command show the header and the help
92
91
  if (command.args.length === 0) {
93
- const pkg = JSON.parse(await readFile(fileURLToPath(new URL('../../package.json', import.meta.url))), 'utf-8')
92
+ const pkg = await getPackageJson()
94
93
 
95
94
  const title = `${chalk.bgBlack.cyan('⬥ Netlify CLI')}`
96
95
  const docsMsg = `${chalk.greenBright('Read the docs:')} https://docs.netlify.com/cli/get-started/`
@@ -167,7 +166,6 @@ export const createMainCommand = () => {
167
166
  createEnvCommand(program)
168
167
  createFunctionsCommand(program)
169
168
  createRecipesCommand(program)
170
- createRecipesListCommand(program)
171
169
  createGraphCommand(program)
172
170
  createInitCommand(program)
173
171
  createLinkCommand(program)
@@ -0,0 +1,36 @@
1
+ import fs from 'fs/promises'
2
+ import { dirname, join, resolve } from 'path'
3
+ import { fileURLToPath, pathToFileURL } from 'url'
4
+
5
+ const directoryPath = dirname(fileURLToPath(import.meta.url))
6
+
7
+ export const getRecipe = async (name) => {
8
+ const recipePath = resolve(directoryPath, '../../recipes', name, 'index.mjs')
9
+
10
+ // windows needs a URL for absolute paths
11
+ // eslint-disable-next-line import/no-dynamic-require
12
+ const recipe = await import(pathToFileURL(recipePath).href)
13
+
14
+ return recipe
15
+ }
16
+
17
+ export const listRecipes = async () => {
18
+ const recipesPath = resolve(directoryPath, '../../recipes')
19
+ const recipeNames = await fs.readdir(recipesPath)
20
+ const recipes = await Promise.all(
21
+ recipeNames.map(async (name) => {
22
+ const recipePath = join(recipesPath, name, 'index.mjs')
23
+
24
+ // windows needs a URL for absolute paths
25
+ // eslint-disable-next-line import/no-dynamic-require
26
+ const recipe = await import(pathToFileURL(recipePath).href)
27
+
28
+ return {
29
+ ...recipe,
30
+ name,
31
+ }
32
+ }),
33
+ )
34
+
35
+ return recipes
36
+ }
@@ -0,0 +1 @@
1
+ export { createRecipesCommand, runRecipe } from './recipes.mjs'
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
- const AsciiTable = require('ascii-table')
2
+ import AsciiTable from 'ascii-table'
3
3
 
4
- const { listRecipes } = require('./common.cjs')
4
+ import { listRecipes } from './common.mjs'
5
5
 
6
6
  /**
7
7
  * The recipes:list command
@@ -24,11 +24,9 @@ const recipesListCommand = async () => {
24
24
  * @param {import('../base-command.mjs').default} program
25
25
  * @returns
26
26
  */
27
- const createRecipesListCommand = (program) =>
27
+ export const createRecipesListCommand = (program) =>
28
28
  program
29
29
  .command('recipes:list')
30
30
  .description(`(Beta) List the recipes available to create and modify files in a project`)
31
31
  .addExamples(['netlify recipes:list'])
32
32
  .action(recipesListCommand)
33
-
34
- module.exports = { createRecipesListCommand }
@@ -1,12 +1,13 @@
1
1
  // @ts-check
2
- const { basename } = require('path')
2
+ import { basename } from 'path'
3
3
 
4
- const inquirer = require('inquirer')
5
- const { findBestMatch } = require('string-similarity')
4
+ import inquirer from 'inquirer'
5
+ import { findBestMatch } from 'string-similarity'
6
6
 
7
- const utils = require('../../utils/command-helpers.cjs')
7
+ import utils from '../../utils/command-helpers.cjs'
8
8
 
9
- const { getRecipe, listRecipes } = require('./common.cjs')
9
+ import { getRecipe, listRecipes } from './common.mjs'
10
+ import { createRecipesListCommand } from './recipes-list.mjs'
10
11
 
11
12
  const SUGGESTION_TIMEOUT = 1e4
12
13
 
@@ -62,8 +63,8 @@ const recipesCommand = async (recipeName, options, command) => {
62
63
  }
63
64
  }
64
65
 
65
- const runRecipe = ({ config, recipeName, repositoryRoot }) => {
66
- const recipe = getRecipe(recipeName)
66
+ export const runRecipe = async ({ config, recipeName, repositoryRoot }) => {
67
+ const recipe = await getRecipe(recipeName)
67
68
 
68
69
  return recipe.run({ config, repositoryRoot })
69
70
  }
@@ -73,7 +74,9 @@ const runRecipe = ({ config, recipeName, repositoryRoot }) => {
73
74
  * @param {import('../base-command.mjs').default} program
74
75
  * @returns
75
76
  */
76
- const createRecipesCommand = (program) =>
77
+ export const createRecipesCommand = (program) => {
78
+ createRecipesListCommand(program)
79
+
77
80
  program
78
81
  .command('recipes')
79
82
  .argument('[name]', 'name of the recipe')
@@ -81,5 +84,4 @@ const createRecipesCommand = (program) =>
81
84
  .option('-n, --name <name>', 'recipe name to use')
82
85
  .addExamples(['netlify recipes my-recipe', 'netlify recipes --name my-recipe'])
83
86
  .action(recipesCommand)
84
-
85
- module.exports = { createRecipesCommand, runRecipe }
87
+ }
@@ -5,14 +5,16 @@ import pick from 'lodash/pick.js'
5
5
  import parseGitHubUrl from 'parse-github-url'
6
6
  import prettyjson from 'prettyjson'
7
7
 
8
+ import getRepoData from '../../utils/get-repo-data.mjs'
8
9
  import utils from '../../utils/index.cjs'
9
10
  import { getGitHubToken } from '../../utils/init/config-github.cjs'
10
11
  import { configureRepo } from '../../utils/init/config.cjs'
11
12
  import { createRepo, getTemplatesFromGitHub, validateTemplate } from '../../utils/sites/utils.cjs'
13
+ import { track } from '../../utils/telemetry/index.mjs'
12
14
 
13
15
  import { getSiteNameInput } from './sites-create.mjs'
14
16
 
15
- const { chalk, error, execa, getRepoData, getTerminalLink, log, logJson, track, warn } = utils
17
+ const { chalk, error, execa, getTerminalLink, log, logJson, warn } = utils
16
18
 
17
19
  export const fetchTemplates = async (token) => {
18
20
  const templatesFromGithubOrg = await getTemplatesFromGitHub(token)
@@ -4,11 +4,13 @@ import inquirer from 'inquirer'
4
4
  import pick from 'lodash/pick.js'
5
5
  import prettyjson from 'prettyjson'
6
6
 
7
+ import getRepoData from '../../utils/get-repo-data.mjs'
7
8
  import utils from '../../utils/index.cjs'
8
9
  import { configureRepo } from '../../utils/init/config.cjs'
9
- import { link } from '../link/index.cjs'
10
+ import { track } from '../../utils/telemetry/index.mjs'
11
+ import { link } from '../link/index.mjs'
10
12
 
11
- const { chalk, error, getRepoData, log, logJson, track, warn } = utils
13
+ const { chalk, error, log, logJson, warn } = utils
12
14
 
13
15
  export const getSiteNameInput = async (name) => {
14
16
  if (!name) {
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- import { listSites } from '../../lib/api.cjs'
2
+ import { listSites } from '../../lib/api.mjs'
3
3
  import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
4
4
  import utils from '../../utils/index.cjs'
5
5
 
@@ -1,7 +1,8 @@
1
1
  // @ts-check
2
2
  import utils from '../../utils/index.cjs'
3
+ import { track } from '../../utils/telemetry/index.mjs'
3
4
 
4
- const { exit, log, track } = utils
5
+ const { exit, log } = utils
5
6
 
6
7
  /**
7
8
  * The unlink command
@@ -2,4 +2,4 @@ module github.com/someone/{{name}}
2
2
 
3
3
  go 1.19
4
4
 
5
- require github.com/aws/aws-lambda-go v1.34.1
5
+ require github.com/aws/aws-lambda-go v1.35.0
@@ -105,9 +105,9 @@
105
105
  }
106
106
  },
107
107
  "node_modules/stripe": {
108
- "version": "10.16.0",
109
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.16.0.tgz",
110
- "integrity": "sha512-nae4WV8W8xJ8KpjRx3aUD9FavoCQ98F1kaF5v0ltNHoNbtwIPTgrfmq92J0PXKDvb4TOd0tcXXkR5LG3UxjxGw==",
108
+ "version": "10.17.0",
109
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.17.0.tgz",
110
+ "integrity": "sha512-JHV2KoL+nMQRXu3m9ervCZZvi4DDCJfzHUE6CmtJxR9TmizyYfrVuhGvnsZLLnheby9Qrnf4Hq6iOEcejGwnGQ==",
111
111
  "dependencies": {
112
112
  "@types/node": ">=8.1.0",
113
113
  "qs": "^6.11.0"
@@ -184,9 +184,9 @@
184
184
  }
185
185
  },
186
186
  "stripe": {
187
- "version": "10.16.0",
188
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.16.0.tgz",
189
- "integrity": "sha512-nae4WV8W8xJ8KpjRx3aUD9FavoCQ98F1kaF5v0ltNHoNbtwIPTgrfmq92J0PXKDvb4TOd0tcXXkR5LG3UxjxGw==",
187
+ "version": "10.17.0",
188
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.17.0.tgz",
189
+ "integrity": "sha512-JHV2KoL+nMQRXu3m9ervCZZvi4DDCJfzHUE6CmtJxR9TmizyYfrVuhGvnsZLLnheby9Qrnf4Hq6iOEcejGwnGQ==",
190
190
  "requires": {
191
191
  "@types/node": ">=8.1.0",
192
192
  "qs": "^6.11.0"
@@ -105,9 +105,9 @@
105
105
  }
106
106
  },
107
107
  "node_modules/stripe": {
108
- "version": "10.16.0",
109
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.16.0.tgz",
110
- "integrity": "sha512-nae4WV8W8xJ8KpjRx3aUD9FavoCQ98F1kaF5v0ltNHoNbtwIPTgrfmq92J0PXKDvb4TOd0tcXXkR5LG3UxjxGw==",
108
+ "version": "10.17.0",
109
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.17.0.tgz",
110
+ "integrity": "sha512-JHV2KoL+nMQRXu3m9ervCZZvi4DDCJfzHUE6CmtJxR9TmizyYfrVuhGvnsZLLnheby9Qrnf4Hq6iOEcejGwnGQ==",
111
111
  "dependencies": {
112
112
  "@types/node": ">=8.1.0",
113
113
  "qs": "^6.11.0"
@@ -184,9 +184,9 @@
184
184
  }
185
185
  },
186
186
  "stripe": {
187
- "version": "10.16.0",
188
- "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.16.0.tgz",
189
- "integrity": "sha512-nae4WV8W8xJ8KpjRx3aUD9FavoCQ98F1kaF5v0ltNHoNbtwIPTgrfmq92J0PXKDvb4TOd0tcXXkR5LG3UxjxGw==",
187
+ "version": "10.17.0",
188
+ "resolved": "https://registry.npmjs.org/stripe/-/stripe-10.17.0.tgz",
189
+ "integrity": "sha512-JHV2KoL+nMQRXu3m9ervCZZvi4DDCJfzHUE6CmtJxR9TmizyYfrVuhGvnsZLLnheby9Qrnf4Hq6iOEcejGwnGQ==",
190
190
  "requires": {
191
191
  "@types/node": ">=8.1.0",
192
192
  "qs": "^6.11.0"
@@ -19,9 +19,9 @@
19
19
  "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
20
20
  },
21
21
  "node_modules/axios": {
22
- "version": "1.1.3",
23
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
24
- "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
22
+ "version": "1.2.0",
23
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.0.tgz",
24
+ "integrity": "sha512-zT7wZyNYu3N5Bu0wuZ6QccIf93Qk1eV8LOewxgjOZFd2DenOs98cJ7+Y6703d0wkaXGY6/nZd4EweJaHz9uzQw==",
25
25
  "dependencies": {
26
26
  "follow-redirects": "^1.15.0",
27
27
  "form-data": "^4.0.0",
@@ -198,9 +198,9 @@
198
198
  "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
199
199
  },
200
200
  "axios": {
201
- "version": "1.1.3",
202
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.1.3.tgz",
203
- "integrity": "sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA==",
201
+ "version": "1.2.0",
202
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.0.tgz",
203
+ "integrity": "sha512-zT7wZyNYu3N5Bu0wuZ6QccIf93Qk1eV8LOewxgjOZFd2DenOs98cJ7+Y6703d0wkaXGY6/nZd4EweJaHz9uzQw==",
204
204
  "requires": {
205
205
  "follow-redirects": "^1.15.0",
206
206
  "form-data": "^4.0.0",
@@ -11,4 +11,4 @@ http = "0.2.8"
11
11
  lambda_runtime = "0.7.1"
12
12
  log = "0.4.17"
13
13
  simple_logger = "1.16.0"
14
- tokio = "1.21.2"
14
+ tokio = "1.22.0"
@@ -36,9 +36,9 @@
36
36
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
37
37
  },
38
38
  "node_modules/typescript": {
39
- "version": "4.8.4",
40
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
41
- "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
39
+ "version": "4.9.3",
40
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz",
41
+ "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==",
42
42
  "bin": {
43
43
  "tsc": "bin/tsc",
44
44
  "tsserver": "bin/tsserver"
@@ -68,9 +68,9 @@
68
68
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
69
69
  },
70
70
  "typescript": {
71
- "version": "4.8.4",
72
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
73
- "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ=="
71
+ "version": "4.9.3",
72
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz",
73
+ "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA=="
74
74
  }
75
75
  }
76
76
  }
@@ -2,11 +2,8 @@ const dotProp = require('dot-prop')
2
2
 
3
3
  const supportsBooleanCapability = (account, capability) => dotProp.get(account, `capabilities.${capability}.included`)
4
4
 
5
- const supportsEdgeHandlers = (account) => supportsBooleanCapability(account, 'edge_handlers')
6
-
7
5
  const supportsBackgroundFunctions = (account) => supportsBooleanCapability(account, 'background_functions')
8
6
 
9
7
  module.exports = {
10
8
  supportsBackgroundFunctions,
11
- supportsEdgeHandlers,
12
9
  }
@@ -1,6 +1,6 @@
1
- const { warn } = require('../utils/command-helpers.cjs')
1
+ import { warn } from '../utils/command-helpers.cjs'
2
2
 
3
- const cancelDeploy = async ({ api, deployId }) => {
3
+ export const cancelDeploy = async ({ api, deployId }) => {
4
4
  try {
5
5
  await api.cancelSiteDeploy({ deploy_id: deployId })
6
6
  } catch (error) {
@@ -11,7 +11,7 @@ const cancelDeploy = async ({ api, deployId }) => {
11
11
  const FIRST_PAGE = 1
12
12
  const MAX_PAGES = 10
13
13
  const MAX_PER_PAGE = 100
14
- const listSites = async ({ api, options }) => {
14
+ export const listSites = async ({ api, options }) => {
15
15
  const { page = FIRST_PAGE, maxPages = MAX_PAGES, ...rest } = options
16
16
  const sites = await api.listSites({ page, per_page: MAX_PER_PAGE, ...rest })
17
17
  // TODO: use pagination headers when js-client returns them
@@ -20,5 +20,3 @@ const listSites = async ({ api, options }) => {
20
20
  }
21
21
  return sites
22
22
  }
23
-
24
- module.exports = { cancelDeploy, listSites }
@@ -1,12 +1,12 @@
1
1
  // @ts-check
2
- const process = require('process')
2
+ import process from 'process'
3
3
 
4
- const netlifyBuildPromise = import('@netlify/build')
4
+ import build from '@netlify/build'
5
5
 
6
6
  /**
7
7
  * The buildConfig + a missing cachedConfig
8
8
  * @typedef BuildConfig
9
- * @type {Parameters<import('@netlify/build/src/core/main')>[0] & {cachedConfig: any}}
9
+ * @type {Parameters<import('@netlify/build/src/core/main.js')>[0] & {cachedConfig: any}}
10
10
  */
11
11
 
12
12
  // We have already resolved the configuration using `@netlify/config`
@@ -20,7 +20,11 @@ const netlifyBuildPromise = import('@netlify/build')
20
20
  * @param {import('commander').OptionValues} config.options
21
21
  * @returns {BuildConfig}
22
22
  */
23
- const getBuildOptions = ({ cachedConfig, options: { context, cwd, debug, dry, json, offline, silent }, token }) => ({
23
+ export const getBuildOptions = ({
24
+ cachedConfig,
25
+ options: { context, cwd, debug, dry, json, offline, silent },
26
+ token,
27
+ }) => ({
24
28
  cachedConfig,
25
29
  siteId: cachedConfig.siteInfo.id,
26
30
  token,
@@ -46,9 +50,7 @@ const getBuildOptions = ({ cachedConfig, options: { context, cwd, debug, dry, js
46
50
  * @param {BuildConfig} options
47
51
  * @returns
48
52
  */
49
- const runBuild = async (options) => {
50
- const { default: build } = await netlifyBuildPromise
51
-
53
+ export const runBuild = async (options) => {
52
54
  // If netlify NETLIFY_API_URL is set we need to pass this information to @netlify/build
53
55
  // TODO don't use testOpts, but add real properties to do this.
54
56
  if (process.env.NETLIFY_API_URL) {
@@ -63,5 +65,3 @@ const runBuild = async (options) => {
63
65
  const { configMutations, netlifyConfig: newConfig, severityCode: exitCode } = await build(options)
64
66
  return { exitCode, newConfig, configMutations }
65
67
  }
66
-
67
- module.exports = { getBuildOptions, runBuild }
@@ -0,0 +1,4 @@
1
+ // @ts-check
2
+ import { getPathInHome } from '../settings.cjs'
3
+
4
+ export const AUTOCOMPLETION_FILE = getPathInHome(['autocompletion.json'])
@@ -1,17 +1,17 @@
1
1
  // @ts-check
2
- const { existsSync, mkdirSync, writeFileSync } = require('fs')
3
- const { dirname } = require('path')
2
+ import { existsSync, mkdirSync, writeFileSync } from 'fs'
3
+ import { dirname } from 'path'
4
4
 
5
- const { sortOptions, warn } = require('../../utils/index.cjs')
5
+ import { sortOptions, warn } from '../../utils/command-helpers.cjs'
6
6
 
7
- const { AUTOCOMPLETION_FILE } = require('./constants.cjs')
7
+ import { AUTOCOMPLETION_FILE } from './constants.mjs'
8
8
 
9
9
  /**
10
10
  * Create or updates the autocompletion information for the CLI
11
11
  * @param {import('../../commands/base-command.mjs').default} program
12
12
  * @returns {void}
13
13
  */
14
- const createAutocompletion = (program) => {
14
+ const generateAutocompletion = (program) => {
15
15
  try {
16
16
  const autocomplete = program.commands.reduce(
17
17
  (prev, cmd) => ({
@@ -41,4 +41,4 @@ const createAutocompletion = (program) => {
41
41
  }
42
42
  }
43
43
 
44
- module.exports = { createAutocompletion }
44
+ export default generateAutocompletion
@@ -1,16 +1,5 @@
1
- #!/usr/bin/env node
2
1
  // @ts-check
3
2
 
4
- // This script is run by the completion (every log output will be displayed on tab)
5
- // src/commands/completion/completion.js -> dynamically references this file
6
- // if this file is renamed or moved then it needs to be adapted there
7
- const { existsSync, readFileSync } = require('fs')
8
- const process = require('process')
9
-
10
- const { log, parseEnv } = require('tabtab')
11
-
12
- const { AUTOCOMPLETION_FILE } = require('./constants.cjs')
13
-
14
3
  /**
15
4
  * @typedef CompletionItem
16
5
  * @type import('tabtab').CompletionItem
@@ -56,17 +45,4 @@ const getAutocompletion = function (env, program) {
56
45
  }
57
46
  }
58
47
 
59
- if (require.main === module) {
60
- const env = parseEnv(process.env)
61
-
62
- if (existsSync(AUTOCOMPLETION_FILE)) {
63
- const program = JSON.parse(readFileSync(AUTOCOMPLETION_FILE, 'utf-8'))
64
- const autocomplete = getAutocompletion(env, program)
65
-
66
- if (autocomplete && autocomplete.length !== 0) {
67
- log(autocomplete)
68
- }
69
- }
70
- }
71
-
72
- module.exports = { getAutocompletion }
48
+ export default getAutocompletion
@@ -0,0 +1 @@
1
+ export { default as generateAutocompletion } from './generate-autocompletion.mjs'
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ // @ts-check
3
+
4
+ // This script is run by the completion (every log output will be displayed on tab)
5
+ // src/commands/completion/completion.mjs -> dynamically references this file
6
+ // if this file is renamed or moved then it needs to be adapted there
7
+ import { existsSync, readFileSync } from 'fs'
8
+ import process from 'process'
9
+
10
+ import { log, parseEnv } from 'tabtab'
11
+
12
+ import { AUTOCOMPLETION_FILE } from './constants.mjs'
13
+ import getAutocompletion from './get-autocompletion.mjs'
14
+
15
+ /**
16
+ * @typedef CompletionItem
17
+ * @type import('tabtab').CompletionItem
18
+ */
19
+ /**
20
+ *
21
+ * @param {import('tabtab').TabtabEnv} env
22
+ * @param {Record<string, CompletionItem & {options: CompletionItem[]}>} program
23
+ * @returns {CompletionItem[]|void}
24
+ */
25
+
26
+ const env = parseEnv(process.env)
27
+
28
+ if (existsSync(AUTOCOMPLETION_FILE)) {
29
+ const program = JSON.parse(readFileSync(AUTOCOMPLETION_FILE, 'utf-8'))
30
+ const autocomplete = getAutocompletion(env, program)
31
+
32
+ if (autocomplete && autocomplete.length !== 0) {
33
+ log(autocomplete)
34
+ }
35
+ }
@@ -1,12 +1,12 @@
1
- const { env } = require('process')
1
+ import { env } from 'process'
2
2
 
3
- const inquirer = require('inquirer')
3
+ import inquirer from 'inquirer'
4
4
 
5
- const { runRecipe } = require('../../commands/recipes/index.cjs')
5
+ import { runRecipe } from '../../commands/recipes/index.mjs'
6
6
 
7
7
  const STATE_PROMPT_PROPERTY = 'promptVSCodeSettings'
8
8
 
9
- const promptEditorHelper = async ({ NETLIFYDEVLOG, chalk, config, log, repositoryRoot, state }) => {
9
+ export const promptEditorHelper = async ({ NETLIFYDEVLOG, chalk, config, log, repositoryRoot, state }) => {
10
10
  // This prevents tests from hanging when running them inside the VS Code
11
11
  // terminal, as otherwise we'll show the prompt and wait for a response.
12
12
  if (env.NODE_ENV === 'test') return
@@ -41,5 +41,3 @@ const promptEditorHelper = async ({ NETLIFYDEVLOG, chalk, config, log, repositor
41
41
 
42
42
  await runRecipe({ config, recipeName: 'vscode', repositoryRoot })
43
43
  }
44
-
45
- module.exports = { promptEditorHelper }
@@ -1,7 +1,6 @@
1
1
  // @ts-check
2
2
  const constants = require('./consts.cjs')
3
3
  const deploy = require('./deploy.cjs')
4
- const editorHelper = require('./editor-helper.cjs')
5
4
  const proxy = require('./proxy.cjs')
6
5
 
7
- module.exports = { ...constants, ...deploy, ...editorHelper, ...proxy }
6
+ module.exports = { ...constants, ...deploy, ...proxy }
@@ -5,8 +5,6 @@ const process = require('process')
5
5
  const { fetchLatest, fetchVersion, newerVersion, updateAvailable } = require('gh-release-fetch')
6
6
  const isExe = require('isexe')
7
7
 
8
- // cannot directly import from ../utils as it would create a circular dependency.
9
- // the file `src/utils/live-tunnel.js` depends on this file
10
8
  const { NETLIFYDEVWARN, error, getTerminalLink, log } = require('../utils/command-helpers.cjs')
11
9
  const execa = require('../utils/execa.cjs')
12
10