netlify-cli 12.9.2 → 12.11.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.9.2",
4
+ "version": "12.11.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",
@@ -149,7 +149,7 @@
149
149
  "netlify-redirect-parser": "^14.1.1",
150
150
  "netlify-redirector": "^0.4.0",
151
151
  "node-fetch": "^2.6.0",
152
- "node-version-alias": "^1.0.1",
152
+ "node-version-alias": "^2.0.0",
153
153
  "ora": "^5.0.0",
154
154
  "p-filter": "^2.1.0",
155
155
  "p-map": "^4.0.0",
@@ -167,7 +167,7 @@
167
167
  "string-similarity": "^4.0.4",
168
168
  "strip-ansi-control-characters": "^2.0.0",
169
169
  "tabtab": "^3.0.2",
170
- "tempy": "^1.0.0",
170
+ "tempy": "^3.0.0",
171
171
  "terminal-link": "^2.1.1",
172
172
  "through2-filter": "^3.0.0",
173
173
  "through2-map": "^3.0.0",
@@ -183,13 +183,13 @@
183
183
  "devDependencies": {
184
184
  "@babel/preset-react": "^7.12.13",
185
185
  "@netlify/eslint-config-node": "^7.0.0",
186
- "@vitest/coverage-c8": "^0.27.0",
186
+ "@vitest/coverage-c8": "^0.28.0",
187
187
  "ava": "^4.0.0",
188
188
  "c8": "^7.11.0",
189
189
  "eslint-plugin-sort-destructure-keys": "^1.3.5",
190
190
  "fast-glob": "^3.2.7",
191
191
  "form-data": "^4.0.0",
192
- "got": "^11.8.1",
192
+ "got": "^11.8.6",
193
193
  "graphviz": "^0.0.9",
194
194
  "husky": "^8.0.0",
195
195
  "ini": "^2.0.0",
@@ -199,14 +199,14 @@
199
199
  "rewiremock": "^3.14.3",
200
200
  "serialize-javascript": "^6.0.0",
201
201
  "sinon": "^14.0.0",
202
- "strip-ansi": "^6.0.0",
202
+ "strip-ansi": "^7.0.0",
203
203
  "temp-dir": "^2.0.0",
204
204
  "tomlify-j0.4": "^3.0.0",
205
205
  "tree-kill": "^1.2.2",
206
206
  "typescript": "^4.4.4",
207
207
  "verdaccio": "^5.10.2",
208
208
  "vite": "^4.0.0",
209
- "vitest": "^0.27.0"
209
+ "vitest": "^0.28.0"
210
210
  },
211
211
  "ava": {
212
212
  "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,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
  ) => {
@@ -56,7 +56,7 @@ export const deploySite = async (
56
56
  })
57
57
 
58
58
  const edgeFunctionsDistPath = await getDistPathIfExists({ rootDir })
59
- const [{ files, filesShaMap }, { fnShaMap, functionSchedules, functions, functionsWithNativeModules }] =
59
+ const [{ files, filesShaMap }, { fnConfig, fnShaMap, functionSchedules, functions, functionsWithNativeModules }] =
60
60
  await Promise.all([
61
61
  hashFiles({
62
62
  assetType,
@@ -125,6 +125,7 @@ For more information, visit https://ntl.fyi/cli-native-modules.`)
125
125
  files,
126
126
  functions,
127
127
  function_schedules: functionSchedules,
128
+ functions_config: fnConfig,
128
129
  async: Object.keys(files).length > syncFileLimit,
129
130
  branch,
130
131
  draft,
@@ -5,6 +5,9 @@ import { promisify } from 'util'
5
5
  import fromArray from 'from2-array'
6
6
  import pumpModule from 'pump'
7
7
 
8
+ import { getPathInProject } from '../../lib/settings.mjs'
9
+ import { INTERNAL_FUNCTIONS_FOLDER } from '../functions/functions.mjs'
10
+
8
11
  import { hasherCtor, manifestCollectorCtor } from './hasher-segments.mjs'
9
12
 
10
13
  const pump = promisify(pumpModule)
@@ -65,7 +68,12 @@ const getFunctionZips = async ({
65
68
 
66
69
  const { zipFunctions } = await import('@netlify/zip-it-and-ship-it')
67
70
 
68
- return await zipFunctions(directories, tmpDir, { basePath: rootDir, config: functionsConfig })
71
+ return await zipFunctions(directories, tmpDir, {
72
+ featureFlags: { project_deploy_configuration_api_use_per_function_configuration_files: true },
73
+ basePath: rootDir,
74
+ configFileDirectories: [getPathInProject([INTERNAL_FUNCTIONS_FOLDER])],
75
+ config: functionsConfig,
76
+ })
69
77
  }
70
78
 
71
79
  const hashFns = async (
@@ -100,7 +108,7 @@ const hashFns = async (
100
108
  statusCb,
101
109
  tmpDir,
102
110
  })
103
- const fileObjs = functionZips.map(({ path: functionPath, runtime }) => ({
111
+ const fileObjs = functionZips.map(({ displayName, path: functionPath, runtime }) => ({
104
112
  filepath: functionPath,
105
113
  root: tmpDir,
106
114
  relname: path.relative(tmpDir, functionPath),
@@ -110,7 +118,11 @@ const hashFns = async (
110
118
  assetType: 'function',
111
119
  normalizedPath: path.basename(functionPath, path.extname(functionPath)),
112
120
  runtime,
121
+ displayName,
113
122
  }))
123
+ const fnConfig = functionZips
124
+ .filter((func) => Boolean(func.displayName))
125
+ .reduce((funcs, curr) => ({ ...funcs, [curr.name]: { display_name: curr.displayName } }), {})
114
126
  const functionSchedules = functionZips
115
127
  .map(({ name, schedule }) => schedule && { name, cron: schedule })
116
128
  .filter(Boolean)
@@ -130,8 +142,7 @@ const hashFns = async (
130
142
  const manifestCollector = manifestCollectorCtor(functions, fnShaMap, { statusCb, assetType })
131
143
 
132
144
  await pump(functionStream, hasher, manifestCollector)
133
-
134
- return { functionSchedules, functions, functionsWithNativeModules, fnShaMap }
145
+ return { functionSchedules, functions, functionsWithNativeModules, fnShaMap, fnConfig }
135
146
  }
136
147
 
137
148
  export default hashFns
@@ -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
  }