netlify-cli 8.15.1 → 8.15.2

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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "8.15.1",
3
+ "version": "8.15.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "8.15.1",
9
+ "version": "8.15.2",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "8.15.1",
4
+ "version": "8.15.2",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
@@ -156,7 +156,7 @@ const functionsInvoke = async (nameArgument, options, command) => {
156
156
  console.warn(`${NETLIFYDEVWARN} "port" flag was not specified. Attempting to connect to localhost:8888 by default`)
157
157
  const port = options.port || DEFAULT_PORT
158
158
 
159
- const functions = await getFunctions(functionsDir)
159
+ const functions = await getFunctions(functionsDir, config)
160
160
  const functionToTrigger = await getNameFromArgs(functions, options, nameArgument)
161
161
  const functionObj = functions.find((func) => func.name === functionToTrigger)
162
162
 
@@ -11,4 +11,4 @@ http = "0.2.6"
11
11
  lambda_runtime = "0.4.1"
12
12
  log = "0.4.14"
13
13
  simple_logger = "1.16.0"
14
- tokio = "1.15.0"
14
+ tokio = "1.16.1"
@@ -13,7 +13,14 @@ const addFunctionProps = ({ mainFile, name, runtime, schedule }) => {
13
13
 
14
14
  const JS = 'js'
15
15
 
16
- const getFunctions = async (functionsSrcDir) => {
16
+ /**
17
+ * @param {Record<string, { schedule?: string }>} functionConfigRecord
18
+ * @returns {Record<string, { schedule?: string }>}
19
+ */
20
+ const extractSchedule = (functionConfigRecord) =>
21
+ Object.fromEntries(Object.entries(functionConfigRecord).map(([name, { schedule }]) => [name, { schedule }]))
22
+
23
+ const getFunctions = async (functionsSrcDir, config = {}) => {
17
24
  if (!(await fileExistsAsync(functionsSrcDir))) {
18
25
  return []
19
26
  }
@@ -22,6 +29,7 @@ const getFunctions = async (functionsSrcDir) => {
22
29
  // eslint-disable-next-line node/global-require
23
30
  const { listFunctions } = require('@netlify/zip-it-and-ship-it')
24
31
  const functions = await listFunctions(functionsSrcDir, {
32
+ config: config.functions ? extractSchedule(config.functions) : undefined,
25
33
  parseISC: true,
26
34
  })
27
35
  const functionsWithProps = functions.filter(({ runtime }) => runtime === JS).map((func) => addFunctionProps(func))
@@ -123,8 +123,8 @@ const getPromptInputs = async ({
123
123
  .map(({ name }) => `${name} plugin`)
124
124
  .map(formatTitle)
125
125
  .join(', ')}${EOL}➡️ OK to install??`,
126
- choices: infos.map(({ name, package }) => ({ name: `${name} plugin`, value: package })),
127
- default: infos.map(({ package }) => package),
126
+ choices: infos.map((info) => ({ name: `${info.name} plugin`, value: info.package })),
127
+ default: infos.map((info) => info.package),
128
128
  },
129
129
  ]
130
130
  }