netlify-cli 12.2.7 → 12.2.9

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 (116) hide show
  1. package/bin/run.mjs +2 -3
  2. package/npm-shrinkwrap.json +1543 -179
  3. package/package.json +10 -5
  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} +33 -33
  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/graphql-gateway/example-sibling-function-graphql-1.js +0 -2
  55. package/src/functions-templates/javascript/graphql-gateway/example-sibling-function-graphql-2.js +0 -2
  56. package/src/functions-templates/javascript/stripe-charge/package-lock.json +6 -6
  57. package/src/functions-templates/javascript/stripe-subscription/package-lock.json +6 -6
  58. package/src/functions-templates/javascript/token-hider/package-lock.json +6 -6
  59. package/src/functions-templates/rust/hello-world/Cargo.toml +1 -1
  60. package/src/functions-templates/typescript/hello-world/package-lock.json +12 -12
  61. package/src/lib/account.cjs +0 -3
  62. package/src/lib/{api.cjs → api.mjs} +3 -5
  63. package/src/lib/{build.cjs → build.mjs} +9 -9
  64. package/src/lib/completion/constants.mjs +4 -0
  65. package/src/lib/completion/{generate-autocompletion.cjs → generate-autocompletion.mjs} +6 -6
  66. package/src/lib/completion/{script.cjs → get-autocompletion.mjs} +1 -25
  67. package/src/lib/completion/index.mjs +1 -0
  68. package/src/lib/completion/script.mjs +35 -0
  69. package/src/lib/edge-functions/consts.cjs +0 -10
  70. package/src/lib/edge-functions/{editor-helper.cjs → editor-helper.mjs} +4 -6
  71. package/src/lib/edge-functions/index.cjs +1 -2
  72. package/src/lib/exec-fetcher.cjs +0 -2
  73. package/src/lib/functions/{form-submissions-handler.cjs → form-submissions-handler.mjs} +26 -28
  74. package/src/lib/functions/{scheduled.cjs → scheduled.mjs} +6 -8
  75. package/src/lib/functions/{server.cjs → server.mjs} +36 -34
  76. package/src/lib/geo-location.cjs +1 -1
  77. package/src/lib/{http-agent.cjs → http-agent.mjs} +7 -8
  78. package/src/lib/one-graph/{cli-client.cjs → cli-client.mjs} +46 -74
  79. package/src/lib/one-graph/{cli-netlify-graph.cjs → cli-netlify-graph.mjs} +35 -43
  80. package/src/recipes/vscode/{index.cjs → index.mjs} +7 -9
  81. package/src/recipes/vscode/{settings.cjs → settings.mjs} +10 -12
  82. package/src/utils/command-helpers.cjs +0 -1
  83. package/src/utils/{create-stream-promise.cjs → create-stream-promise.mjs} +2 -2
  84. package/src/utils/{detect-server-settings.cjs → detect-server-settings.mjs} +14 -20
  85. package/src/utils/functions/constants.mjs +1 -0
  86. package/src/utils/functions/{functions.cjs → functions.mjs} +6 -8
  87. package/src/utils/functions/{get-functions.cjs → get-functions.mjs} +4 -25
  88. package/src/utils/functions/index.mjs +3 -0
  89. package/src/utils/get-package-json.mjs +16 -0
  90. package/src/utils/{get-repo-data.cjs → get-repo-data.mjs} +15 -12
  91. package/src/utils/{gitignore.cjs → gitignore.mjs} +6 -8
  92. package/src/utils/index.cjs +0 -20
  93. package/src/utils/{live-tunnel.cjs → live-tunnel.mjs} +8 -10
  94. package/src/utils/lm/{install.cjs → install.mjs} +26 -25
  95. package/src/utils/lm/{requirements.cjs → requirements.mjs} +6 -13
  96. package/src/utils/lm/{steps.cjs → steps.mjs} +6 -8
  97. package/src/utils/lm/{ui.cjs → ui.mjs} +5 -7
  98. package/src/utils/{proxy.cjs → proxy.mjs} +31 -34
  99. package/src/utils/{read-repo-url.cjs → read-repo-url.mjs} +6 -11
  100. package/src/utils/{state-config.cjs → state-config.mjs} +8 -10
  101. package/src/utils/telemetry/index.mjs +1 -0
  102. package/src/utils/telemetry/{request.cjs → request.mjs} +5 -3
  103. package/src/utils/telemetry/{telemetry.cjs → telemetry.mjs} +12 -14
  104. package/src/utils/telemetry/{validation.cjs → validation.mjs} +2 -2
  105. package/src/commands/dev/index.cjs +0 -5
  106. package/src/commands/env/index.cjs +0 -5
  107. package/src/commands/graph/index.cjs +0 -5
  108. package/src/commands/link/index.cjs +0 -6
  109. package/src/commands/lm/index.cjs +0 -5
  110. package/src/commands/recipes/common.cjs +0 -33
  111. package/src/commands/recipes/index.cjs +0 -8
  112. package/src/lib/completion/constants.cjs +0 -6
  113. package/src/lib/completion/index.cjs +0 -5
  114. package/src/utils/functions/constants.cjs +0 -5
  115. package/src/utils/functions/index.cjs +0 -12
  116. package/src/utils/telemetry/index.cjs +0 -5
