netlify-cli 13.0.1 → 13.1.1
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/npm-shrinkwrap.json +785 -1472
- package/package.json +10 -10
- package/src/commands/deploy/deploy.mjs +23 -1
- package/src/commands/functions/functions-create.mjs +1 -1
- package/src/functions-templates/typescript/hello-world/package-lock.json +6 -6
- package/src/lib/build.mjs +0 -1
- package/src/lib/functions/registry.mjs +0 -1
- package/src/lib/functions/runtimes/rust/index.mjs +1 -1
- package/src/utils/deploy/hash-fns.mjs +0 -1
- package/src/utils/env/index.mjs +14 -1
- package/src/utils/get-repo-data.mjs +6 -5
- package/src/utils/init/node-version.mjs +1 -1
- package/src/utils/proxy.mjs +1 -1
- package/src/utils/state-config.mjs +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "13.
|
|
4
|
+
"version": "13.1.1",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@fastify/static": "^6.6.0",
|
|
79
|
-
"@netlify/build": "^29.6.
|
|
80
|
-
"@netlify/config": "^20.3.
|
|
81
|
-
"@netlify/edge-bundler": "^8.
|
|
82
|
-
"@netlify/framework-info": "^9.8.
|
|
79
|
+
"@netlify/build": "^29.6.6",
|
|
80
|
+
"@netlify/config": "^20.3.4",
|
|
81
|
+
"@netlify/edge-bundler": "^8.11.0",
|
|
82
|
+
"@netlify/framework-info": "^9.8.5",
|
|
83
83
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
84
84
|
"@netlify/zip-it-and-ship-it": "^8.9.0",
|
|
85
85
|
"@octokit/rest": "^19.0.0",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"express-logging": "^1.1.1",
|
|
115
115
|
"extract-zip": "^2.0.1",
|
|
116
116
|
"fastify": "^4.10.2",
|
|
117
|
-
"find-up": "^
|
|
117
|
+
"find-up": "^6.0.0",
|
|
118
118
|
"flush-write-stream": "^2.0.0",
|
|
119
119
|
"folder-walker": "^3.2.0",
|
|
120
120
|
"from2-array": "^0.0.4",
|
|
@@ -138,9 +138,9 @@
|
|
|
138
138
|
"jwt-decode": "^3.0.0",
|
|
139
139
|
"lambda-local": "^2.0.1",
|
|
140
140
|
"listr": "^0.14.3",
|
|
141
|
-
"locate-path": "^
|
|
141
|
+
"locate-path": "^7.0.0",
|
|
142
142
|
"lodash": "^4.17.20",
|
|
143
|
-
"log-symbols": "^
|
|
143
|
+
"log-symbols": "^5.0.0",
|
|
144
144
|
"log-update": "^5.0.0",
|
|
145
145
|
"minimist": "^1.2.5",
|
|
146
146
|
"multiparty": "^4.2.1",
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"netlify-redirector": "^0.4.0",
|
|
152
152
|
"node-fetch": "^2.6.0",
|
|
153
153
|
"node-version-alias": "^2.0.0",
|
|
154
|
-
"ora": "^
|
|
154
|
+
"ora": "^6.0.0",
|
|
155
155
|
"p-filter": "^3.0.0",
|
|
156
156
|
"p-map": "^5.0.0",
|
|
157
157
|
"p-wait-for": "^3.0.0",
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
"tomlify-j0.4": "^3.0.0",
|
|
208
208
|
"tree-kill": "^1.2.2",
|
|
209
209
|
"typescript": "^4.4.4",
|
|
210
|
-
"verdaccio": "^5.
|
|
210
|
+
"verdaccio": "^5.22.1",
|
|
211
211
|
"vite": "^4.0.0",
|
|
212
212
|
"vitest": "^0.29.0"
|
|
213
213
|
},
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
} from '../../utils/command-helpers.mjs'
|
|
32
32
|
import { DEFAULT_DEPLOY_TIMEOUT } from '../../utils/deploy/constants.mjs'
|
|
33
33
|
import { deploySite } from '../../utils/deploy/deploy-site.mjs'
|
|
34
|
+
import { getEnvelopeEnv } from '../../utils/env/index.mjs'
|
|
34
35
|
import { getFunctionsManifestPath, getInternalFunctionsDir } from '../../utils/functions/index.mjs'
|
|
35
36
|
import openBrowser from '../../utils/open-browser.mjs'
|
|
36
37
|
import { link } from '../link/index.mjs'
|
|
@@ -567,6 +568,16 @@ const deploy = async (options, command) => {
|
|
|
567
568
|
return triggerDeploy({ api, options, siteData, siteId })
|
|
568
569
|
}
|
|
569
570
|
|
|
571
|
+
const isUsingEnvelope = siteData && siteData.use_envelope
|
|
572
|
+
// if a context is passed besides dev, we need to pull env vars from that specific context
|
|
573
|
+
if (isUsingEnvelope && options.context && options.context !== 'dev') {
|
|
574
|
+
command.netlify.cachedConfig.env = await getEnvelopeEnv({
|
|
575
|
+
api,
|
|
576
|
+
context: options.context,
|
|
577
|
+
env: command.netlify.cachedConfig.env,
|
|
578
|
+
siteInfo: siteData,
|
|
579
|
+
})
|
|
580
|
+
}
|
|
570
581
|
const { configMutations = [], newConfig } = await handleBuild({
|
|
571
582
|
cachedConfig: command.netlify.cachedConfig,
|
|
572
583
|
options,
|
|
@@ -595,7 +606,18 @@ const deploy = async (options, command) => {
|
|
|
595
606
|
deployFolder,
|
|
596
607
|
functionsFolder,
|
|
597
608
|
})
|
|
598
|
-
|
|
609
|
+
|
|
610
|
+
const siteEnv = isUsingEnvelope
|
|
611
|
+
? await getEnvelopeEnv({
|
|
612
|
+
api,
|
|
613
|
+
context: options.context,
|
|
614
|
+
env: command.netlify.cachedConfig.env,
|
|
615
|
+
raw: true,
|
|
616
|
+
scope: 'functions',
|
|
617
|
+
siteInfo: siteData,
|
|
618
|
+
})
|
|
619
|
+
: get(siteData, 'build_settings.env')
|
|
620
|
+
|
|
599
621
|
const functionsConfig = normalizeFunctionsConfig({
|
|
600
622
|
functionsConfig: config.functions,
|
|
601
623
|
projectRoot: site.root,
|
|
@@ -9,7 +9,7 @@ import { fileURLToPath, pathToFileURL } from 'url'
|
|
|
9
9
|
import { promisify } from 'util'
|
|
10
10
|
|
|
11
11
|
import copyTemplateDirOriginal from 'copy-template-dir'
|
|
12
|
-
import findUp from 'find-up'
|
|
12
|
+
import { findUp } from 'find-up'
|
|
13
13
|
import fuzzy from 'fuzzy'
|
|
14
14
|
import inquirer from 'inquirer'
|
|
15
15
|
import inquirerAutocompletePrompt from 'inquirer-autocomplete-prompt'
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"node_modules/@types/node": {
|
|
29
|
-
"version": "14.18.
|
|
30
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
31
|
-
"integrity": "sha512-
|
|
29
|
+
"version": "14.18.37",
|
|
30
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.37.tgz",
|
|
31
|
+
"integrity": "sha512-7GgtHCs/QZrBrDzgIJnQtuSvhFSwhyYSI2uafSwZoNt1iOGhEN5fwNrQMjtONyHm9+/LoA4453jH0CMYcr06Pg=="
|
|
32
32
|
},
|
|
33
33
|
"node_modules/is-promise": {
|
|
34
34
|
"version": "4.0.0",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"@types/node": {
|
|
61
|
-
"version": "14.18.
|
|
62
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.
|
|
63
|
-
"integrity": "sha512-
|
|
61
|
+
"version": "14.18.37",
|
|
62
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.37.tgz",
|
|
63
|
+
"integrity": "sha512-7GgtHCs/QZrBrDzgIJnQtuSvhFSwhyYSI2uafSwZoNt1iOGhEN5fwNrQMjtONyHm9+/LoA4453jH0CMYcr06Pg=="
|
|
64
64
|
},
|
|
65
65
|
"is-promise": {
|
|
66
66
|
"version": "4.0.0",
|
package/src/lib/build.mjs
CHANGED
|
@@ -194,7 +194,6 @@ export class FunctionsRegistry {
|
|
|
194
194
|
const functions = await this.listFunctions(directories, {
|
|
195
195
|
featureFlags: {
|
|
196
196
|
buildRustSource: env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE === 'true',
|
|
197
|
-
project_deploy_configuration_api_use_per_function_configuration_files: true,
|
|
198
197
|
},
|
|
199
198
|
configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
|
|
200
199
|
config: this.config.functions,
|
|
@@ -3,7 +3,7 @@ import { readFile } from 'fs/promises'
|
|
|
3
3
|
import { dirname, extname, join, resolve } from 'path'
|
|
4
4
|
import { platform } from 'process'
|
|
5
5
|
|
|
6
|
-
import findUp from 'find-up'
|
|
6
|
+
import { findUp } from 'find-up'
|
|
7
7
|
import toml from 'toml'
|
|
8
8
|
|
|
9
9
|
import execa from '../../../../utils/execa.mjs'
|
|
@@ -69,7 +69,6 @@ const getFunctionZips = async ({
|
|
|
69
69
|
const { zipFunctions } = await import('@netlify/zip-it-and-ship-it')
|
|
70
70
|
|
|
71
71
|
return await zipFunctions(directories, tmpDir, {
|
|
72
|
-
featureFlags: { project_deploy_configuration_api_use_per_function_configuration_files: true },
|
|
73
72
|
basePath: rootDir,
|
|
74
73
|
configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
|
|
75
74
|
config: functionsConfig,
|
package/src/utils/env/index.mjs
CHANGED
|
@@ -131,11 +131,12 @@ export const formatEnvelopeData = ({ context = 'dev', envelopeItems = [], scope
|
|
|
131
131
|
* @param {string} context - The deploy context or branch of the environment variable
|
|
132
132
|
* @param {object} env - The dictionary of environment variables
|
|
133
133
|
* @param {string} key - If present, fetch a single key (case-sensitive)
|
|
134
|
+
* @param {boolean} raw - Return a dictionary of raw key/value pairs for only the account and site sources
|
|
134
135
|
* @param {enum<any,builds,functions,runtime,post_processing>} scope - The scope of the environment variables
|
|
135
136
|
* @param {object} siteInfo - The site object
|
|
136
137
|
* @returns {object} An object of environment variables keys and their metadata
|
|
137
138
|
*/
|
|
138
|
-
export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', scope = 'any', siteInfo }) => {
|
|
139
|
+
export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', raw = false, scope = 'any', siteInfo }) => {
|
|
139
140
|
const { account_slug: accountId, id: siteId } = siteInfo
|
|
140
141
|
|
|
141
142
|
const [accountEnvelopeItems, siteEnvelopeItems] = await Promise.all([
|
|
@@ -145,6 +146,18 @@ export const getEnvelopeEnv = async ({ api, context = 'dev', env, key = '', scop
|
|
|
145
146
|
|
|
146
147
|
const accountEnv = formatEnvelopeData({ context, envelopeItems: accountEnvelopeItems, scope, source: 'account' })
|
|
147
148
|
const siteEnv = formatEnvelopeData({ context, envelopeItems: siteEnvelopeItems, scope, source: 'ui' })
|
|
149
|
+
|
|
150
|
+
if (raw) {
|
|
151
|
+
const entries = Object.entries({ ...accountEnv, ...siteEnv })
|
|
152
|
+
return entries.reduce(
|
|
153
|
+
(obj, [envVarKey, metadata]) => ({
|
|
154
|
+
...obj,
|
|
155
|
+
[envVarKey]: metadata.value,
|
|
156
|
+
}),
|
|
157
|
+
{},
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
148
161
|
const generalEnv = filterEnvBySource(env, 'general')
|
|
149
162
|
const internalEnv = filterEnvBySource(env, 'internal')
|
|
150
163
|
const addonsEnv = filterEnvBySource(env, 'addons')
|
|
@@ -3,7 +3,7 @@ import { dirname } from 'path'
|
|
|
3
3
|
import process from 'process'
|
|
4
4
|
import util from 'util'
|
|
5
5
|
|
|
6
|
-
import findUp from 'find-up'
|
|
6
|
+
import { findUp } from 'find-up'
|
|
7
7
|
import gitRepoInfo from 'git-repo-info'
|
|
8
8
|
import gitconfiglocal from 'gitconfiglocal'
|
|
9
9
|
import parseGitRemote from 'parse-github-url'
|
|
@@ -23,16 +23,17 @@ const getRepoData = async function ({ remoteName } = {}) {
|
|
|
23
23
|
util.promisify(gitconfiglocal)(cwd),
|
|
24
24
|
findUp('.git', { cwd, type: 'directory' }),
|
|
25
25
|
])
|
|
26
|
+
|
|
27
|
+
if (!gitDirectory || !gitConfig || !gitConfig.remote || Object.keys(gitConfig.remote).length === 0) {
|
|
28
|
+
throw new Error('No Git remote found')
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
const baseGitPath = dirname(gitDirectory)
|
|
27
32
|
|
|
28
33
|
if (cwd !== baseGitPath) {
|
|
29
34
|
log(`Git directory located in ${baseGitPath}`)
|
|
30
35
|
}
|
|
31
36
|
|
|
32
|
-
if (!gitConfig || !gitConfig.remote || Object.keys(gitConfig.remote).length === 0) {
|
|
33
|
-
throw new Error('No Git remote found')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
37
|
if (!remoteName) {
|
|
37
38
|
const remotes = Object.keys(gitConfig.remote)
|
|
38
39
|
remoteName = remotes.find((remote) => remote === 'origin') || remotes[0]
|
package/src/utils/proxy.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import getAvailablePort from 'get-port'
|
|
|
17
17
|
import httpProxy from 'http-proxy'
|
|
18
18
|
import { createProxyMiddleware } from 'http-proxy-middleware'
|
|
19
19
|
import jwtDecode from 'jwt-decode'
|
|
20
|
-
import locatePath from 'locate-path'
|
|
20
|
+
import { locatePath } from 'locate-path'
|
|
21
21
|
import pFilter from 'p-filter'
|
|
22
22
|
import toReadableStream from 'to-readable-stream'
|
|
23
23
|
|
|
@@ -3,7 +3,7 @@ import path from 'path'
|
|
|
3
3
|
import process from 'process'
|
|
4
4
|
|
|
5
5
|
import dotProp from 'dot-prop'
|
|
6
|
-
import
|
|
6
|
+
import { findUpSync } from 'find-up'
|
|
7
7
|
import writeFileAtomic from 'write-file-atomic'
|
|
8
8
|
|
|
9
9
|
import { getPathInProject } from '../lib/settings.mjs'
|
|
@@ -13,7 +13,7 @@ const permissionError = "You don't have access to this file."
|
|
|
13
13
|
|
|
14
14
|
// Finds location of `.netlify/state.json`
|
|
15
15
|
const findStatePath = (cwd) => {
|
|
16
|
-
const statePath =
|
|
16
|
+
const statePath = findUpSync([STATE_PATH], { cwd })
|
|
17
17
|
|
|
18
18
|
if (!statePath) {
|
|
19
19
|
return path.join(cwd, STATE_PATH)
|