netlify-cli 12.4.0 → 12.5.0
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 +1141 -697
- package/package.json +14 -15
- package/src/commands/env/env-list.mjs +10 -0
- package/src/lib/edge-functions/internal.mjs +1 -34
- package/src/lib/edge-functions/proxy.mjs +4 -2
- package/src/lib/fs.cjs +1 -33
- package/src/utils/deploy/deploy-site.mjs +3 -2
- package/src/utils/detect-server-settings.mjs +4 -5
- package/src/utils/lm/install.mjs +4 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
3
|
"description": "Netlify command line tool",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.5.0",
|
|
5
5
|
"author": "Netlify Inc.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"contributors": [
|
|
@@ -150,9 +150,9 @@
|
|
|
150
150
|
"cesare soldini <cesare.soldini@gmail.com>",
|
|
151
151
|
"chris (fool) mccraw (http://twitter.com/fool)",
|
|
152
152
|
"dustincrogers",
|
|
153
|
+
"eddie",
|
|
153
154
|
"ehmicky (https://twitter.com/ehmicky)",
|
|
154
155
|
"internal tools netlibot",
|
|
155
|
-
"just toby",
|
|
156
156
|
"kvn-shn",
|
|
157
157
|
"netlibot (https://www.netlify.com)",
|
|
158
158
|
"nikoladev",
|
|
@@ -211,7 +211,7 @@
|
|
|
211
211
|
"test:init:eleventy-deps": "npm ci --prefix tests/integration/eleventy-site --no-audit",
|
|
212
212
|
"test:init:hugo-deps": "npm ci --prefix tests/integration/hugo-site --no-audit",
|
|
213
213
|
"test:dev:ava": "ava --verbose",
|
|
214
|
-
"test:dev:vitest": "vitest run",
|
|
214
|
+
"test:dev:vitest": "vitest run tests/unit/ && vitest run tests/integration",
|
|
215
215
|
"test:ci:ava:integration": "c8 -r json ava --concurrency 1 --no-worker-threads tests/integration/",
|
|
216
216
|
"test:ci:vitest:unit": "vitest run --coverage tests/unit/",
|
|
217
217
|
"test:ci:vitest:integration": "vitest run --coverage --no-threads tests/integration/",
|
|
@@ -230,12 +230,12 @@
|
|
|
230
230
|
"prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
|
|
231
231
|
},
|
|
232
232
|
"dependencies": {
|
|
233
|
-
"@netlify/build": "^29.
|
|
234
|
-
"@netlify/config": "^20.0
|
|
235
|
-
"@netlify/edge-bundler": "^
|
|
236
|
-
"@netlify/framework-info": "^9.5.
|
|
233
|
+
"@netlify/build": "^29.2.2",
|
|
234
|
+
"@netlify/config": "^20.2.0",
|
|
235
|
+
"@netlify/edge-bundler": "^8.0.0",
|
|
236
|
+
"@netlify/framework-info": "^9.5.3",
|
|
237
237
|
"@netlify/local-functions-proxy": "^1.1.1",
|
|
238
|
-
"@netlify/zip-it-and-ship-it": "^8.
|
|
238
|
+
"@netlify/zip-it-and-ship-it": "^8.2.0",
|
|
239
239
|
"@octokit/rest": "^19.0.0",
|
|
240
240
|
"ansi-escapes": "^5.0.0",
|
|
241
241
|
"ansi-styles": "^5.0.0",
|
|
@@ -257,7 +257,6 @@
|
|
|
257
257
|
"cron-parser": "^4.2.1",
|
|
258
258
|
"debug": "^4.1.1",
|
|
259
259
|
"decache": "^4.6.0",
|
|
260
|
-
"del": "^6.0.0",
|
|
261
260
|
"dot-prop": "^6.0.0",
|
|
262
261
|
"dotenv": "^16.0.0",
|
|
263
262
|
"env-paths": "^2.2.0",
|
|
@@ -296,10 +295,10 @@
|
|
|
296
295
|
"log-update": "^5.0.0",
|
|
297
296
|
"minimist": "^1.2.5",
|
|
298
297
|
"multiparty": "^4.2.1",
|
|
299
|
-
"netlify": "^13.0
|
|
300
|
-
"netlify-headers-parser": "^7.0
|
|
298
|
+
"netlify": "^13.1.0",
|
|
299
|
+
"netlify-headers-parser": "^7.1.0",
|
|
301
300
|
"netlify-onegraph-internal": "0.10.1",
|
|
302
|
-
"netlify-redirect-parser": "^14.0
|
|
301
|
+
"netlify-redirect-parser": "^14.1.0",
|
|
303
302
|
"netlify-redirector": "^0.3.1",
|
|
304
303
|
"node-fetch": "^2.6.0",
|
|
305
304
|
"node-version-alias": "^1.0.1",
|
|
@@ -337,7 +336,7 @@
|
|
|
337
336
|
"devDependencies": {
|
|
338
337
|
"@babel/preset-react": "^7.12.13",
|
|
339
338
|
"@netlify/eslint-config-node": "^7.0.0",
|
|
340
|
-
"@vitest/coverage-c8": "^0.
|
|
339
|
+
"@vitest/coverage-c8": "^0.26.0",
|
|
341
340
|
"ava": "^4.0.0",
|
|
342
341
|
"c8": "^7.11.0",
|
|
343
342
|
"eslint-plugin-sort-destructure-keys": "^1.3.5",
|
|
@@ -359,8 +358,8 @@
|
|
|
359
358
|
"tree-kill": "^1.2.2",
|
|
360
359
|
"typescript": "^4.4.4",
|
|
361
360
|
"verdaccio": "^5.10.2",
|
|
362
|
-
"vite": "^
|
|
363
|
-
"vitest": "^0.
|
|
361
|
+
"vite": "^4.0.0",
|
|
362
|
+
"vitest": "^0.26.0"
|
|
364
363
|
},
|
|
365
364
|
"ava": {
|
|
366
365
|
"files": [
|
|
@@ -76,6 +76,14 @@ const envList = async (options, command) => {
|
|
|
76
76
|
return false
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
if (options.plain) {
|
|
80
|
+
const plaintext = Object.entries(environment)
|
|
81
|
+
.map(([key, variable]) => `${key}=${variable.value}`)
|
|
82
|
+
.join('\n')
|
|
83
|
+
log(plaintext)
|
|
84
|
+
return false
|
|
85
|
+
}
|
|
86
|
+
|
|
79
87
|
const forSite = `for site ${chalk.green(siteInfo.name)}`
|
|
80
88
|
const contextType = AVAILABLE_CONTEXTS.includes(context) ? 'context' : 'branch'
|
|
81
89
|
const withContext = isUsingEnvelope ? `in the ${chalk.magenta(options.context)} ${contextType}` : ''
|
|
@@ -126,6 +134,7 @@ export const createEnvListCommand = (program) =>
|
|
|
126
134
|
normalizeContext,
|
|
127
135
|
'dev',
|
|
128
136
|
)
|
|
137
|
+
.addOption(new Option('--plain', 'Output environment variables as plaintext').conflicts('json'))
|
|
129
138
|
.addOption(
|
|
130
139
|
new Option('-s, --scope <scope>', 'Specify a scope')
|
|
131
140
|
.choices(['builds', 'functions', 'post-processing', 'runtime', 'any'])
|
|
@@ -136,6 +145,7 @@ export const createEnvListCommand = (program) =>
|
|
|
136
145
|
'netlify env:list --context production',
|
|
137
146
|
'netlify env:list --context branch:staging',
|
|
138
147
|
'netlify env:list --scope functions',
|
|
148
|
+
'netlify env:list --plain',
|
|
139
149
|
])
|
|
140
150
|
.description('Lists resolved environment variables for site (includes netlify.toml)')
|
|
141
151
|
.action(async (options, command) => {
|
|
@@ -2,33 +2,11 @@
|
|
|
2
2
|
import { readFile, stat } from 'fs/promises'
|
|
3
3
|
import { dirname, join, resolve } from 'path'
|
|
4
4
|
import { cwd } from 'process'
|
|
5
|
-
import { pathToFileURL } from 'url'
|
|
6
5
|
|
|
7
|
-
import { warn } from '../../utils/command-helpers.mjs'
|
|
8
6
|
import { getPathInProject } from '../settings.cjs'
|
|
9
7
|
|
|
10
8
|
import { INTERNAL_EDGE_FUNCTIONS_FOLDER } from './consts.mjs'
|
|
11
9
|
|
|
12
|
-
/**
|
|
13
|
-
* Reads an import map from a path and returns the parsed data, if it exists
|
|
14
|
-
* and is valid. Otherwise, it returns null.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} importMapPath
|
|
17
|
-
* @returns {Promise<object | null>}
|
|
18
|
-
*/
|
|
19
|
-
const getImportMap = async (importMapPath) => {
|
|
20
|
-
try {
|
|
21
|
-
const data = await readFile(importMapPath)
|
|
22
|
-
const importMap = JSON.parse(data)
|
|
23
|
-
|
|
24
|
-
return importMap
|
|
25
|
-
} catch {
|
|
26
|
-
warn(`Could not read the import map file for Edge Functions at ${importMapPath}`)
|
|
27
|
-
|
|
28
|
-
return null
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
10
|
export const getInternalFunctions = async () => {
|
|
33
11
|
const path = join(cwd(), getPathInProject([INTERNAL_EDGE_FUNCTIONS_FOLDER]))
|
|
34
12
|
|
|
@@ -59,18 +37,7 @@ export const getInternalFunctions = async () => {
|
|
|
59
37
|
}
|
|
60
38
|
|
|
61
39
|
if (manifest.import_map) {
|
|
62
|
-
|
|
63
|
-
const importMap = await getImportMap(importMapPath)
|
|
64
|
-
|
|
65
|
-
if (importMap !== null) {
|
|
66
|
-
return {
|
|
67
|
-
...data,
|
|
68
|
-
importMap: {
|
|
69
|
-
baseURL: pathToFileURL(importMapPath),
|
|
70
|
-
...importMap,
|
|
71
|
-
},
|
|
72
|
-
}
|
|
73
|
-
}
|
|
40
|
+
data.importMap = resolve(dirname(manifestPath), manifest.import_map)
|
|
74
41
|
}
|
|
75
42
|
|
|
76
43
|
return data
|
|
@@ -160,12 +160,14 @@ const prepareServer = async ({
|
|
|
160
160
|
port,
|
|
161
161
|
projectDir,
|
|
162
162
|
}) => {
|
|
163
|
+
// Merging internal with user-defined import maps.
|
|
164
|
+
const importMapPaths = [...importMaps, config.functions['*'].deno_import_map]
|
|
165
|
+
|
|
163
166
|
try {
|
|
164
167
|
const bundler = await import('@netlify/edge-bundler')
|
|
165
168
|
const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH])
|
|
166
169
|
const runIsolate = await bundler.serve({
|
|
167
170
|
...getDownloadUpdateFunctions(),
|
|
168
|
-
basePath: projectDir,
|
|
169
171
|
certificatePath,
|
|
170
172
|
debug: env.NETLIFY_DENO_DEBUG === 'true',
|
|
171
173
|
distImportMapPath,
|
|
@@ -175,7 +177,7 @@ const prepareServer = async ({
|
|
|
175
177
|
)}. The file does not seem to have a function as the default export.`,
|
|
176
178
|
formatImportError: (name) =>
|
|
177
179
|
`${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`,
|
|
178
|
-
|
|
180
|
+
importMapPaths,
|
|
179
181
|
inspectSettings,
|
|
180
182
|
port,
|
|
181
183
|
})
|
package/src/lib/fs.cjs
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
const {
|
|
3
3
|
constants,
|
|
4
|
-
promises: { access,
|
|
4
|
+
promises: { access, stat },
|
|
5
5
|
} = require('fs')
|
|
6
|
-
const { version } = require('process')
|
|
7
|
-
|
|
8
|
-
const del = require('del')
|
|
9
|
-
const { gte, parse } = require('semver')
|
|
10
|
-
|
|
11
|
-
const NODE_VERSION = parse(version)
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* reads a file async and catches potential errors
|
|
15
|
-
* @param {string} filePath
|
|
16
|
-
*/
|
|
17
|
-
const readFileAsyncCatchError = async (filePath) => {
|
|
18
|
-
try {
|
|
19
|
-
return { content: await readFile(filePath, 'utf-8') }
|
|
20
|
-
} catch (error) {
|
|
21
|
-
return { error }
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
6
|
|
|
25
7
|
const fileExistsAsync = async (filePath) => {
|
|
26
8
|
try {
|
|
@@ -31,18 +13,6 @@ const fileExistsAsync = async (filePath) => {
|
|
|
31
13
|
}
|
|
32
14
|
}
|
|
33
15
|
|
|
34
|
-
/**
|
|
35
|
-
* Removes a directory recursively and async
|
|
36
|
-
* @param {string} path
|
|
37
|
-
* @returns {Promise<void>}
|
|
38
|
-
*/
|
|
39
|
-
const rmdirRecursiveAsync = async (path) => {
|
|
40
|
-
if (gte(NODE_VERSION, '14.14.0')) {
|
|
41
|
-
return await rm(path, { force: true, recursive: true })
|
|
42
|
-
}
|
|
43
|
-
await del(path, { force: true })
|
|
44
|
-
}
|
|
45
|
-
|
|
46
16
|
/**
|
|
47
17
|
* calls stat async with a function and catches potential errors
|
|
48
18
|
* @param {string} filePath
|
|
@@ -78,6 +48,4 @@ module.exports = {
|
|
|
78
48
|
fileExistsAsync,
|
|
79
49
|
isDirectoryAsync,
|
|
80
50
|
isFileAsync,
|
|
81
|
-
readFileAsyncCatchError,
|
|
82
|
-
rmdirRecursiveAsync,
|
|
83
51
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { rm } from 'fs/promises'
|
|
2
|
+
|
|
1
3
|
import cleanDeep from 'clean-deep'
|
|
2
4
|
import tempy from 'tempy'
|
|
3
5
|
|
|
4
6
|
import { deployFileNormalizer, getDistPathIfExists, isEdgeFunctionFile } from '../../lib/edge-functions/deploy.mjs'
|
|
5
|
-
import { rmdirRecursiveAsync } from '../../lib/fs.cjs'
|
|
6
7
|
import { warn } from '../command-helpers.mjs'
|
|
7
8
|
|
|
8
9
|
import {
|
|
@@ -170,7 +171,7 @@ For more information, visit https://ntl.fyi/cli-native-modules.`)
|
|
|
170
171
|
phase: 'stop',
|
|
171
172
|
})
|
|
172
173
|
|
|
173
|
-
await
|
|
174
|
+
await rm(tmpDir, { force: true, recursive: true })
|
|
174
175
|
|
|
175
176
|
const deployManifest = {
|
|
176
177
|
deployId,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
import { readFile } from 'fs/promises'
|
|
2
3
|
import { EOL } from 'os'
|
|
3
4
|
import path from 'path'
|
|
4
5
|
import process from 'process'
|
|
@@ -8,8 +9,6 @@ import fuzzy from 'fuzzy'
|
|
|
8
9
|
import getPort from 'get-port'
|
|
9
10
|
import isPlainObject from 'is-plain-obj'
|
|
10
11
|
|
|
11
|
-
import { readFileAsyncCatchError } from '../lib/fs.cjs'
|
|
12
|
-
|
|
13
12
|
import { NETLIFYDEVWARN, chalk, log } from './command-helpers.mjs'
|
|
14
13
|
import { acquirePort } from './dev.mjs'
|
|
15
14
|
import { getInternalFunctionsDir } from './functions/index.mjs'
|
|
@@ -34,9 +33,9 @@ const readHttpsSettings = async (options) => {
|
|
|
34
33
|
throw new TypeError(`Certificate file configuration should be a string`)
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
const [{
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const [{ reason: keyError, value: key }, { reason: certError, value: cert }] = await Promise.allSettled([
|
|
37
|
+
readFile(keyFile, 'utf-8'),
|
|
38
|
+
readFile(certFile, 'utf-8'),
|
|
40
39
|
])
|
|
41
40
|
|
|
42
41
|
if (keyError) {
|
package/src/utils/lm/install.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { appendFile, copyFile, readFile, writeFile } from 'fs/promises'
|
|
2
|
+
import { appendFile, copyFile, readFile, rm, writeFile } from 'fs/promises'
|
|
3
3
|
import os from 'os'
|
|
4
4
|
import path, { dirname } from 'path'
|
|
5
5
|
import process from 'process'
|
|
@@ -11,7 +11,7 @@ import Listr from 'listr'
|
|
|
11
11
|
import pathKey from 'path-key'
|
|
12
12
|
|
|
13
13
|
import { fetchLatestVersion, shouldFetchLatestVersion } from '../../lib/exec-fetcher.mjs'
|
|
14
|
-
import { fileExistsAsync
|
|
14
|
+
import { fileExistsAsync } from '../../lib/fs.cjs'
|
|
15
15
|
import { normalizeBackslash } from '../../lib/path.mjs'
|
|
16
16
|
import { getLegacyPathInHome, getPathInHome } from '../../lib/settings.cjs'
|
|
17
17
|
import { chalk } from '../command-helpers.mjs'
|
|
@@ -92,7 +92,7 @@ const installedWithPackageManager = async function () {
|
|
|
92
92
|
|
|
93
93
|
const installHelper = async function () {
|
|
94
94
|
// remove any old versions that might still exist in `~/.netlify/helper/bin`
|
|
95
|
-
await
|
|
95
|
+
await rm(getLegacyBinPath(), { force: true, recursive: true })
|
|
96
96
|
const binPath = getBinPath()
|
|
97
97
|
const shouldFetch = await shouldFetchLatestVersion({
|
|
98
98
|
binPath,
|
|
@@ -277,7 +277,7 @@ const cleanupShell = async function () {
|
|
|
277
277
|
|
|
278
278
|
export const uninstall = async function () {
|
|
279
279
|
await Promise.all([
|
|
280
|
-
|
|
280
|
+
rm(getHelperPath(), { force: true, recursive: true }),
|
|
281
281
|
removeConfig(GIT_CONFIG, getGitConfigContent(getGitConfigPath())),
|
|
282
282
|
cleanupShell(),
|
|
283
283
|
])
|