netlify-cli 12.2.7 → 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.
- package/bin/run.mjs +2 -3
- package/npm-shrinkwrap.json +93 -90
- package/package.json +4 -4
- package/scripts/postinstall.mjs +2 -2
- package/src/commands/base-command.mjs +8 -12
- package/src/commands/build/build.mjs +2 -2
- package/src/commands/completion/completion.mjs +3 -3
- package/src/commands/deploy/deploy.mjs +4 -5
- package/src/commands/dev/{dev-exec.cjs → dev-exec.mjs} +5 -5
- package/src/commands/dev/{dev.cjs → dev.mjs} +32 -32
- package/src/commands/dev/index.mjs +1 -0
- package/src/commands/env/{env-clone.cjs → env-clone.mjs} +7 -16
- package/src/commands/env/{env-get.cjs → env-get.mjs} +5 -13
- package/src/commands/env/{env-import.cjs → env-import.mjs} +8 -15
- package/src/commands/env/{env-list.cjs → env-list.mjs} +13 -25
- package/src/commands/env/{env-set.cjs → env-set.mjs} +5 -5
- package/src/commands/env/{env-unset.cjs → env-unset.mjs} +4 -12
- package/src/commands/env/{env.cjs → env.mjs} +7 -9
- package/src/commands/env/index.mjs +1 -0
- package/src/commands/functions/functions-build.mjs +2 -1
- package/src/commands/functions/functions-create.mjs +2 -12
- package/src/commands/functions/functions-invoke.mjs +2 -1
- package/src/commands/functions/functions-list.mjs +2 -1
- package/src/commands/functions/functions-serve.mjs +3 -2
- package/src/commands/graph/{graph-config-write.cjs → graph-config-write.mjs} +8 -8
- package/src/commands/graph/{graph-edit.cjs → graph-edit.mjs} +9 -14
- package/src/commands/graph/{graph-handler.cjs → graph-handler.mjs} +6 -6
- package/src/commands/graph/{graph-init.cjs → graph-init.mjs} +12 -20
- package/src/commands/graph/{graph-library.cjs → graph-library.mjs} +8 -8
- package/src/commands/graph/{graph-operations.cjs → graph-operations.mjs} +7 -7
- package/src/commands/graph/{graph-pull.cjs → graph-pull.mjs} +8 -12
- package/src/commands/graph/{graph.cjs → graph.mjs} +8 -10
- package/src/commands/graph/index.mjs +1 -0
- package/src/commands/init/init.mjs +5 -2
- package/src/commands/link/index.mjs +1 -0
- package/src/commands/link/{link.cjs → link.mjs} +15 -13
- package/src/commands/lm/index.mjs +1 -0
- package/src/commands/lm/{lm-info.cjs → lm-info.mjs} +4 -6
- package/src/commands/lm/{lm-install.cjs → lm-install.mjs} +3 -5
- package/src/commands/lm/{lm-setup.cjs → lm-setup.mjs} +8 -8
- package/src/commands/lm/{lm-uninstall.cjs → lm-uninstall.mjs} +2 -4
- package/src/commands/lm/{lm.cjs → lm.mjs} +5 -7
- package/src/commands/logout/logout.mjs +2 -1
- package/src/commands/main.mjs +10 -12
- package/src/commands/recipes/common.mjs +36 -0
- package/src/commands/recipes/index.mjs +1 -0
- package/src/commands/recipes/{recipes-list.cjs → recipes-list.mjs} +3 -5
- package/src/commands/recipes/{recipes.cjs → recipes.mjs} +12 -10
- package/src/commands/sites/sites-create-template.mjs +3 -1
- package/src/commands/sites/sites-create.mjs +4 -2
- package/src/commands/sites/sites-list.mjs +1 -1
- package/src/commands/unlink/unlink.mjs +2 -1
- package/src/functions-templates/go/hello-world/go.mod +1 -1
- package/src/functions-templates/javascript/stripe-charge/package-lock.json +6 -6
- package/src/functions-templates/javascript/stripe-subscription/package-lock.json +6 -6
- package/src/functions-templates/javascript/token-hider/package-lock.json +6 -6
- package/src/functions-templates/rust/hello-world/Cargo.toml +1 -1
- package/src/functions-templates/typescript/hello-world/package-lock.json +6 -6
- package/src/lib/account.cjs +0 -3
- package/src/lib/{api.cjs → api.mjs} +3 -5
- package/src/lib/{build.cjs → build.mjs} +9 -9
- package/src/lib/completion/constants.mjs +4 -0
- package/src/lib/completion/{generate-autocompletion.cjs → generate-autocompletion.mjs} +6 -6
- package/src/lib/completion/{script.cjs → get-autocompletion.mjs} +1 -25
- package/src/lib/completion/index.mjs +1 -0
- package/src/lib/completion/script.mjs +35 -0
- package/src/lib/edge-functions/{editor-helper.cjs → editor-helper.mjs} +4 -6
- package/src/lib/edge-functions/index.cjs +1 -2
- package/src/lib/exec-fetcher.cjs +0 -2
- package/src/lib/functions/{form-submissions-handler.cjs → form-submissions-handler.mjs} +26 -28
- package/src/lib/functions/{scheduled.cjs → scheduled.mjs} +6 -8
- package/src/lib/functions/{server.cjs → server.mjs} +20 -29
- package/src/lib/geo-location.cjs +1 -1
- package/src/lib/{http-agent.cjs → http-agent.mjs} +7 -8
- package/src/lib/one-graph/{cli-client.cjs → cli-client.mjs} +46 -74
- package/src/lib/one-graph/{cli-netlify-graph.cjs → cli-netlify-graph.mjs} +35 -43
- package/src/recipes/vscode/{index.cjs → index.mjs} +7 -9
- package/src/recipes/vscode/{settings.cjs → settings.mjs} +10 -12
- package/src/utils/{create-stream-promise.cjs → create-stream-promise.mjs} +2 -2
- package/src/utils/{detect-server-settings.cjs → detect-server-settings.mjs} +14 -20
- package/src/utils/functions/constants.mjs +1 -0
- package/src/utils/functions/{functions.cjs → functions.mjs} +6 -8
- package/src/utils/functions/{get-functions.cjs → get-functions.mjs} +4 -25
- package/src/utils/functions/index.mjs +3 -0
- package/src/utils/get-package-json.mjs +16 -0
- package/src/utils/{get-repo-data.cjs → get-repo-data.mjs} +15 -12
- package/src/utils/{gitignore.cjs → gitignore.mjs} +6 -8
- package/src/utils/index.cjs +0 -20
- package/src/utils/{live-tunnel.cjs → live-tunnel.mjs} +8 -10
- package/src/utils/lm/{install.cjs → install.mjs} +26 -25
- package/src/utils/lm/{requirements.cjs → requirements.mjs} +6 -13
- package/src/utils/lm/{steps.cjs → steps.mjs} +6 -8
- package/src/utils/lm/{ui.cjs → ui.mjs} +5 -7
- package/src/utils/{proxy.cjs → proxy.mjs} +31 -34
- package/src/utils/{read-repo-url.cjs → read-repo-url.mjs} +6 -11
- package/src/utils/{state-config.cjs → state-config.mjs} +8 -10
- package/src/utils/telemetry/index.mjs +1 -0
- package/src/utils/telemetry/{request.cjs → request.mjs} +5 -3
- package/src/utils/telemetry/{telemetry.cjs → telemetry.mjs} +12 -14
- package/src/utils/telemetry/{validation.cjs → validation.mjs} +2 -2
- package/src/commands/dev/index.cjs +0 -5
- package/src/commands/env/index.cjs +0 -5
- package/src/commands/graph/index.cjs +0 -5
- package/src/commands/link/index.cjs +0 -6
- package/src/commands/lm/index.cjs +0 -5
- package/src/commands/recipes/common.cjs +0 -33
- package/src/commands/recipes/index.cjs +0 -8
- package/src/lib/completion/constants.cjs +0 -6
- package/src/lib/completion/index.cjs +0 -5
- package/src/utils/functions/constants.cjs +0 -5
- package/src/utils/functions/index.cjs +0 -12
- package/src/utils/telemetry/index.cjs +0 -5
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import events from 'events'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import process from 'process'
|
|
5
|
+
import { promisify } from 'util'
|
|
6
|
+
|
|
7
|
+
import boxen from 'boxen'
|
|
8
|
+
import { Option } from 'commander'
|
|
9
|
+
import execa from 'execa'
|
|
10
|
+
import StaticServer from 'static-server'
|
|
11
|
+
import stripAnsiCc from 'strip-ansi-control-characters'
|
|
12
|
+
import waitPort from 'wait-port'
|
|
13
|
+
|
|
14
|
+
import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.mjs'
|
|
15
|
+
import { startFunctionsServer } from '../../lib/functions/server.mjs'
|
|
16
|
+
import {
|
|
17
17
|
OneGraphCliClient,
|
|
18
18
|
loadCLISession,
|
|
19
19
|
markCliSessionInactive,
|
|
20
20
|
persistNewOperationsDocForSession,
|
|
21
21
|
startOneGraphCLISession,
|
|
22
|
-
}
|
|
23
|
-
|
|
22
|
+
} from '../../lib/one-graph/cli-client.mjs'
|
|
23
|
+
import {
|
|
24
24
|
defaultExampleOperationsDoc,
|
|
25
25
|
getGraphEditUrlBySiteId,
|
|
26
26
|
getNetlifyGraphConfig,
|
|
27
27
|
readGraphQLOperationsSourceFile,
|
|
28
|
-
}
|
|
29
|
-
|
|
28
|
+
} from '../../lib/one-graph/cli-netlify-graph.mjs'
|
|
29
|
+
import { startSpinner, stopSpinner } from '../../lib/spinner.cjs'
|
|
30
|
+
import detectServerSettings from '../../utils/detect-server-settings.mjs'
|
|
31
|
+
import { ensureNetlifyIgnore } from '../../utils/gitignore.mjs'
|
|
32
|
+
import utils from '../../utils/index.cjs'
|
|
33
|
+
import { startLiveTunnel } from '../../utils/live-tunnel.mjs'
|
|
34
|
+
import { startProxy } from '../../utils/proxy.mjs'
|
|
35
|
+
|
|
36
|
+
import { createDevExecCommand } from './dev-exec.mjs'
|
|
37
|
+
|
|
30
38
|
const {
|
|
31
39
|
BANG,
|
|
32
40
|
NETLIFYDEV,
|
|
@@ -34,8 +42,6 @@ const {
|
|
|
34
42
|
NETLIFYDEVLOG,
|
|
35
43
|
NETLIFYDEVWARN,
|
|
36
44
|
chalk,
|
|
37
|
-
detectServerSettings,
|
|
38
|
-
ensureNetlifyIgnore,
|
|
39
45
|
error,
|
|
40
46
|
exit,
|
|
41
47
|
generateNetlifyGraphJWT,
|
|
@@ -48,13 +54,9 @@ const {
|
|
|
48
54
|
normalizeContext,
|
|
49
55
|
openBrowser,
|
|
50
56
|
processOnExit,
|
|
51
|
-
startLiveTunnel,
|
|
52
|
-
startProxy,
|
|
53
57
|
warn,
|
|
54
58
|
watchDebounced,
|
|
55
|
-
} =
|
|
56
|
-
|
|
57
|
-
const { createDevExecCommand } = require('./dev-exec.cjs')
|
|
59
|
+
} = utils
|
|
58
60
|
|
|
59
61
|
const netlifyBuildPromise = import('@netlify/build')
|
|
60
62
|
|
|
@@ -247,8 +249,8 @@ const FRAMEWORK_PORT_TIMEOUT = 6e5
|
|
|
247
249
|
*
|
|
248
250
|
* @param {object} params
|
|
249
251
|
* @param {*} params.addonsUrls
|
|
250
|
-
* @param {import('../base-command').NetlifyOptions["config"]} params.config
|
|
251
|
-
* @param {import('../base-command').NetlifyOptions["cachedConfig"]['env']} params.env
|
|
252
|
+
* @param {import('../base-command.mjs').NetlifyOptions["config"]} params.config
|
|
253
|
+
* @param {import('../base-command.mjs').NetlifyOptions["cachedConfig"]['env']} params.env
|
|
252
254
|
* @param {InspectSettings} params.inspectSettings
|
|
253
255
|
* @param {() => Promise<object>} params.getUpdatedConfig
|
|
254
256
|
* @param {string} params.geolocationMode
|
|
@@ -257,7 +259,7 @@ const FRAMEWORK_PORT_TIMEOUT = 6e5
|
|
|
257
259
|
* @param {boolean} params.offline
|
|
258
260
|
* @param {*} params.site
|
|
259
261
|
* @param {*} params.siteInfo
|
|
260
|
-
* @param {import('../../utils/state-config').
|
|
262
|
+
* @param {import('../../utils/state-config.mjs').default} params.state
|
|
261
263
|
* @returns
|
|
262
264
|
*/
|
|
263
265
|
const startProxyServer = async ({
|
|
@@ -690,7 +692,7 @@ const getBuildOptions = ({ cachedConfig, options: { context, cwd = process.cwd()
|
|
|
690
692
|
* @param {import('../base-command.mjs').default} program
|
|
691
693
|
* @returns
|
|
692
694
|
*/
|
|
693
|
-
const createDevCommand = (program) => {
|
|
695
|
+
export const createDevCommand = (program) => {
|
|
694
696
|
createDevExecCommand(program)
|
|
695
697
|
|
|
696
698
|
return program
|
|
@@ -765,5 +767,3 @@ const createDevCommand = (program) => {
|
|
|
765
767
|
])
|
|
766
768
|
.action(dev)
|
|
767
769
|
}
|
|
768
|
-
|
|
769
|
-
module.exports = { createDevCommand }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createDevCommand } from './dev.mjs'
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
import utils from '../../utils/index.cjs'
|
|
2
3
|
|
|
3
|
-
const {
|
|
4
|
-
|
|
5
|
-
const {
|
|
6
|
-
chalk,
|
|
7
|
-
error: logError,
|
|
8
|
-
log,
|
|
9
|
-
translateFromEnvelopeToMongo,
|
|
10
|
-
translateFromMongoToEnvelope,
|
|
11
|
-
} = require('../../utils/index.cjs')
|
|
4
|
+
const { chalk, error: logError, log, translateFromEnvelopeToMongo, translateFromMongoToEnvelope } = utils
|
|
12
5
|
|
|
13
6
|
const safeGetSite = async (api, siteId) => {
|
|
14
7
|
try {
|
|
@@ -93,7 +86,7 @@ const mongoToMongo = async ({ api, siteFrom, siteTo }) => {
|
|
|
93
86
|
},
|
|
94
87
|
] = [siteFrom, siteTo]
|
|
95
88
|
|
|
96
|
-
if (
|
|
89
|
+
if (Object.keys(envFrom).length === 0) {
|
|
97
90
|
log(`${chalk.green(siteFrom.name)} has no environment variables, nothing to clone`)
|
|
98
91
|
return false
|
|
99
92
|
}
|
|
@@ -125,7 +118,7 @@ const mongoToEnvelope = async ({ api, siteFrom, siteTo }) => {
|
|
|
125
118
|
const envFrom = siteFrom.build_settings.env || {}
|
|
126
119
|
const keysFrom = Object.keys(envFrom)
|
|
127
120
|
|
|
128
|
-
if (
|
|
121
|
+
if (Object.keys(envFrom).length === 0) {
|
|
129
122
|
log(`${chalk.green(siteFrom.name)} has no environment variables, nothing to clone`)
|
|
130
123
|
return false
|
|
131
124
|
}
|
|
@@ -158,7 +151,7 @@ const envelopeToMongo = async ({ api, siteFrom, siteTo }) => {
|
|
|
158
151
|
const envelopeVariables = await api.getEnvVars({ accountId: siteFrom.account_slug, siteId: siteFrom.id })
|
|
159
152
|
const envFrom = translateFromEnvelopeToMongo(envelopeVariables)
|
|
160
153
|
|
|
161
|
-
if (
|
|
154
|
+
if (Object.keys(envFrom).length === 0) {
|
|
162
155
|
log(`${chalk.green(siteFrom.name)} has no environment variables, nothing to clone`)
|
|
163
156
|
return false
|
|
164
157
|
}
|
|
@@ -196,7 +189,7 @@ const envelopeToEnvelope = async ({ api, siteFrom, siteTo }) => {
|
|
|
196
189
|
|
|
197
190
|
const keysFrom = envelopeFrom.map(({ key }) => key)
|
|
198
191
|
|
|
199
|
-
if (
|
|
192
|
+
if (keysFrom.length === 0) {
|
|
200
193
|
log(`${chalk.green(siteFrom.name)} has no environment variables, nothing to clone`)
|
|
201
194
|
return false
|
|
202
195
|
}
|
|
@@ -222,7 +215,7 @@ const envelopeToEnvelope = async ({ api, siteFrom, siteTo }) => {
|
|
|
222
215
|
* @param {import('../base-command.mjs').default} program
|
|
223
216
|
* @returns
|
|
224
217
|
*/
|
|
225
|
-
const createEnvCloneCommand = (program) =>
|
|
218
|
+
export const createEnvCloneCommand = (program) =>
|
|
226
219
|
program
|
|
227
220
|
.command('env:clone')
|
|
228
221
|
.alias('env:migrate')
|
|
@@ -231,5 +224,3 @@ const createEnvCloneCommand = (program) =>
|
|
|
231
224
|
.description(`Clone environment variables from one site to another`)
|
|
232
225
|
.addExamples(['netlify env:clone --to <to-site-id>', 'netlify env:clone --to <to-site-id> --from <from-site-id>'])
|
|
233
226
|
.action(envClone)
|
|
234
|
-
|
|
235
|
-
module.exports = { createEnvCloneCommand }
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
2
|
+
import { Option } from 'commander'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
error,
|
|
8
|
-
getEnvelopeEnv,
|
|
9
|
-
log,
|
|
10
|
-
logJson,
|
|
11
|
-
normalizeContext,
|
|
12
|
-
} = require('../../utils/index.cjs')
|
|
4
|
+
import utils from '../../utils/index.cjs'
|
|
5
|
+
|
|
6
|
+
const { AVAILABLE_CONTEXTS, chalk, error, getEnvelopeEnv, log, logJson, normalizeContext } = utils
|
|
13
7
|
|
|
14
8
|
/**
|
|
15
9
|
* The env:get command
|
|
@@ -65,7 +59,7 @@ const envGet = async (name, options, command) => {
|
|
|
65
59
|
* @param {import('../base-command.mjs').default} program
|
|
66
60
|
* @returns
|
|
67
61
|
*/
|
|
68
|
-
const createEnvGetCommand = (program) =>
|
|
62
|
+
export const createEnvGetCommand = (program) =>
|
|
69
63
|
program
|
|
70
64
|
.command('env:get')
|
|
71
65
|
.argument('<name>', 'Environment variable name')
|
|
@@ -90,5 +84,3 @@ const createEnvGetCommand = (program) =>
|
|
|
90
84
|
.action(async (name, options, command) => {
|
|
91
85
|
await envGet(name, options, command)
|
|
92
86
|
})
|
|
93
|
-
|
|
94
|
-
module.exports = { createEnvGetCommand }
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
2
|
+
import { readFile } from 'fs/promises'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const isEmpty = require('lodash/isEmpty')
|
|
4
|
+
import AsciiTable from 'ascii-table'
|
|
5
|
+
import dotenv from 'dotenv'
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
logJson,
|
|
12
|
-
translateFromEnvelopeToMongo,
|
|
13
|
-
translateFromMongoToEnvelope,
|
|
14
|
-
} = require('../../utils/index.cjs')
|
|
7
|
+
import utils from '../../utils/index.cjs'
|
|
8
|
+
|
|
9
|
+
const { exit, log, logJson, translateFromEnvelopeToMongo, translateFromMongoToEnvelope } = utils
|
|
15
10
|
|
|
16
11
|
/**
|
|
17
12
|
* The env:import command
|
|
@@ -38,7 +33,7 @@ const envImport = async (fileName, options, command) => {
|
|
|
38
33
|
exit(1)
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
if (
|
|
36
|
+
if (Object.keys(importedEnv).length === 0) {
|
|
42
37
|
log(`No environment variables found in file ${fileName} to import`)
|
|
43
38
|
return false
|
|
44
39
|
}
|
|
@@ -128,7 +123,7 @@ const importIntoEnvelope = async ({ api, importedEnv, options, siteInfo }) => {
|
|
|
128
123
|
* @param {import('../base-command.mjs').default} program
|
|
129
124
|
* @returns
|
|
130
125
|
*/
|
|
131
|
-
const createEnvImportCommand = (program) =>
|
|
126
|
+
export const createEnvImportCommand = (program) =>
|
|
132
127
|
program
|
|
133
128
|
.command('env:import')
|
|
134
129
|
.argument('<fileName>', '.env file to import')
|
|
@@ -141,5 +136,3 @@ const createEnvImportCommand = (program) =>
|
|
|
141
136
|
.action(async (fileName, options, command) => {
|
|
142
137
|
await envImport(fileName, options, command)
|
|
143
138
|
})
|
|
144
|
-
|
|
145
|
-
module.exports = { createEnvImportCommand }
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getHumanReadableScopes,
|
|
14
|
-
log,
|
|
15
|
-
logJson,
|
|
16
|
-
normalizeContext,
|
|
17
|
-
} = require('../../utils/index.cjs')
|
|
18
|
-
|
|
19
|
-
const [logUpdatePromise, ansiEscapesPromise] = [import('log-update'), import('ansi-escapes')]
|
|
2
|
+
import ansiEscapes from 'ansi-escapes'
|
|
3
|
+
import AsciiTable from 'ascii-table'
|
|
4
|
+
import { isCI } from 'ci-info'
|
|
5
|
+
import { Option } from 'commander'
|
|
6
|
+
import inquirer from 'inquirer'
|
|
7
|
+
import logUpdate from 'log-update'
|
|
8
|
+
|
|
9
|
+
import utils from '../../utils/index.cjs'
|
|
10
|
+
|
|
11
|
+
const { AVAILABLE_CONTEXTS, chalk, error, getEnvelopeEnv, getHumanReadableScopes, log, logJson, normalizeContext } =
|
|
12
|
+
utils
|
|
20
13
|
|
|
21
14
|
const MASK_LENGTH = 50
|
|
22
15
|
const MASK = '*'.repeat(MASK_LENGTH)
|
|
@@ -89,7 +82,7 @@ const envList = async (options, command) => {
|
|
|
89
82
|
const contextType = AVAILABLE_CONTEXTS.includes(context) ? 'context' : 'branch'
|
|
90
83
|
const withContext = isUsingEnvelope ? `in the ${chalk.magenta(options.context)} ${contextType}` : ''
|
|
91
84
|
const withScope = isUsingEnvelope && scope !== 'any' ? `and ${chalk.yellow(options.scope)} scope` : ''
|
|
92
|
-
if (
|
|
85
|
+
if (Object.keys(environment).length === 0) {
|
|
93
86
|
log(`No environment variables set ${forSite} ${withContext} ${withScope}`)
|
|
94
87
|
return false
|
|
95
88
|
}
|
|
@@ -103,8 +96,6 @@ const envList = async (options, command) => {
|
|
|
103
96
|
return false
|
|
104
97
|
}
|
|
105
98
|
|
|
106
|
-
const { default: logUpdate } = await logUpdatePromise
|
|
107
|
-
|
|
108
99
|
logUpdate(getTable({ environment, hideValues: true, scopesColumn: isUsingEnvelope }))
|
|
109
100
|
const { showValues } = await inquirer.prompt([
|
|
110
101
|
{
|
|
@@ -116,7 +107,6 @@ const envList = async (options, command) => {
|
|
|
116
107
|
])
|
|
117
108
|
|
|
118
109
|
if (showValues) {
|
|
119
|
-
const { default: ansiEscapes } = await ansiEscapesPromise
|
|
120
110
|
// since inquirer adds a prompt, we need to account for it when printing the table again
|
|
121
111
|
log(ansiEscapes.eraseLines(3))
|
|
122
112
|
logUpdate(getTable({ environment, hideValues: false, scopesColumn: isUsingEnvelope }))
|
|
@@ -129,7 +119,7 @@ const envList = async (options, command) => {
|
|
|
129
119
|
* @param {import('../base-command.mjs').default} program
|
|
130
120
|
* @returns
|
|
131
121
|
*/
|
|
132
|
-
const createEnvListCommand = (program) =>
|
|
122
|
+
export const createEnvListCommand = (program) =>
|
|
133
123
|
program
|
|
134
124
|
.command('env:list')
|
|
135
125
|
.option(
|
|
@@ -153,5 +143,3 @@ const createEnvListCommand = (program) =>
|
|
|
153
143
|
.action(async (options, command) => {
|
|
154
144
|
await envList(options, command)
|
|
155
145
|
})
|
|
156
|
-
|
|
157
|
-
module.exports = { createEnvListCommand }
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
2
|
+
import { Option } from 'commander'
|
|
3
|
+
|
|
4
|
+
import utils from '../../utils/index.cjs'
|
|
3
5
|
|
|
4
6
|
const {
|
|
5
7
|
AVAILABLE_CONTEXTS,
|
|
@@ -10,7 +12,7 @@ const {
|
|
|
10
12
|
logJson,
|
|
11
13
|
normalizeContext,
|
|
12
14
|
translateFromEnvelopeToMongo,
|
|
13
|
-
} =
|
|
15
|
+
} = utils
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* The env:set command
|
|
@@ -150,7 +152,7 @@ const setInEnvelope = async ({ api, context, key, scope, siteInfo, value }) => {
|
|
|
150
152
|
* @param {import('../base-command.mjs').default} program
|
|
151
153
|
* @returns
|
|
152
154
|
*/
|
|
153
|
-
const createEnvSetCommand = (program) =>
|
|
155
|
+
export const createEnvSetCommand = (program) =>
|
|
154
156
|
program
|
|
155
157
|
.command('env:set')
|
|
156
158
|
.argument('<key>', 'Environment variable key')
|
|
@@ -180,5 +182,3 @@ const createEnvSetCommand = (program) =>
|
|
|
180
182
|
.action(async (key, value, options, command) => {
|
|
181
183
|
await envSet(key, value, options, command)
|
|
182
184
|
})
|
|
183
|
-
|
|
184
|
-
module.exports = { createEnvSetCommand }
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
error,
|
|
6
|
-
log,
|
|
7
|
-
logJson,
|
|
8
|
-
normalizeContext,
|
|
9
|
-
translateFromEnvelopeToMongo,
|
|
10
|
-
} = require('../../utils/index.cjs')
|
|
2
|
+
import utils from '../../utils/index.cjs'
|
|
3
|
+
|
|
4
|
+
const { AVAILABLE_CONTEXTS, chalk, error, log, logJson, normalizeContext, translateFromEnvelopeToMongo } = utils
|
|
11
5
|
|
|
12
6
|
/**
|
|
13
7
|
* The env:unset command
|
|
@@ -138,7 +132,7 @@ const unsetInEnvelope = async ({ api, context, key, siteInfo }) => {
|
|
|
138
132
|
* @param {import('../base-command.mjs').default} program
|
|
139
133
|
* @returns
|
|
140
134
|
*/
|
|
141
|
-
const createEnvUnsetCommand = (program) =>
|
|
135
|
+
export const createEnvUnsetCommand = (program) =>
|
|
142
136
|
program
|
|
143
137
|
.command('env:unset')
|
|
144
138
|
.aliases(['env:delete', 'env:remove'])
|
|
@@ -158,5 +152,3 @@ const createEnvUnsetCommand = (program) =>
|
|
|
158
152
|
.action(async (key, options, command) => {
|
|
159
153
|
await envUnset(key, options, command)
|
|
160
154
|
})
|
|
161
|
-
|
|
162
|
-
module.exports = { createEnvUnsetCommand }
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { createEnvCloneCommand } from './env-clone.mjs'
|
|
3
|
+
import { createEnvGetCommand } from './env-get.mjs'
|
|
4
|
+
import { createEnvImportCommand } from './env-import.mjs'
|
|
5
|
+
import { createEnvListCommand } from './env-list.mjs'
|
|
6
|
+
import { createEnvSetCommand } from './env-set.mjs'
|
|
7
|
+
import { createEnvUnsetCommand } from './env-unset.mjs'
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The env command
|
|
@@ -20,7 +20,7 @@ const env = (options, command) => {
|
|
|
20
20
|
* @param {import('../base-command.mjs').default} program
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
|
23
|
-
const createEnvCommand = (program) => {
|
|
23
|
+
export const createEnvCommand = (program) => {
|
|
24
24
|
createEnvGetCommand(program)
|
|
25
25
|
createEnvImportCommand(program)
|
|
26
26
|
createEnvListCommand(program)
|
|
@@ -41,5 +41,3 @@ const createEnvCommand = (program) => {
|
|
|
41
41
|
])
|
|
42
42
|
.action(env)
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
module.exports = { createEnvCommand }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createEnvCommand } from './env.mjs'
|
|
@@ -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,
|
|
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 {
|
|
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,
|
|
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.
|
|
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,
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import fs from 'fs'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import process from 'process'
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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
|
-
}
|
|
14
|
-
|
|
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 }
|