netlify-cli 12.10.0 → 12.12.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "12.10.0",
4
+ "version": "12.12.0",
5
5
  "author": "Netlify Inc.",
6
6
  "type": "module",
7
7
  "engines": {
@@ -76,12 +76,12 @@
76
76
  },
77
77
  "dependencies": {
78
78
  "@fastify/static": "^6.6.0",
79
- "@netlify/build": "^29.5.2",
80
- "@netlify/config": "^20.3.2",
79
+ "@netlify/build": "^29.5.5",
80
+ "@netlify/config": "^20.3.3",
81
81
  "@netlify/edge-bundler": "^8.4.0",
82
- "@netlify/framework-info": "^9.7.1",
82
+ "@netlify/framework-info": "^9.8.1",
83
83
  "@netlify/local-functions-proxy": "^1.1.1",
84
- "@netlify/zip-it-and-ship-it": "^8.4.1",
84
+ "@netlify/zip-it-and-ship-it": "^8.5.0",
85
85
  "@octokit/rest": "^19.0.0",
86
86
  "ansi-escapes": "^5.0.0",
87
87
  "ansi-styles": "^5.0.0",
@@ -95,6 +95,7 @@
95
95
  "ci-info": "^3.0.0",
96
96
  "clean-deep": "^3.0.2",
97
97
  "commander": "^9.2.0",
98
+ "comment-json": "^4.2.3",
98
99
  "concordance": "^5.0.0",
99
100
  "configstore": "^5.0.0",
100
101
  "content-type": "^1.0.4",
@@ -149,7 +150,7 @@
149
150
  "netlify-redirect-parser": "^14.1.1",
150
151
  "netlify-redirector": "^0.4.0",
151
152
  "node-fetch": "^2.6.0",
152
- "node-version-alias": "^1.0.1",
153
+ "node-version-alias": "^2.0.0",
153
154
  "ora": "^5.0.0",
154
155
  "p-filter": "^2.1.0",
155
156
  "p-map": "^4.0.0",
@@ -167,7 +168,7 @@
167
168
  "string-similarity": "^4.0.4",
168
169
  "strip-ansi-control-characters": "^2.0.0",
169
170
  "tabtab": "^3.0.2",
170
- "tempy": "^1.0.0",
171
+ "tempy": "^3.0.0",
171
172
  "terminal-link": "^2.1.1",
172
173
  "through2-filter": "^3.0.0",
173
174
  "through2-map": "^3.0.0",
@@ -183,13 +184,13 @@
183
184
  "devDependencies": {
184
185
  "@babel/preset-react": "^7.12.13",
185
186
  "@netlify/eslint-config-node": "^7.0.0",
186
- "@vitest/coverage-c8": "^0.27.0",
187
+ "@vitest/coverage-c8": "^0.28.0",
187
188
  "ava": "^4.0.0",
188
189
  "c8": "^7.11.0",
189
190
  "eslint-plugin-sort-destructure-keys": "^1.3.5",
190
191
  "fast-glob": "^3.2.7",
191
192
  "form-data": "^4.0.0",
192
- "got": "^11.8.1",
193
+ "got": "^11.8.6",
193
194
  "graphviz": "^0.0.9",
194
195
  "husky": "^8.0.0",
195
196
  "ini": "^2.0.0",
@@ -199,14 +200,14 @@
199
200
  "rewiremock": "^3.14.3",
200
201
  "serialize-javascript": "^6.0.0",
201
202
  "sinon": "^14.0.0",
202
- "strip-ansi": "^6.0.0",
203
+ "strip-ansi": "^7.0.0",
203
204
  "temp-dir": "^2.0.0",
204
205
  "tomlify-j0.4": "^3.0.0",
205
206
  "tree-kill": "^1.2.2",
206
207
  "typescript": "^4.4.4",
207
208
  "verdaccio": "^5.10.2",
208
209
  "vite": "^4.0.0",
209
- "vitest": "^0.27.0"
210
+ "vitest": "^0.28.0"
210
211
  },
211
212
  "ava": {
212
213
  "files": [
@@ -13,9 +13,9 @@
13
13
  }
14
14
  },
15
15
  "node_modules/node-fetch": {
16
- "version": "2.6.8",
17
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.8.tgz",
18
- "integrity": "sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==",
16
+ "version": "2.6.9",
17
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz",
18
+ "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==",
19
19
  "dependencies": {
20
20
  "whatwg-url": "^5.0.0"
21
21
  },
@@ -53,9 +53,9 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "node-fetch": {
56
- "version": "2.6.8",
57
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.8.tgz",
58
- "integrity": "sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==",
56
+ "version": "2.6.9",
57
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz",
58
+ "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==",
59
59
  "requires": {
60
60
  "whatwg-url": "^5.0.0"
61
61
  }
@@ -17,9 +17,9 @@
17
17
  }
18
18
  },
19
19
  "node_modules/node-fetch": {
20
- "version": "2.6.8",
21
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.8.tgz",
22
- "integrity": "sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==",
20
+ "version": "2.6.9",
21
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz",
22
+ "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==",
23
23
  "dependencies": {
24
24
  "whatwg-url": "^5.0.0"
25
25
  },
@@ -65,9 +65,9 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "node-fetch": {
68
- "version": "2.6.8",
69
- "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.8.tgz",
70
- "integrity": "sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==",
68
+ "version": "2.6.9",
69
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz",
70
+ "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==",
71
71
  "requires": {
72
72
  "whatwg-url": "^5.0.0"
73
73
  }
@@ -19,9 +19,9 @@
19
19
  "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
20
20
  },
21
21
  "node_modules/axios": {
22
- "version": "1.2.3",
23
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.3.tgz",
24
- "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==",
22
+ "version": "1.2.6",
23
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.6.tgz",
24
+ "integrity": "sha512-rC/7F08XxZwjMV4iuWv+JpD3E0Ksqg9nac4IIg6RwNuF0JTeWoCo/mBNG54+tNhhI11G3/VDRbdDQTs9hGp4pQ==",
25
25
  "dependencies": {
26
26
  "follow-redirects": "^1.15.0",
27
27
  "form-data": "^4.0.0",
@@ -198,9 +198,9 @@
198
198
  "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
199
199
  },
200
200
  "axios": {
201
- "version": "1.2.3",
202
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.3.tgz",
203
- "integrity": "sha512-pdDkMYJeuXLZ6Xj/Q5J3Phpe+jbGdsSzlQaFVkMQzRUL05+6+tetX8TV3p4HrU4kzuO9bt+io/yGQxuyxA/xcw==",
201
+ "version": "1.2.6",
202
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.2.6.tgz",
203
+ "integrity": "sha512-rC/7F08XxZwjMV4iuWv+JpD3E0Ksqg9nac4IIg6RwNuF0JTeWoCo/mBNG54+tNhhI11G3/VDRbdDQTs9hGp4pQ==",
204
204
  "requires": {
205
205
  "follow-redirects": "^1.15.0",
206
206
  "form-data": "^4.0.0",
@@ -36,9 +36,9 @@
36
36
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
37
37
  },
38
38
  "node_modules/typescript": {
39
- "version": "4.9.4",
40
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz",
41
- "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==",
39
+ "version": "4.9.5",
40
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
41
+ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
42
42
  "bin": {
43
43
  "tsc": "bin/tsc",
44
44
  "tsserver": "bin/tsserver"
@@ -68,9 +68,9 @@
68
68
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
69
69
  },
70
70
  "typescript": {
71
- "version": "4.9.4",
72
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz",
73
- "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg=="
71
+ "version": "4.9.5",
72
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
73
+ "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g=="
74
74
  }
75
75
  }
76
76
  }
@@ -32,7 +32,7 @@ export const getInternalFunctions = async () => {
32
32
  }
33
33
 
34
34
  const data = {
35
- functions: manifest.functions,
35
+ functions: manifest.functions || [],
36
36
  path,
37
37
  }
38
38
 
@@ -18,6 +18,7 @@ export default class NetlifyFunction {
18
18
  constructor({
19
19
  config,
20
20
  directory,
21
+ displayName,
21
22
  mainFile,
22
23
  name,
23
24
  projectRoot,
@@ -31,6 +32,7 @@ export default class NetlifyFunction {
31
32
  this.errorExit = errorExit
32
33
  this.mainFile = mainFile
33
34
  this.name = name
35
+ this.displayName = displayName
34
36
  this.projectRoot = projectRoot
35
37
  this.runtime = runtime
36
38
  this.timeoutBackground = timeoutBackground
@@ -14,7 +14,7 @@ import {
14
14
  warn,
15
15
  watchDebounced,
16
16
  } from '../../utils/command-helpers.mjs'
17
- import { SERVE_FUNCTIONS_FOLDER } from '../../utils/functions/functions.mjs'
17
+ import { INTERNAL_FUNCTIONS_FOLDER, SERVE_FUNCTIONS_FOLDER } from '../../utils/functions/functions.mjs'
18
18
  import { getLogMessage } from '../log.mjs'
19
19
  import { getPathInProject } from '../settings.mjs'
20
20
 
@@ -164,7 +164,12 @@ export class FunctionsRegistry {
164
164
  this.functions.set(name, func)
165
165
  this.buildFunctionAndWatchFiles(func)
166
166
 
167
- log(`${NETLIFYDEVLOG} ${chalk.green('Loaded')} function ${getTerminalLink(chalk.yellow(name), func.url)}.`)
167
+ log(
168
+ `${NETLIFYDEVLOG} ${chalk.green('Loaded')} function ${getTerminalLink(
169
+ chalk.yellow(func.displayName || name),
170
+ func.url,
171
+ )}.`,
172
+ )
168
173
  }
169
174
 
170
175
  // This function is here so we can mock it in tests
@@ -191,6 +196,7 @@ export class FunctionsRegistry {
191
196
  buildRustSource: env.NETLIFY_EXPERIMENTAL_BUILD_RUST_SOURCE === 'true',
192
197
  project_deploy_configuration_api_use_per_function_configuration_files: true,
193
198
  },
199
+ configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
194
200
  config: this.config.functions,
195
201
  })
196
202
 
@@ -207,7 +213,7 @@ export class FunctionsRegistry {
207
213
  await Promise.all(deletedFunctions.map((func) => this.unregisterFunction(func.name)))
208
214
 
209
215
  await Promise.all(
210
- functions.map(async ({ mainFile, name, runtime: runtimeName }) => {
216
+ functions.map(async ({ displayName, mainFile, name, runtime: runtimeName }) => {
211
217
  const runtime = runtimes[runtimeName]
212
218
 
213
219
  // If there is no matching runtime, it means this function is not yet
@@ -226,6 +232,7 @@ export class FunctionsRegistry {
226
232
  directory: directories.find((directory) => mainFile.startsWith(directory)),
227
233
  mainFile,
228
234
  name,
235
+ displayName,
229
236
  projectRoot: this.projectRoot,
230
237
  runtime,
231
238
  timeoutBackground: this.timeouts.backgroundFunctions,
@@ -2,7 +2,7 @@
2
2
  import { dirname, extname } from 'path'
3
3
  import { platform } from 'process'
4
4
 
5
- import tempy from 'tempy'
5
+ import { temporaryFile } from 'tempy'
6
6
 
7
7
  import execa from '../../../../utils/execa.mjs'
8
8
  import { runFunctionsProxy } from '../../local-proxy.mjs'
@@ -41,7 +41,7 @@ const checkGoInstallation = async ({ cwd }) => {
41
41
 
42
42
  export const getBuildFunction = ({ func }) => {
43
43
  const functionDirectory = dirname(func.mainFile)
44
- const binaryPath = tempy.file(isWindows ? { extension: 'exe' } : undefined)
44
+ const binaryPath = temporaryFile(isWindows ? { extension: 'exe' } : undefined)
45
45
 
46
46
  return () => build({ binaryPath, functionDirectory })
47
47
  }
@@ -1,17 +1,18 @@
1
1
  import { mkdir, readFile, stat, writeFile } from 'fs/promises'
2
2
  import { dirname, relative } from 'path'
3
3
 
4
+ // eslint-disable-next-line import/no-namespace
5
+ import * as JSONC from 'comment-json'
4
6
  import unixify from 'unixify'
5
7
 
6
8
  export const applySettings = (existingSettings, { denoBinary, edgeFunctionsPath, repositoryRoot }) => {
7
9
  const relativeEdgeFunctionsPath = unixify(relative(repositoryRoot, edgeFunctionsPath))
8
- const settings = {
9
- ...existingSettings,
10
+ const settings = JSONC.assign(existingSettings, {
10
11
  'deno.enable': true,
11
12
  'deno.enablePaths': existingSettings['deno.enablePaths'] || [],
12
13
  'deno.unstable': true,
13
14
  'deno.importMap': '.netlify/edge-functions-import-map.json',
14
- }
15
+ })
15
16
 
16
17
  // If the Edge Functions path isn't already in `deno.enabledPaths`, let's add
17
18
  // it.
@@ -38,11 +39,11 @@ export const getSettings = async (settingsPath) => {
38
39
  throw new Error(`${settingsPath} is not a valid file.`)
39
40
  }
40
41
 
41
- const file = await readFile(settingsPath)
42
+ const file = await readFile(settingsPath, 'utf8')
42
43
 
43
44
  return {
44
45
  fileExists: true,
45
- settings: JSON.parse(file),
46
+ settings: JSONC.parse(file),
46
47
  }
47
48
  } catch (error) {
48
49
  if (error.code !== 'ENOENT') {
@@ -57,7 +58,7 @@ export const getSettings = async (settingsPath) => {
57
58
  }
58
59
 
59
60
  export const writeSettings = async ({ settings, settingsPath }) => {
60
- const serializedSettings = JSON.stringify(settings, null, 2)
61
+ const serializedSettings = JSONC.stringify(settings, null, 2)
61
62
 
62
63
  await mkdir(dirname(settingsPath), { recursive: true })
63
64
  await writeFile(settingsPath, serializedSettings)
@@ -1,7 +1,7 @@
1
1
  import { rm } from 'fs/promises'
2
2
 
3
3
  import cleanDeep from 'clean-deep'
4
- import tempy from 'tempy'
4
+ import { temporaryDirectory } from 'tempy'
5
5
 
6
6
  import { deployFileNormalizer, getDistPathIfExists, isEdgeFunctionFile } from '../../lib/edge-functions/deploy.mjs'
7
7
  import { warn } from '../command-helpers.mjs'
@@ -45,7 +45,7 @@ export const deploySite = async (
45
45
  /* default to noop */
46
46
  },
47
47
  syncFileLimit = DEFAULT_SYNC_LIMIT,
48
- tmpDir = tempy.directory(),
48
+ tmpDir = temporaryDirectory(),
49
49
  rootDir,
50
50
  } = {},
51
51
  ) => {
@@ -1,10 +1,11 @@
1
1
  import { readFile } from 'fs/promises'
2
- import path, { join } from 'path'
2
+ import path from 'path'
3
3
  import { promisify } from 'util'
4
4
 
5
5
  import fromArray from 'from2-array'
6
6
  import pumpModule from 'pump'
7
7
 
8
+ import { getPathInProject } from '../../lib/settings.mjs'
8
9
  import { INTERNAL_FUNCTIONS_FOLDER } from '../functions/functions.mjs'
9
10
 
10
11
  import { hasherCtor, manifestCollectorCtor } from './hasher-segments.mjs'
@@ -70,7 +71,7 @@ const getFunctionZips = async ({
70
71
  return await zipFunctions(directories, tmpDir, {
71
72
  featureFlags: { project_deploy_configuration_api_use_per_function_configuration_files: true },
72
73
  basePath: rootDir,
73
- configFileDirectories: [join('.netlify', INTERNAL_FUNCTIONS_FOLDER)],
74
+ configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
74
75
  config: functionsConfig,
75
76
  })
76
77
  }
@@ -23,7 +23,7 @@ export const waitForDiff = async (api, deployId, siteId, timeout) => {
23
23
  switch (siteDeploy.state) {
24
24
  // https://github.com/netlify/bitballoon/blob/master/app/models/deploy.rb#L21-L33
25
25
  case 'error': {
26
- const deployError = new Error(`Deploy ${deployId} had an error`)
26
+ const deployError = new Error(siteDeploy.error_message || `Deploy ${deployId} had an error`)
27
27
  deployError.deploy = siteDeploy
28
28
  throw deployError
29
29
  }
@@ -60,7 +60,7 @@ export const waitForDeploy = async (api, deployId, siteId, timeout) => {
60
60
  switch (siteDeploy.state) {
61
61
  // https://github.com/netlify/bitballoon/blob/master/app/models/deploy.rb#L21-L33
62
62
  case 'error': {
63
- const deployError = new Error(`Deploy ${deployId} had an error`)
63
+ const deployError = new Error(siteDeploy.error_message || `Deploy ${deployId} had an error`)
64
64
  deployError.deploy = siteDeploy
65
65
  throw deployError
66
66
  }