@@ -1,9 +1,10 @@
1
1
  // @ts-check
2
2
  import { mkdir } from 'fs/promises'
3
3
 
4
+ import { getFunctionsDir } from '../../utils/functions/index.mjs'
4
5
  import utils from '../../utils/index.cjs'
5
6
 
6
- const { NETLIFYDEVERR, NETLIFYDEVLOG, exit, getFunctionsDir, log } = utils
7
+ const { NETLIFYDEVERR, NETLIFYDEVLOG, exit, log } = utils
7
8
 
8
9
  /**
9
10
  * The functions:build command
@@ -18,21 +18,11 @@ import ora from 'ora'
18
18
 
19
19
  import { getAddons, getCurrentAddon, getSiteData } from '../../utils/addons/prepare.mjs'
20
20
  import utils from '../../utils/index.cjs'
21
+ import { readRepoURL, validateRepoURL } from '../../utils/read-repo-url.mjs'
21
22
 
22
23
  const copyTemplateDir = promisify(copyTemplateDirOriginal)
23
24
 
24
- const {
25
- NETLIFYDEVERR,
26
- NETLIFYDEVLOG,
27
- NETLIFYDEVWARN,
28
- chalk,
29
- error,
30
- execa,
31
- injectEnvVariables,
32
- log,
33
- readRepoURL,
34
- validateRepoURL,
35
- } = utils
25
+ const { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, error, execa, injectEnvVariables, log } = utils
36
26
 
37
27
  const require = createRequire(import.meta.url)
38
28
 
@@ -7,9 +7,10 @@ import process from 'process'
7
7
  import inquirer from 'inquirer'
8
8
  import fetch from 'node-fetch'
9
9
 
10
+ import { BACKGROUND, CLOCKWORK_USERAGENT, getFunctions } from '../../utils/functions/index.mjs'
10
11
  import utils from '../../utils/index.cjs'
11
12
 
12
- const { BACKGROUND, CLOCKWORK_USERAGENT, NETLIFYDEVWARN, chalk, error, exit, getFunctions } = utils
13
+ const { NETLIFYDEVWARN, chalk, error, exit } = utils
13
14
 
14
15
  const require = createRequire(import.meta.url)
15
16
 
@@ -1,9 +1,10 @@
1
1
  // @ts-check
2
2
  import AsciiTable from 'ascii-table'
3
3
 
4
+ import { getFunctions, getFunctionsDir } from '../../utils/functions/index.mjs'
4
5
  import utils from '../../utils/index.cjs'
5
6
 
6
- const { error, exit, getFunctions, getFunctionsDir, log, logJson, warn } = utils
7
+ const { error, exit, log, logJson, warn } = utils
7
8
 
8
9
  const normalizeFunction = function (deployedFunctions, { name, urlPath: url }) {
9
10
  const isDeployed = deployedFunctions.some((deployedFunction) => deployedFunction.n === name)
@@ -1,10 +1,11 @@
1
1
  // @ts-check
2
2
  import { join } from 'path'
3
3
 
4
- import { startFunctionsServer } from '../../lib/functions/server.cjs'
4
+ import { startFunctionsServer } from '../../lib/functions/server.mjs'
5
+ import { getFunctionsDir } from '../../utils/functions/index.mjs'
5
6
  import utils from '../../utils/index.cjs'
6
7
 
7
- const { acquirePort, getFunctionsDir, getSiteInformation, injectEnvVariables } = utils
8
+ const { acquirePort, getSiteInformation, injectEnvVariables } = utils
8
9
  const DEFAULT_PORT = 9999
9
10
 
10
11
  /**
@@ -1,10 +1,12 @@
1
1
  // @ts-check
2
- const fs = require('fs')
3
- const path = require('path')
4
- const process = require('process')
2
+ import fs from 'fs'
3
+ import path from 'path'
4
+ import process from 'process'
5
5
 
6
- const { getNetlifyGraphConfig } = require('../../lib/one-graph/cli-netlify-graph.cjs')
7
- const { NETLIFYDEVERR, chalk, error, log } = require('../../utils/index.cjs')
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
8
10
 
9
11
  /**
10
12
  * Creates the `netlify graph:config:write` command
@@ -45,7 +47,7 @@ const graphConfigWrite = async (options, command) => {
45
47
  * @param {import('../base-command.mjs').default} program
46
48
  * @returns
47
49
  */
