netlify-cli 12.2.3 → 12.2.5

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 (103) hide show
  1. package/npm-shrinkwrap.json +241 -1691
  2. package/package.json +5 -5
  3. package/src/commands/addons/{addons-auth.cjs → addons-auth.mjs} +6 -7
  4. package/src/commands/addons/{addons-config.cjs → addons-config.mjs} +15 -15
  5. package/src/commands/addons/{addons-create.cjs → addons-create.mjs} +14 -14
  6. package/src/commands/addons/{addons-delete.cjs → addons-delete.mjs} +8 -8
  7. package/src/commands/addons/{addons-list.cjs → addons-list.mjs} +7 -8
  8. package/src/commands/addons/{addons.cjs → addons.mjs} +8 -10
  9. package/src/commands/addons/index.mjs +1 -0
  10. package/src/commands/api/{api.cjs → api.mjs} +7 -10
  11. package/src/commands/api/index.mjs +1 -0
  12. package/src/commands/build/{build.cjs → build.mjs} +10 -17
  13. package/src/commands/build/index.mjs +1 -0
  14. package/src/commands/completion/{completion.cjs → completion.mjs} +10 -8
  15. package/src/commands/completion/index.mjs +1 -0
  16. package/src/commands/deploy/{deploy.cjs → deploy.mjs} +24 -27
  17. package/src/commands/deploy/index.mjs +1 -0
  18. package/src/commands/dev/dev-exec.cjs +2 -2
  19. package/src/commands/dev/dev.cjs +2 -2
  20. package/src/commands/env/env-clone.cjs +2 -2
  21. package/src/commands/env/env-get.cjs +2 -2
  22. package/src/commands/env/env-import.cjs +2 -2
  23. package/src/commands/env/env-list.cjs +2 -2
  24. package/src/commands/env/env-set.cjs +2 -2
  25. package/src/commands/env/env-unset.cjs +2 -2
  26. package/src/commands/env/env.cjs +2 -2
  27. package/src/commands/functions/{functions-build.cjs → functions-build.mjs} +6 -7
  28. package/src/commands/functions/{functions-create.cjs → functions-create.mjs} +41 -35
  29. package/src/commands/functions/{functions-invoke.cjs → functions-invoke.mjs} +15 -20
  30. package/src/commands/functions/{functions-list.cjs → functions-list.mjs} +6 -16
  31. package/src/commands/functions/{functions-serve.cjs → functions-serve.mjs} +7 -9
  32. package/src/commands/functions/{functions.cjs → functions.mjs} +9 -11
  33. package/src/commands/functions/index.mjs +1 -0
  34. package/src/commands/graph/graph-config-write.cjs +2 -2
  35. package/src/commands/graph/graph-edit.cjs +2 -2
  36. package/src/commands/graph/graph-handler.cjs +2 -2
  37. package/src/commands/graph/graph-init.cjs +2 -2
  38. package/src/commands/graph/graph-library.cjs +2 -2
  39. package/src/commands/graph/graph-operations.cjs +2 -2
  40. package/src/commands/graph/graph-pull.cjs +2 -2
  41. package/src/commands/graph/graph.cjs +2 -2
  42. package/src/commands/init/index.mjs +1 -0
  43. package/src/commands/init/{init.cjs → init.mjs} +16 -16
  44. package/src/commands/link/link.cjs +2 -2
  45. package/src/commands/lm/lm-info.cjs +1 -1
  46. package/src/commands/lm/lm-install.cjs +1 -1
  47. package/src/commands/lm/lm-setup.cjs +2 -2
  48. package/src/commands/lm/lm-uninstall.cjs +1 -1
  49. package/src/commands/lm/lm.cjs +2 -2
  50. package/src/commands/login/index.mjs +1 -0
  51. package/src/commands/login/{login.cjs → login.mjs} +7 -7
  52. package/src/commands/logout/index.mjs +1 -0
  53. package/src/commands/logout/{logout.cjs → logout.mjs} +6 -6
  54. package/src/commands/main.mjs +17 -17
  55. package/src/commands/open/index.mjs +1 -0
  56. package/src/commands/open/{open-admin.cjs → open-admin.mjs} +7 -7
  57. package/src/commands/open/{open-site.cjs → open-site.mjs} +7 -7
  58. package/src/commands/open/{open.cjs → open.mjs} +8 -7
  59. package/src/commands/recipes/recipes-list.cjs +1 -1
  60. package/src/commands/recipes/recipes.cjs +2 -2
  61. package/src/commands/sites/index.mjs +2 -0
  62. package/src/commands/sites/{sites-create-template.cjs → sites-create-template.mjs} +18 -28
  63. package/src/commands/sites/{sites-create.cjs → sites-create.mjs} +14 -14
  64. package/src/commands/sites/{sites-delete.cjs → sites-delete.mjs} +7 -7
  65. package/src/commands/sites/{sites-list.cjs → sites-list.mjs} +7 -8
  66. package/src/commands/sites/{sites.cjs → sites.mjs} +7 -9
  67. package/src/commands/status/index.mjs +1 -0
  68. package/src/commands/status/{status-hooks.cjs → status-hooks.mjs} +8 -8
  69. package/src/commands/status/{status.cjs → status.mjs} +9 -8
  70. package/src/commands/switch/index.mjs +1 -0
  71. package/src/commands/switch/{switch.cjs → switch.mjs} +8 -8
  72. package/src/commands/unlink/index.mjs +1 -0
  73. package/src/commands/unlink/{unlink.cjs → unlink.mjs} +5 -6
  74. package/src/commands/watch/index.mjs +1 -0
  75. package/src/commands/watch/{watch.cjs → watch.mjs} +10 -10
  76. package/src/functions-templates/rust/hello-world/Cargo.toml +1 -1
  77. package/src/lib/completion/generate-autocompletion.cjs +1 -1
  78. package/src/lib/one-graph/cli-netlify-graph.cjs +1 -1
  79. package/src/utils/addons/{compare.cjs → compare.mjs} +2 -2
  80. package/src/utils/addons/diffs/{index.cjs → index.mjs} +3 -3
  81. package/src/utils/addons/diffs/{options.cjs → options.mjs} +4 -9
  82. package/src/utils/addons/{prepare.cjs → prepare.mjs} +8 -10
  83. package/src/utils/addons/{prompts.cjs → prompts.mjs} +2 -2
  84. package/src/utils/addons/{render.cjs → render.mjs} +4 -9
  85. package/src/utils/addons/{validation.cjs → validation.mjs} +3 -9
  86. package/src/utils/init/config-github.cjs +1 -1
  87. package/src/utils/init/config-manual.cjs +1 -1
  88. package/src/utils/init/config.cjs +1 -1
  89. package/src/commands/addons/index.cjs +0 -5
  90. package/src/commands/api/index.cjs +0 -5
  91. package/src/commands/build/index.cjs +0 -5
  92. package/src/commands/completion/index.cjs +0 -5
  93. package/src/commands/deploy/index.cjs +0 -5
  94. package/src/commands/functions/index.cjs +0 -5
  95. package/src/commands/init/index.cjs +0 -6
  96. package/src/commands/login/index.cjs +0 -6
  97. package/src/commands/logout/index.cjs +0 -5
  98. package/src/commands/open/index.cjs +0 -5
  99. package/src/commands/sites/index.cjs +0 -7
  100. package/src/commands/status/index.cjs +0 -5
  101. package/src/commands/switch/index.cjs +0 -5
  102. package/src/commands/unlink/index.cjs +0 -5
  103. package/src/commands/watch/index.cjs +0 -5