48
- const createGraphConfigWriteCommand = (program) =>
50
+ export const createGraphConfigWriteCommand = (program) =>
49
51
  program
50
52
  .command('graph:config:write')
51
53
  .description(
@@ -54,5 +56,3 @@ const createGraphConfigWriteCommand = (program) =>
54
56
  .action(async (options, command) => {
55
57
  await graphConfigWrite(options, command)
56
58
  })
57
-
58
- module.exports = { createGraphConfigWriteCommand }
@@ -1,20 +1,17 @@
1
1
  // @ts-check
2
- const gitRepoInfo = require('git-repo-info')
3
-
4
- const {
5
- OneGraphCliClient,
6
- ensureCLISession,
7
- upsertMergeCLISessionMetadata,
8
- } = require('../../lib/one-graph/cli-client.cjs')
9
- const {
2
+ import gitRepoInfo from 'git-repo-info'
3
+
4
+ import { OneGraphCliClient, ensureCLISession, upsertMergeCLISessionMetadata } from '../../lib/one-graph/cli-client.mjs'
5
+ import {
10
6
  defaultExampleOperationsDoc,
11
7
  getGraphEditUrlBySiteId,
12
8
  getNetlifyGraphConfig,
13
9
  readGraphQLOperationsSourceFile,
14
- } = require('../../lib/one-graph/cli-netlify-graph.cjs')
15
- const { NETLIFYDEVERR, chalk, error, log } = require('../../utils/index.cjs')
16
- const { openBrowser } = require('../../utils/open-browser.cjs')
10
+ } from '../../lib/one-graph/cli-netlify-graph.mjs'
11
+ import utils from '../../utils/index.cjs'
12
+ import { openBrowser } from '../../utils/open-browser.cjs'
17
13
 
14
+ const { NETLIFYDEVERR, chalk, error, log } = utils
18
15
  const { ensureAppForSite, executeCreatePersistedQueryMutation } = OneGraphCliClient
19
16
 
20
17
  /**
@@ -99,12 +96,10 @@ const graphEdit = async (options, command) => {
99
96
  * @param {import('../base-command.mjs').default} program
100
97
  * @returns
101
98
  */
102
- const createGraphEditCommand = (program) =>
99
+ export const createGraphEditCommand = (program) =>
103
100
  program
104
101
  .command('graph:edit')
105
102
  .description('Launch the browser to edit your local graph functions from Netlify')
106
103
  .action(async (options, command) => {
107
104
  await graphEdit(options, command)
108
105
  })
109
-
110
- module.exports = { createGraphEditCommand }
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable eslint-comments/disable-enable-pair */
2
2
  // @ts-check
3
3
 
4
- const {
4
+ import {
5
5
  autocompleteCodegenModules,
6
6
  autocompleteOperationNames,
7
7
  buildSchema,
@@ -10,8 +10,10 @@ const {
10
10
  getCodegenModule,
11
11
  getNetlifyGraphConfig,
12
12
  readGraphQLSchemaFile,
13
- } = require('../../lib/one-graph/cli-netlify-graph.cjs')
14
- const { error, log } = require('../../utils/index.cjs')
13
+ } from '../../lib/one-graph/cli-netlify-graph.mjs'
14
+ import utils from '../../utils/index.cjs'
15
+
16
+ const { error, log } = utils
15
17
 
16
18
  /**
17
19
  * Creates the `netlify graph:handler` command
@@ -88,7 +90,7 @@ const graphHandler = async (args, options, command) => {
88
90
  * @param {import('../base-command.mjs').default} program
89
91
  * @returns
90
92
  */
91
- const createGraphHandlerCommand = (program) =>
93
+ export const createGraphHandlerCommand = (program) =>
92
94
  program
93
95
  .command('graph:handler')
94
96
  .argument('[name...]', 'Operation name(s)')
@@ -100,5 +102,3 @@ const createGraphHandlerCommand = (program) =>
100
102
  .action(async (operationNames, options, command) => {
101
103
  await graphHandler({ operationNames }, options, command)
102
104
  })
103
-
104
- module.exports = { createGraphHandlerCommand }
@@ -1,21 +1,15 @@
1
1
  // @ts-check
2
- const { Buffer } = require('buffer')
3
- const process = require('process')
4
-
5
- const { OneGraphClient } = require('netlify-onegraph-internal')
6
- const { v4: uuidv4 } = require('uuid')
7
-
8
- const { OneGraphCliClient, ensureCLISession } = require('../../lib/one-graph/cli-client.cjs')
9
- const { getNetlifyGraphConfig } = require('../../lib/one-graph/cli-netlify-graph.cjs')
10
- const {
11
- NETLIFYDEVERR,
12
- chalk,
13
- error,
14
- exit,
15
- getToken,
16
- log,
17
- translateFromEnvelopeToMongo,
18
- } = require('../../utils/index.cjs')
2
+ import { Buffer } from 'buffer'
3
+ import process from 'process'
4
+
5
+ import { OneGraphClient } from 'netlify-onegraph-internal'
6
+ import { v4 as uuidv4 } from 'uuid'
7
+
8
+ import { OneGraphCliClient, ensureCLISession } from '../../lib/one-graph/cli-client.mjs'
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
19
13
 
20
14
  const { ensureAppForSite, executeCreateApiTokenMutation } = OneGraphCliClient
21
15
 
@@ -161,12 +155,10 @@ const graphInit = async (options, command) => {
161
155
  * @param {import('../base-command.mjs').default} program
162
156
  * @returns
163
157
  */
164
- const createGraphInitCommand = (program) =>
158
+ export const createGraphInitCommand = (program) =>
165
159
  program
166
160
  .command('graph:init')
167
161
  .description('Initialize all the resources for Netlify Graph')
168
162
  .action(async (options, command) => {
169
163
  await graphInit(options, command)
170
164
  })
171
-
172
- module.exports = { createGraphInitCommand }
@@ -1,8 +1,8 @@
1
1
  // @ts-check
2
- const { GraphQL } = require('netlify-onegraph-internal')
2
+ import { GraphQL } from 'netlify-onegraph-internal'
3
3
 
4
- const { readLockfile } = require('../../lib/one-graph/cli-client.cjs')
5
- const {
4
+ import { readLockfile } from '../../lib/one-graph/cli-client.mjs'
5
+ import {
6
6
  buildSchema,
7
7
  defaultExampleOperationsDoc,
8
8
  extractFunctionsFromOperationDoc,
@@ -11,8 +11,10 @@ const {
11
11
  parse,
12
12
  readGraphQLOperationsSourceFile,
13
13
  readGraphQLSchemaFile,
14
- } = require('../../lib/one-graph/cli-netlify-graph.cjs')
15
- const { NETLIFYDEVERR, chalk, error, log } = require('../../utils/index.cjs')
14
+ } from '../../lib/one-graph/cli-netlify-graph.mjs'
15
+ import utils from '../../utils/index.cjs'
16
+
17
+ const { NETLIFYDEVERR, chalk, error, log } = utils
16
18
 
17
19
  /**
18
20
  * Creates the `netlify graph:library` command
@@ -79,12 +81,10 @@ const graphLibrary = async (options, command) => {
79
81
  * @param {import('../base-command.mjs').default} program
80
82
  * @returns
81
83
  */
82
- const createGraphLibraryCommand = (program) =>
84
+ export const createGraphLibraryCommand = (program) =>
83
85
  program
84
86
  .command('graph:library')
85
87
  .description('Generate the Graph function library')
86
88
  .action(async (options, command) => {
87
89
  await graphLibrary(options, command)
88
90
  })
89
-
90
- module.exports = { createGraphLibraryCommand }
@@ -1,13 +1,15 @@
1
1
  // @ts-check
2
- const { GraphQL } = require('netlify-onegraph-internal')
2
+ import { GraphQL } from 'netlify-onegraph-internal'
3
3
 
4
- const {
4
+ import {
5
5
  defaultExampleOperationsDoc,
6
6
  extractFunctionsFromOperationDoc,
7
7
  getNetlifyGraphConfig,
8
8
  readGraphQLOperationsSourceFile,
9
- } = require('../../lib/one-graph/cli-netlify-graph.cjs')
10
- const { log } = require('../../utils/index.cjs')
9
+ } from '../../lib/one-graph/cli-netlify-graph.mjs'
10
+ import utils from '../../utils/index.cjs'
11
+
12
+ const { log } = utils
11
13
 
12
14
  const { parse } = GraphQL
13
15
 
@@ -107,12 +109,10 @@ const graphOperations = async (options, command) => {
107
109
  * @param {import('../base-command.mjs').default} program
108
110
  * @returns
109
111
  */
110
- const createGraphOperationsCommand = (program) =>
112
+ export const createGraphOperationsCommand = (program) =>
111
113
  program
112
114
  .command('graph:operations')
113
115
  .description('List all of the locally available operations')
114
116
  .action(async (options, command) => {
115
117
  await graphOperations(options, command)
116
118
  })
117
-
118
- module.exports = { createGraphOperationsCommand }
@@ -1,9 +1,9 @@
1
1
  // @ts-check
2
2
  /* eslint-disable eslint-comments/disable-enable-pair */
3
3
  /* eslint-disable fp/no-loops */
4
- const { OneGraphClient } = require('netlify-onegraph-internal')
4
+ import { OneGraphClient } from 'netlify-onegraph-internal'
5
5
 
6
- const {
6
+ import {
7
7
  OneGraphCliClient,
8
8
  ensureCLISession,
9
9
  handleCliSessionEvent,
@@ -11,13 +11,11 @@ const {
11
11
  readLockfile,
12
12
  readSchemaIdFromLockfile,
13
13
  refetchAndGenerateFromOneGraph,
14
- } = require('../../lib/one-graph/cli-client.cjs')
15
- const {
16
- buildSchema,
17
- getNetlifyGraphConfig,
18
- readGraphQLSchemaFile,
19
- } = require('../../lib/one-graph/cli-netlify-graph.cjs')
20
- const { NETLIFYDEVERR, chalk, error, log, warn } = require('../../utils/index.cjs')
14
+ } from '../../lib/one-graph/cli-client.mjs'
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
21
19
 
22
20
  /**
23
21
  * Creates the `netlify graph:pull` command
@@ -163,12 +161,10 @@ ${JSON.stringify(error_, null, 2)}`)
163
161
  * @param {import('../base-command.mjs').default} program
164
162
  * @returns
165
163
  */
166
- const createGraphPullCommand = (program) =>
164
+ export const createGraphPullCommand = (program) =>
167
165
  program
168
166
  .command('graph:pull')
169
167
  .description('Pull your remote Netlify Graph schema locally, and process pending Graph edit events')
170
168
  .action(async (options, command) => {
171
169
  await graphPull(options, command)
172
170
  })
173
-
174
- module.exports = { createGraphPullCommand }
@@ -1,11 +1,11 @@
1
1
  // @ts-check
2
- const { createGraphConfigWriteCommand } = require('./graph-config-write.cjs')
3
- const { createGraphEditCommand } = require('./graph-edit.cjs')
4
- const { createGraphHandlerCommand } = require('./graph-handler.cjs')
5
- const { createGraphInitCommand } = require('./graph-init.cjs')
6
- const { createGraphLibraryCommand } = require('./graph-library.cjs')
7
- const { createGraphOperationsCommand } = require('./graph-operations.cjs')
8
- const { createGraphPullCommand } = require('./graph-pull.cjs')
2
+ import { createGraphConfigWriteCommand } from './graph-config-write.mjs'
3
+ import { createGraphEditCommand } from './graph-edit.mjs'
4
+ import { createGraphHandlerCommand } from './graph-handler.mjs'
5
+ import { createGraphInitCommand } from './graph-init.mjs'
6
+ import { createGraphLibraryCommand } from './graph-library.mjs'
7
+ import { createGraphOperationsCommand } from './graph-operations.mjs'
8
+ import { createGraphPullCommand } from './graph-pull.mjs'
9
9
 
10
10
  /**
11
11
  * The graph command
@@ -21,7 +21,7 @@ const graph = (options, command) => {
21
21
  * @param {import('../base-command.mjs').default} program
22
22
  * @returns
23
23
  */
24
- const createGraphCommand = (program) => {
24
+ export const createGraphCommand = (program) => {
25
25
  createGraphConfigWriteCommand(program)
26
26
  createGraphEditCommand(program)
27
27
  createGraphHandlerCommand(program)
@@ -36,5 +36,3 @@ const createGraphCommand = (program) => {
36
36
  .addExamples(['netlify graph:pull', 'netlify graph:edit'])
37
37
  .action(graph)
38
38
  }
39
-
40
- module.exports = { createGraphCommand }
@@ -0,0 +1 @@
1
+ export { createGraphCommand } from './graph.mjs'
@@ -3,12 +3,15 @@ import dotProp from 'dot-prop'
3
3
  import inquirer from 'inquirer'
4
4
  import isEmpty from 'lodash/isEmpty.js'
5
5
 
6
+ import getRepoData from '../../utils/get-repo-data.mjs'
7
+ import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
6
8
  import utils from '../../utils/index.cjs'
7
9
  import { configureRepo } from '../../utils/init/config.cjs'
8
- import { link } from '../link/index.cjs'
10
+ import { track } from '../../utils/telemetry/index.mjs'
11
+ import { link } from '../link/index.mjs'
9
12
  import { sitesCreate } from '../sites/index.mjs'
10
13
 
11
- const { chalk, ensureNetlifyIgnore, exit, getRepoData, log, track } = utils
14
+ const { chalk, exit, log } = utils
12
15
 
13
16
  const persistState = ({ siteInfo, state }) => {
14
17
  // Save to .netlify/state.json file
@@ -0,0 +1 @@
1
+ export { createLinkCommand, link } from './link.mjs'
@@ -1,13 +1,17 @@
1
1
  // @ts-check
2
- const inquirer = require('inquirer')
3
- const isEmpty = require('lodash/isEmpty')
2
+ import inquirer from 'inquirer'
4
3
 
5
- const { listSites } = require('../../lib/api.cjs')
6
- const { chalk, ensureNetlifyIgnore, error, exit, getRepoData, log, track } = require('../../utils/index.cjs')
4
+ import { listSites } from '../../lib/api.mjs'
5
+ import getRepoData from '../../utils/get-repo-data.mjs'
6
+ import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
7
+ import utils from '../../utils/index.cjs'
8
+ import { track } from '../../utils/telemetry/index.mjs'
9
+
10
+ const { chalk, error, exit, log } = utils
7
11
 
8
12
  /**
9
13
  *
10
- * @param {import('../base-command').NetlifyOptions} netlify
14
+ * @param {import('../base-command.mjs').NetlifyOptions} netlify
11
15
  * @param {import('commander').OptionValues} options
12
16
  */
13
17
  const linkPrompt = async (netlify, options) => {
@@ -51,7 +55,7 @@ const linkPrompt = async (netlify, options) => {
51
55
  log()
52
56
  const sites = await listSites({ api, options: { filter: 'all' } })
53
57
 
54
- if (isEmpty(sites)) {
58
+ if (sites.length === 0) {
55
59
  error(`You don't have any sites yet. Run ${chalk.cyanBright('netlify sites:create')} to create a site.`)
56
60
  }
57
61
 
@@ -60,7 +64,7 @@ const linkPrompt = async (netlify, options) => {
60
64
  )
61
65
 
62
66
  // If no remote matches. Throw error
63
- if (isEmpty(matchingSites)) {
67
+ if (matchingSites.length === 0) {
64
68
  log(chalk.redBright.bold.underline(`No Matching Site Found`))
65
69
  log()
66
70
  log(`No site found with the remote ${repoData.httpsUrl}.
@@ -125,7 +129,7 @@ Run ${chalk.cyanBright('git remote -v')} to see a list of your git remotes.`)
125
129
  }
126
130
  }
127
131
 
128
- if (isEmpty(matchingSites)) {
132
+ if (!matchingSites || matchingSites.length === 0) {
129
133
  error(`No site names found containing '${searchTerm}'.
130
134
 
131
135
  Run ${chalk.cyanBright('netlify link')} again to try a new search,
@@ -165,7 +169,7 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`)
165
169
  error(error_)
166
170
  }
167
171
 
168
- if (isEmpty(sites)) {
172
+ if (!sites || sites.length === 0) {
169
173
  error(`You don't have any sites yet. Run ${chalk.cyanBright('netlify sites:create')} to create a site.`)
170
174
  }
171
175
 
@@ -240,7 +244,7 @@ or run ${chalk.cyanBright('netlify sites:create')} to create a site.`)
240
244
  * @param {import('commander').OptionValues} options
241
245
  * @param {import('../base-command.mjs').default} command
242
246
  */
243
- const link = async (options, command) => {
247
+ export const link = async (options, command) => {
244
248
  await command.authenticate()
245
249
 
246
250
  const {
@@ -337,7 +341,7 @@ const link = async (options, command) => {
337
341
  * @param {import('../base-command.mjs').default} program
338
342
  * @returns
339
343
  */
340
- const createLinkCommand = (program) =>
344
+ export const createLinkCommand = (program) =>
341
345
  program
342
346
  .command('link')
343
347
  .description('Link a local repo or project folder to an existing site on Netlify')
@@ -346,5 +350,3 @@ const createLinkCommand = (program) =>
346
350
  .option('--gitRemoteName <name>', 'Name of Git remote to use. e.g. "origin"')
347
351
  .addExamples(['netlify link', 'netlify link --id 123-123-123-123', 'netlify link --name my-site-name'])
348
352
  .action(link)
349
-
350
- module.exports = { createLinkCommand, link }
@@ -0,0 +1 @@
1
+ export { createLmCommand } from './lm.mjs'
@@ -1,12 +1,12 @@
1
1
  // @ts-check
2
- const Listr = require('listr')
2
+ import Listr from 'listr'
3
3
 
4
- const {
4
+ import {
5
5
  checkGitLFSVersionStep,
6
6
  checkGitVersionStep,
7
7
  checkHelperVersionStep,
8
8
  checkLFSFiltersStep,
9
- } = require('../../utils/lm/steps.cjs')
9
+ } from '../../utils/lm/steps.mjs'
10
10
 
11
11
  /**
12
12
  * The lm:info command
@@ -36,7 +36,5 @@ const lmInfo = async () => {
36
36
  * @param {import('../base-command.mjs').default} program
37
37
  * @returns
38
38
  */
39
- const createLmInfoCommand = (program) =>
39
+ export const createLmInfoCommand = (program) =>
40
40
  program.command('lm:info').description('Show large media requirements information.').action(lmInfo)
41
-
42
- module.exports = { createLmInfoCommand }
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
- const { installPlatform } = require('../../utils/lm/install.cjs')
3
- const { printBanner } = require('../../utils/lm/ui.cjs')
2
+ import { installPlatform } from '../../utils/lm/install.mjs'
3
+ import { printBanner } from '../../utils/lm/ui.mjs'
4
4
 
5
5
  /**
6
6
  * The lm:install command
@@ -18,7 +18,7 @@ const lmInstall = async ({ force }) => {
18
18
  * @param {import('../base-command.mjs').default} program
19
19
  * @returns
20
20
  */
21
- const createLmInstallCommand = (program) =>
21
+ export const createLmInstallCommand = (program) =>
22
22
  program
23
23
  .command('lm:install')
24
24
  .alias('lm:init')
@@ -29,5 +29,3 @@ and configures your Git environment with the right credentials.`,
29
29
  )
30
30
  .option('-f, --force', 'Force the credentials helper installation')
31
31
  .action(lmInstall)
32
-
33
- module.exports = { createLmInstallCommand }
@@ -1,10 +1,12 @@
1
1
  // @ts-check
2
- const Listr = require('listr')
2
+ import Listr from 'listr'
3
3
 
4
- const { error, execa } = require('../../utils/index.cjs')
5
- const { installPlatform } = require('../../utils/lm/install.cjs')
6
- const { checkHelperVersion } = require('../../utils/lm/requirements.cjs')
7
- const { printBanner } = require('../../utils/lm/ui.cjs')
4
+ import utils from '../../utils/index.cjs'
5
+ import { installPlatform } from '../../utils/lm/install.mjs'
6
+ import { checkHelperVersion } from '../../utils/lm/requirements.mjs'
7
+ import { printBanner } from '../../utils/lm/ui.mjs'
8
+
9
+ const { error, execa } = utils
8
10
 
9
11
  const installHelperIfMissing = async function ({ force }) {
10
12
  let installHelper = false
@@ -94,7 +96,7 @@ const lmSetup = async (options, command) => {
94
96
  * @param {import('../base-command.mjs').default} program
95
97
  * @returns
96
98
  */
97
- const createLmSetupCommand = (program) =>
99
+ export const createLmSetupCommand = (program) =>
98
100
  program
99
101
  .command('lm:setup')
100
102
  .description('Configures your site to use Netlify Large Media')
@@ -102,5 +104,3 @@ const createLmSetupCommand = (program) =>
102
104
  .option('-f, --force-install', 'Force the credentials helper installation')
103
105
  .addHelpText('after', 'It runs the install command if you have not installed the dependencies yet.')
104
106
  .action(lmSetup)
105
-
106
- module.exports = { createLmSetupCommand }
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- const { uninstall } = require('../../utils/lm/install.cjs')
2
+ import { uninstall } from '../../utils/lm/install.mjs'
3
3
 
4
4
  /**
5
5
  * The lm:uninstall command
@@ -13,7 +13,7 @@ const lmUninstall = async () => {
13
13
  * @param {import('../base-command.mjs').default} program
14
14
  * @returns
15
15
  */
16
- const createLmUninstallCommand = (program) =>
16
+ export const createLmUninstallCommand = (program) =>
17
17
  program
18
18
  .command('lm:uninstall', { hidden: true })
19
19
  .alias('lm:remove')
@@ -21,5 +21,3 @@ const createLmUninstallCommand = (program) =>
21
21
  'Uninstalls Netlify git credentials helper and cleans up any related configuration changes made by the install command.',
22
22
  )
23
23
  .action(lmUninstall)
24
-
25
- module.exports = { createLmUninstallCommand }
@@ -1,8 +1,8 @@
1
1
  // @ts-check
2
- const { createLmInfoCommand } = require('./lm-info.cjs')
3
- const { createLmInstallCommand } = require('./lm-install.cjs')
4
- const { createLmSetupCommand } = require('./lm-setup.cjs')
5
- const { createLmUninstallCommand } = require('./lm-uninstall.cjs')
2
+ import { createLmInfoCommand } from './lm-info.mjs'
3
+ import { createLmInstallCommand } from './lm-install.mjs'
4
+ import { createLmSetupCommand } from './lm-setup.mjs'
5
+ import { createLmUninstallCommand } from './lm-uninstall.mjs'
6
6
 
7
7
  /**
8
8
  * The lm command
@@ -18,7 +18,7 @@ const lm = (options, command) => {
18
18
  * @param {import('../base-command.mjs').default} program
19
19
  * @returns
20
20
  */
21
- const createLmCommand = (program) => {
21
+ export const createLmCommand = (program) => {
22
22
  createLmInfoCommand(program)
23
23
  createLmInstallCommand(program)
24
24
  createLmSetupCommand(program)
@@ -30,5 +30,3 @@ const createLmCommand = (program) => {
30
30
  .addExamples(['netlify lm:info', 'netlify lm:install', 'netlify lm:setup'])
31
31
  .action(lm)
32
32
  }
33
-
34
- module.exports = { createLmCommand }
@@ -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, getToken, log, track } = utils
5
+ const { exit, getToken, log } = utils
5
6
 
6
7
  /**
7
8
  * The logout command