@@ -1,13 +1,15 @@
1
1
  // @ts-check
2
- const inquirer = require('inquirer')
2
+ import inquirer from 'inquirer'
3
3
 
4
- const { chalk, error, exit, log } = require('../../utils/index.cjs')
4
+ import utils from '../../utils/index.cjs'
5
+
6
+ const { chalk, error, exit, log } = utils
5
7
 
6
8
  /**
7
9
  * The sites:delete command
8
10
  * @param {string} siteId
9
11
  * @param {import('commander').OptionValues} options
10
- * @param {import('../base-command').BaseCommand} command
12
+ * @param {import('../base-command.mjs').default} command
11
13
  */
12
14
  const sitesDelete = async (siteId, options, command) => {
13
15
  command.setAnalyticsPayload({ force: options.force })
@@ -89,10 +91,10 @@ const sitesDelete = async (siteId, options, command) => {
89
91
 
90
92
  /**
91
93
  * Creates the `netlify sites:delete` command
92
- * @param {import('../base-command').BaseCommand} program
94
+ * @param {import('../base-command.mjs').default} program
93
95
  * @returns
94
96
  */
95
- const createSitesDeleteCommand = (program) =>
97
+ export const createSitesDeleteCommand = (program) =>
96
98
  program
97
99
  .command('sites:delete')
98
100
  .description('Delete a site\nThis command will permanently delete the site on Netlify. Use with caution.')
@@ -100,5 +102,3 @@ const createSitesDeleteCommand = (program) =>
100
102
  .option('-f, --force', 'delete without prompting (useful for CI)')
101
103
  .addExamples(['netlify sites:delete 1234-3262-1211'])
102
104
  .action(sitesDelete)
103
-
104
- module.exports = { createSitesDeleteCommand }
@@ -1,13 +1,14 @@
1
1
  // @ts-check
2
+ import { listSites } from '../../lib/api.cjs'
3
+ import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
4
+ import utils from '../../utils/index.cjs'
2
5
 
3
- const { listSites } = require('../../lib/api.cjs')
4
- const { startSpinner, stopSpinner } = require('../../lib/spinner.cjs')
5
- const { chalk, log, logJson } = require('../../utils/index.cjs')
6
+ const { chalk, log, logJson } = utils
6
7
 
7
8
  /**
8
9
  * The sites:list command
9
10
  * @param {import('commander').OptionValues} options
10
- * @param {import('../base-command').BaseCommand} command
11
+ * @param {import('../base-command.mjs').default} command
11
12
  * @returns {Promise<{ id: any; name: any; ssl_url: any; account_name: any; }|boolean>}
12
13
  */
13
14
  const sitesList = async (options, command) => {
@@ -76,9 +77,9 @@ Count: ${logSites.length}
76
77
 
77
78
  /**
78
79
  * Creates the `netlify sites:list` command
79
- * @param {import('../base-command').BaseCommand} program
80
+ * @param {import('../base-command.mjs').default} program
80
81
  */
81
- const createSitesListCommand = (program) =>
82
+ export const createSitesListCommand = (program) =>
82
83
  program
83
84
  .command('sites:list')
84
85
  .description('List all sites you have access to')
@@ -86,5 +87,3 @@ const createSitesListCommand = (program) =>
86
87
  .action(async (options, command) => {
87
88
  await sitesList(options, command)
88
89
  })
89
-
90
- module.exports = { createSitesListCommand }
@@ -1,13 +1,13 @@
1
1
  // @ts-check
2
- const { createSitesFromTemplateCommand } = require('./sites-create-template.cjs')
3
- const { createSitesCreateCommand } = require('./sites-create.cjs')
4
- const { createSitesDeleteCommand } = require('./sites-delete.cjs')
5
- const { createSitesListCommand } = require('./sites-list.cjs')
2
+ import { createSitesFromTemplateCommand } from './sites-create-template.mjs'
3
+ import { createSitesCreateCommand } from './sites-create.mjs'
4
+ import { createSitesDeleteCommand } from './sites-delete.mjs'
5
+ import { createSitesListCommand } from './sites-list.mjs'
6
6
 
7
7
  /**
8
8
  * The sites command
9
9
  * @param {import('commander').OptionValues} options
10
- * @param {import('../base-command').BaseCommand} command
10
+ * @param {import('../base-command.mjs').default} command
11
11
  */
12
12
  const sites = (options, command) => {
13
13
  command.help()
@@ -15,10 +15,10 @@ const sites = (options, command) => {
15
15
 
16
16
  /**
17
17
  * Creates the `netlify sites` command
18
- * @param {import('../base-command').BaseCommand} program
18
+ * @param {import('../base-command.mjs').default} program
19
19
  * @returns
20
20
  */
21
- const createSitesCommand = (program) => {
21
+ export const createSitesCommand = (program) => {
22
22
  createSitesCreateCommand(program)
23
23
  createSitesFromTemplateCommand(program)
24
24
  createSitesListCommand(program)
@@ -30,5 +30,3 @@ const createSitesCommand = (program) => {
30
30
  .addExamples(['netlify sites:create --name my-new-site', 'netlify sites:list'])
31
31
  .action(sites)
32
32
  }
33
-
34
- module.exports = { createSitesCommand }
@@ -0,0 +1 @@
1
+ export { createStatusCommand } from './status.mjs'
@@ -1,13 +1,15 @@
1
1
  // @ts-check
2
- const { get } = require('dot-prop')
3
- const prettyjson = require('prettyjson')
2
+ import { get } from 'dot-prop'
3
+ import prettyjson from 'prettyjson'
4
4
 
5
- const { error, log, warn } = require('../../utils/index.cjs')
5
+ import utils from '../../utils/index.cjs'
6
+
7
+ const { error, log, warn } = utils
6
8
 
7
9
  /**
8
10
  * The status:hooks command
9
11
  * @param {import('commander').OptionValues} options
10
- * @param {import('../base-command').BaseCommand} command
12
+ * @param {import('../base-command.mjs').default} command
11
13
  */
12
14
  const statusHooks = async (options, command) => {
13
15
  const { api, site } = command.netlify
@@ -60,10 +62,8 @@ Site Hook Status │
60
62
 
61
63
  /**
62
64
  * Creates the `netlify status:hooks` command
63
- * @param {import('../base-command').BaseCommand} program
65
+ * @param {import('../base-command.mjs').default} program
64
66
  * @returns
65
67
  */
66
- const createStatusHooksCommand = (program) =>
68
+ export const createStatusHooksCommand = (program) =>
67
69
  program.command('status:hooks').description('Print hook information of the linked site').action(statusHooks)
68
-
69
- module.exports = { createStatusHooksCommand }
@@ -1,15 +1,17 @@
1
1
  // @ts-check
2
- const clean = require('clean-deep')
3
- const prettyjson = require('prettyjson')
2
+ import clean from 'clean-deep'
3
+ import prettyjson from 'prettyjson'
4
4
 
5
- const { chalk, error, exit, getToken, log, logJson, warn } = require('../../utils/index.cjs')
5
+ import utils from '../../utils/index.cjs'
6
6
 
7
- const { createStatusHooksCommand } = require('./status-hooks.cjs')
7
+ import { createStatusHooksCommand } from './status-hooks.mjs'
8
+
9
+ const { chalk, error, exit, getToken, log, logJson, warn } = utils
8
10
 
9
11
  /**
10
12
  * The status command
11
13
  * @param {import('commander').OptionValues} options
12
- * @param {import('../base-command').BaseCommand} command
14
+ * @param {import('../base-command.mjs').default} command
13
15
  */
14
16
  const status = async (options, command) => {
15
17
  const { api, globalConfig, site } = command.netlify
@@ -109,10 +111,10 @@ const status = async (options, command) => {
109
111
 
110
112
  /**
111
113
  * Creates the `netlify status` command
112
- * @param {import('../base-command').BaseCommand} program
114
+ * @param {import('../base-command.mjs').default} program
113
115
  * @returns
114
116
  */
115
- const createStatusCommand = (program) => {
117
+ export const createStatusCommand = (program) => {
116
118
  createStatusHooksCommand(program)
117
119
 
118
120
  return program
@@ -121,4 +123,3 @@ const createStatusCommand = (program) => {
121
123
  .option('--verbose', 'Output system info')
122
124
  .action(status)
123
125
  }
124
- module.exports = { createStatusCommand }
@@ -0,0 +1 @@
1
+ export { createSwitchCommand } from './switch.mjs'
@@ -1,15 +1,17 @@
1
1
  // @ts-check
2
- const inquirer = require('inquirer')
2
+ import inquirer from 'inquirer'
3
3
 
4
- const { chalk, log } = require('../../utils/index.cjs')
5
- const { login } = require('../login/index.cjs')
4
+ import utils from '../../utils/index.cjs'
5
+ import { login } from '../login/index.mjs'
6
+
7
+ const { chalk, log } = utils
6
8
 
7
9
  const LOGIN_NEW = 'I would like to login to a new account'
8
10
 
9
11
  /**
10
12
  * The switch command
11
13
  * @param {import('commander').OptionValues} options
12
- * @param {import('../base-command').BaseCommand} command
14
+ * @param {import('../base-command.mjs').default} command
13
15
  */
14
16
  const switchCommand = async (options, command) => {
15
17
  const availableUsersChoices = Object.values(command.netlify.globalConfig.get('users') || {}).reduce(
@@ -41,10 +43,8 @@ const switchCommand = async (options, command) => {
41
43
 
42
44
  /**
43
45
  * Creates the `netlify switch` command
44
- * @param {import('../base-command').BaseCommand} program
46
+ * @param {import('../base-command.mjs').default} program
45
47
  * @returns
46
48
  */
47
- const createSwitchCommand = (program) =>
49
+ export const createSwitchCommand = (program) =>
48
50
  program.command('switch').description('Switch your active Netlify account').action(switchCommand)
49
-
50
- module.exports = { createSwitchCommand }
@@ -0,0 +1 @@
1
+ export { createUnlinkCommand } from './unlink.mjs'
@@ -1,11 +1,12 @@
1
1
  // @ts-check
2
+ import utils from '../../utils/index.cjs'
2
3
 
3
- const { exit, log, track } = require('../../utils/index.cjs')
4
+ const { exit, log, track } = utils
4
5
 
5
6
  /**
6
7
  * The unlink command
7
8
  * @param {import('commander').OptionValues} options
8
- * @param {import('../base-command').BaseCommand} command
9
+ * @param {import('../base-command.mjs').default} command
9
10
  */
10
11
  const unlink = async (options, command) => {
11
12
  const { site, state } = command.netlify
@@ -39,10 +40,8 @@ const unlink = async (options, command) => {
39
40
 
40
41
  /**
41
42
  * Creates the `netlify unlink` command
42
- * @param {import('../base-command').BaseCommand} program
43
+ * @param {import('../base-command.mjs').default} program
43
44
  * @returns
44
45
  */
45
- const createUnlinkCommand = (program) =>
46
+ export const createUnlinkCommand = (program) =>
46
47
  program.command('unlink').description('Unlink a local folder from a Netlify site').action(unlink)
47
-
48
- module.exports = { createUnlinkCommand }
@@ -0,0 +1 @@
1
+ export { createWatchCommand } from './watch.mjs'
@@ -1,10 +1,12 @@
1
1
  // @ts-check
2
- const pWaitFor = require('p-wait-for')
3
- const prettyjson = require('prettyjson')
2
+ import pWaitFor from 'p-wait-for'
3
+ import prettyjson from 'prettyjson'
4
4
 
5
- const { startSpinner, stopSpinner } = require('../../lib/spinner.cjs')
6
- const { chalk, error, log } = require('../../utils/index.cjs')
7
- const { init } = require('../init/index.cjs')
5
+ import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
6
+ import utils from '../../utils/index.cjs'
7
+ import { init } from '../init/index.mjs'
8
+
9
+ const { chalk, error, log } = utils
8
10
 
9
11
  // 1 second
10
12
  const INIT_WAIT = 1e3
@@ -53,7 +55,7 @@ const waitForBuildFinish = async function (api, siteId, spinner) {
53
55
  /**
54
56
  * The watch command
55
57
  * @param {import('commander').OptionValues} options
56
- * @param {import('../base-command').BaseCommand} command
58
+ * @param {import('../base-command.mjs').default} command
57
59
  */
58
60
  const watch = async (options, command) => {
59
61
  await command.authenticate()
@@ -118,14 +120,12 @@ const watch = async (options, command) => {
118
120
 
119
121
  /**
120
122
  * Creates the `netlify watch` command
121
- * @param {import('../base-command').BaseCommand} program
123
+ * @param {import('../base-command.mjs').default} program
122
124
  * @returns
123
125
  */
124
- const createWatchCommand = (program) =>
126
+ export const createWatchCommand = (program) =>
125
127
  program
126
128
  .command('watch')
127
129
  .description('Watch for site deploy to finish')
128
130
  .addExamples([`netlify watch`, `git push && netlify watch`])
129
131
  .action(watch)
130
-
131
- module.exports = { createWatchCommand }
@@ -8,7 +8,7 @@ version = "0.1.0"
8
8
  [dependencies]
9
9
  aws_lambda_events = "0.7.2"
10
10
  http = "0.2.8"
11
- lambda_runtime = "0.7.0"
11
+ lambda_runtime = "0.7.1"
12
12
  log = "0.4.17"
13
13
  simple_logger = "1.16.0"
14
14
  tokio = "1.21.2"
@@ -8,7 +8,7 @@ const { AUTOCOMPLETION_FILE } = require('./constants.cjs')
8
8
 
9
9
  /**
10
10
  * Create or updates the autocompletion information for the CLI
11
- * @param {import('../../commands/base-command').BaseCommand} program
11
+ * @param {import('../../commands/base-command.mjs').default} program
12
12
  * @returns {void}
13
13
  */
14
14
  const createAutocompletion = (program) => {
@@ -204,7 +204,7 @@ const defaultFrameworkLookup = {
204
204
  /**
205
205
  * Return a full NetlifyGraph config with any defaults overridden by netlify.toml
206
206
  * @param {object} input
207
- * @param {import('../../commands/base-command').BaseCommand} input.command
207
+ * @param {import('../../commands/base-command.mjs').default} input.command
208
208
  * @param {import('commander').CommandOptions} input.options
209
209
  * @param {Partial<import('../../utils/types').ServerSettings>=} input.settings
210
210
  * @return {Promise<NetlifyGraph.NetlifyGraphConfig>} NetlifyGraphConfig
@@ -1,6 +1,6 @@
1
- const isEqual = require('lodash/isEqual')
1
+ import isEqual from 'lodash/isEqual.js'
2
2
 
3
- module.exports = function compare(oldValues, newValues) {
3
+ export default function compare(oldValues, newValues) {
4
4
  const initialData = {
5
5
  // default everything is equal
6
6
  isEqual: true,
@@ -1,14 +1,14 @@
1
1
  // @ts-check
2
- const concordance = require('concordance')
2
+ import concordance from 'concordance'
3
3
 
4
- const { concordanceDiffOptions, concordanceOptions } = require('./options.cjs')
4
+ import { concordanceDiffOptions, concordanceOptions } from './options.mjs'
5
5
 
6
6
  const formatDescriptorDiff = function (actualDescriptor, expectedDescriptor, options) {
7
7
  const diffOptions = { ...options, ...concordanceDiffOptions }
8
8
  return concordance.diffDescriptors(actualDescriptor, expectedDescriptor, diffOptions)
9
9
  }
10
10
 
11
- module.exports = function diffValues(actual, expected) {
11
+ export default function diffValues(actual, expected) {
12
12
  const result = concordance.compare(actual, expected, concordanceOptions)
13
13
  if (result.pass) {
14
14
  return null
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
- const ansiStyles = require('ansi-styles')
2
+ import ansiStyles from 'ansi-styles'
3
3
 
4
- const { chalk } = require('../../command-helpers.cjs')
4
+ import { chalk } from '../../command-helpers.cjs'
5
5
 
6
6
  const forceColor = new chalk.Instance({ level: 1 })
7
7
 
@@ -104,10 +104,5 @@ const colorTheme = {
104
104
  const plugins = []
105
105
  const theme = colorTheme
106
106
 
107
- const concordanceOptions = { maxDepth: 3, plugins, theme }
108
- const concordanceDiffOptions = { maxDepth: 1, plugins, theme }
109
-
110
- module.exports = {
111
- concordanceOptions,
112
- concordanceDiffOptions,
113
- }
107
+ export const concordanceOptions = { maxDepth: 3, plugins, theme }
108
+ export const concordanceDiffOptions = { maxDepth: 1, plugins, theme }
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
- const { chalk, error, exit, log, warn } = require('../command-helpers.cjs')
2
+ import { chalk, error, exit, log, warn } from '../command-helpers.cjs'
3
3
 
4
- const ADDON_VALIDATION = {
4
+ export const ADDON_VALIDATION = {
5
5
  EXISTS: 'EXISTS',
6
6
  NOT_EXISTS: 'NOT_EXISTS',
7
7
  }
@@ -27,7 +27,7 @@ const validateNotExists = ({ addon, addonName, siteData }) => {
27
27
  }
28
28
  }
29
29
 
30
- const getCurrentAddon = ({ addonName, addons }) => addons.find((addon) => addon.service_slug === addonName)
30
+ export const getCurrentAddon = ({ addonName, addons }) => addons.find((addon) => addon.service_slug === addonName)
31
31
 
32
32
  const validateCurrentAddon = ({ addon, addonName, siteData, validation }) => {
33
33
  switch (validation) {
@@ -46,7 +46,7 @@ const validateCurrentAddon = ({ addon, addonName, siteData, validation }) => {
46
46
  }
47
47
  }
48
48
 
49
- const getAddonManifest = async ({ addonName, api }) => {
49
+ export const getAddonManifest = async ({ addonName, api }) => {
50
50
  let manifest
51
51
  try {
52
52
  manifest = await api.showServiceManifest({ addonName })
@@ -60,7 +60,7 @@ const getAddonManifest = async ({ addonName, api }) => {
60
60
  return manifest
61
61
  }
62
62
 
63
- const getSiteData = async ({ api, siteId }) => {
63
+ export const getSiteData = async ({ api, siteId }) => {
64
64
  let siteData
65
65
  try {
66
66
  siteData = await api.getSite({ siteId })
@@ -70,7 +70,7 @@ const getSiteData = async ({ api, siteId }) => {
70
70
  return siteData
71
71
  }
72
72
 
73
- const getAddons = async ({ api, siteId }) => {
73
+ export const getAddons = async ({ api, siteId }) => {
74
74
  let addons
75
75
  try {
76
76
  addons = await api.listServiceInstancesForSite({ siteId })
@@ -83,11 +83,11 @@ const getAddons = async ({ api, siteId }) => {
83
83
  /**
84
84
  *
85
85
  * @param {object} config
86
- * @param {import('../../commands/base-command').BaseCommand} config.command
86
+ * @param {import('../../commands/base-command.mjs').default} config.command
87
87
  * @param {string} [config.addonName]
88
88
  * @param {keyof ADDON_VALIDATION} [config.validation]
89
89
  */
90
- const prepareAddonCommand = async ({ addonName, command, validation }) => {
90
+ export const prepareAddonCommand = async ({ addonName, command, validation }) => {
91
91
  const { netlify } = command
92
92
  const { api, site } = netlify
93
93
  const siteId = site.id
@@ -112,5 +112,3 @@ const prepareAddonCommand = async ({ addonName, command, validation }) => {
112
112
 
113
113
  return { manifest, addons, addon, siteData }
114
114
  }
115
-
116
- module.exports = { ADDON_VALIDATION, prepareAddonCommand, getAddonManifest, getSiteData, getAddons, getCurrentAddon }
@@ -1,8 +1,8 @@
1
1
  // @ts-check
2
- const { chalk } = require('../command-helpers.cjs')
2
+ import { chalk } from '../command-helpers.cjs'
3
3
 
4
4
  /* programmatically generate CLI prompts */
5
- module.exports = function generatePrompts(settings) {
5
+ export default function generatePrompts(settings) {
6
6
  const { config, configValues } = settings
7
7
  const configItems = Object.keys(config)
8
8
 
@@ -1,9 +1,9 @@
1
1
  // @ts-check
2
- const AsciiTable = require('ascii-table')
2
+ import AsciiTable from 'ascii-table'
3
3
 
4
- const { chalk } = require('../command-helpers.cjs')
4
+ import { chalk } from '../command-helpers.cjs'
5
5
 
6
- const missingValues = function (values, manifest) {
6
+ export const renderMissingValues = function (values, manifest) {
7
7
  const display = values
8
8
  .map((item) => {
9
9
  const itemDisplay = chalk.redBright.bold(`${item}`)
@@ -14,7 +14,7 @@ const missingValues = function (values, manifest) {
14
14
  console.log(display)
15
15
  }
16
16
 
17
- const configValues = function (addonName, values, currentValue) {
17
+ export const renderConfigValues = function (addonName, values, currentValue) {
18
18
  const table = new AsciiTable(`${addonName} add-on settings`)
19
19
 
20
20
  const tableHeader = currentValue
@@ -37,8 +37,3 @@ const configValues = function (addonName, values, currentValue) {
37
37
  })
38
38
  console.log(table.toString())
39
39
  }
40
-
41
- module.exports = {
42
- missingValues,
43
- configValues,
44
- }
@@ -1,12 +1,12 @@
1
- const requiredConfigValues = function (config) {
1
+ export const requiredConfigValues = function (config) {
2
2
  return Object.keys(config).filter((key) => config[key].required)
3
3
  }
4
4
 
5
- const missingConfigValues = function (requiredConfig, providedConfig) {
5
+ export const missingConfigValues = function (requiredConfig, providedConfig) {
6
6
  return requiredConfig.filter((key) => !providedConfig[key])
7
7
  }
8
8
 
9
- const updateConfigValues = function (allowedConfig, currentConfig, newConfig) {
9
+ export const updateConfigValues = function (allowedConfig, currentConfig, newConfig) {
10
10
  return Object.keys(allowedConfig).reduce((acc, key) => {
11
11
  if (newConfig[key]) {
12
12
  acc[key] = newConfig[key]
@@ -16,9 +16,3 @@ const updateConfigValues = function (allowedConfig, currentConfig, newConfig) {
16
16
  return acc
17
17
  }, {})
18
18
  }
19
-
20
- module.exports = {
21
- requiredConfigValues,
22
- missingConfigValues,
23
- updateConfigValues,
24
- }
@@ -198,7 +198,7 @@ const addNotificationHooks = async ({ api, siteId, token }) => {
198
198
 
199
199
  /**
200
200
  * @param {object} config
201
- * @param {import('../../commands/base-command').BaseCommand} config.command
201
+ * @param {import('../../commands/base-command.mjs').default} config.command
202
202
  * @param {string} config.repoName
203
203
  * @param {string} config.repoOwner
204
204
  * @param {string} config.siteId
@@ -54,7 +54,7 @@ const addDeployHook = async ({ deployHook }) => {
54
54
 
55
55
  /**
56
56
  * @param {object} config
57
- * @param {import('../../commands/base-command').BaseCommand} config.command
57
+ * @param {import('../../commands/base-command.mjs').default} config.command
58
58
  * @param {*} config.repoData
59
59
  * @param {string} config.siteId
60
60
  */
@@ -19,7 +19,7 @@ const logSuccess = (repoData) => {
19
19
 
20
20
  /**
21
21
  * @param {object} config
22
- * @param {import('../../commands/base-command').BaseCommand} config.command
22
+ * @param {import('../../commands/base-command.mjs').default} config.command
23
23
  * @param {boolean} config.manual
24
24
  * @param {*} config.repoData
25
25
  * @param {string} config.siteId
@@ -1,5 +0,0 @@
1
- const { createAddonsCommand } = require('./addons.cjs')
2
-
3
- module.exports = {
4
- createAddonsCommand,
5
- }
@@ -1,5 +0,0 @@
1
- const { createApiCommand } = require('./api.cjs')
2
-
3
- module.exports = {
4
- createApiCommand,
5
- }
@@ -1,5 +0,0 @@
1
- const { createBuildCommand } = require('./build.cjs')
2
-
3
- module.exports = {
4
- createBuildCommand,
5
- }
@@ -1,5 +0,0 @@
1
- const { createCompletionCommand } = require('./completion.cjs')
2
-
3
- module.exports = {
4
- createCompletionCommand,
5
- }
@@ -1,5 +0,0 @@
1
- const { createDeployCommand } = require('./deploy.cjs')
2
-
3
- module.exports = {
4
- createDeployCommand,
5
- }
@@ -1,5 +0,0 @@
1
- const { createFunctionsCommand } = require('./functions.cjs')
2
-
3
- module.exports = {
4
- createFunctionsCommand,
5
- }
@@ -1,6 +0,0 @@
1
- const { createInitCommand, init } = require('./init.cjs')
2
-
3
- module.exports = {
4
- createInitCommand,
5
- init,
6
- }
@@ -1,6 +0,0 @@
1
- const { createLoginCommand, login } = require('./login.cjs')
2
-
3
- module.exports = {
4
- createLoginCommand,
5
- login,
6
- }
@@ -1,5 +0,0 @@
1
- const { createLogoutCommand } = require('./logout.cjs')
2
-
3
- module.exports = {
4
- createLogoutCommand,
5
- }
@@ -1,5 +0,0 @@
1
- const { createOpenCommand } = require('./open.cjs')
2
-
3
- module.exports = {
4
- createOpenCommand,
5
- }
@@ -1,7 +0,0 @@
1
- const { sitesCreate } = require('./sites-create.cjs')
2
- const { createSitesCommand } = require('./sites.cjs')
3
-
4
- module.exports = {
5
- createSitesCommand,
6
- sitesCreate,
7
- }
@@ -1,5 +0,0 @@
1
- const { createStatusCommand } = require('./status.cjs')
2
-
3
- module.exports = {
4
- createStatusCommand,
5
- }