netlify-cli 8.2.4 → 8.4.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.
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.2.4",
4
+ "version": "8.4.2",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
@@ -78,14 +78,14 @@
78
78
  "prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{js,md,yml,json,html}\" \"*.{js,yml,json,html}\" \".*.{js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!.github/**/*.md\""
79
79
  },
80
80
  "dependencies": {
81
- "@netlify/build": "^26.0.0",
82
- "@netlify/config": "^17.0.1",
81
+ "@netlify/build": "^26.0.2",
82
+ "@netlify/config": "^17.0.2",
83
83
  "@netlify/framework-info": "^7.0.0",
84
84
  "@netlify/local-functions-proxy": "^1.1.1",
85
85
  "@netlify/plugin-edge-handlers": "^3.0.0",
86
86
  "@netlify/plugins-list": "^6.2.0",
87
87
  "@netlify/routing-local-proxy": "^0.34.1",
88
- "@netlify/zip-it-and-ship-it": "5.3.0",
88
+ "@netlify/zip-it-and-ship-it": "5.3.1",
89
89
  "@octokit/rest": "^18.0.0",
90
90
  "@sindresorhus/slugify": "^1.1.0",
91
91
  "ansi-styles": "^5.0.0",
@@ -145,7 +145,7 @@
145
145
  "minimist": "^1.2.5",
146
146
  "mock-require": "^3.0.3",
147
147
  "multiparty": "^4.2.1",
148
- "netlify": "^10.0.0",
148
+ "netlify": "^10.1.0",
149
149
  "netlify-headers-parser": "^6.0.0",
150
150
  "netlify-redirect-parser": "^13.0.0",
151
151
  "netlify-redirector": "^0.2.1",
@@ -176,6 +176,7 @@
176
176
  "strip-ansi-control-characters": "^2.0.0",
177
177
  "tabtab": "^3.0.2",
178
178
  "tempy": "^1.0.0",
179
+ "terminal-link": "^2.1.1",
179
180
  "through2-filter": "^3.0.0",
180
181
  "through2-map": "^3.0.0",
181
182
  "to-readable-stream": "^2.1.0",
@@ -193,7 +194,6 @@
193
194
  "@commitlint/config-conventional": "^15.0.0",
194
195
  "@netlify/eslint-config-node": "^4.0.2",
195
196
  "ava": "^3.15.0",
196
- "eslint-plugin-local-rules": "file:tools/eslint-rules",
197
197
  "eslint-plugin-sort-destructure-keys": "^1.3.5",
198
198
  "fast-glob": "^3.2.7",
199
199
  "form-data": "^4.0.0",
@@ -13,9 +13,9 @@
13
13
  }
14
14
  },
15
15
  "node_modules/@types/node": {
16
- "version": "17.0.1",
17
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.1.tgz",
18
- "integrity": "sha512-NXKvBVUzIbs6ylBwmOwHFkZS2EXCcjnqr8ZCRNaXBkHAf+3mn/rPcJxwrzuc6movh8fxQAsUUfYklJ/EG+hZqQ=="
16
+ "version": "17.0.2",
17
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
18
+ "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA=="
19
19
  },
20
20
  "node_modules/call-bind": {
21
21
  "version": "1.0.2",
@@ -119,9 +119,9 @@
119
119
  },
120
120
  "dependencies": {
121
121
  "@types/node": {
122
- "version": "17.0.1",
123
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.1.tgz",
124
- "integrity": "sha512-NXKvBVUzIbs6ylBwmOwHFkZS2EXCcjnqr8ZCRNaXBkHAf+3mn/rPcJxwrzuc6movh8fxQAsUUfYklJ/EG+hZqQ=="
122
+ "version": "17.0.2",
123
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
124
+ "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA=="
125
125
  },
126
126
  "call-bind": {
127
127
  "version": "1.0.2",
@@ -13,9 +13,9 @@
13
13
  }
14
14
  },
15
15
  "node_modules/@types/node": {
16
- "version": "17.0.1",
17
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.1.tgz",
18
- "integrity": "sha512-NXKvBVUzIbs6ylBwmOwHFkZS2EXCcjnqr8ZCRNaXBkHAf+3mn/rPcJxwrzuc6movh8fxQAsUUfYklJ/EG+hZqQ=="
16
+ "version": "17.0.2",
17
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
18
+ "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA=="
19
19
  },
20
20
  "node_modules/call-bind": {
21
21
  "version": "1.0.2",
@@ -119,9 +119,9 @@
119
119
  },
120
120
  "dependencies": {
121
121
  "@types/node": {
122
- "version": "17.0.1",
123
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.1.tgz",
124
- "integrity": "sha512-NXKvBVUzIbs6ylBwmOwHFkZS2EXCcjnqr8ZCRNaXBkHAf+3mn/rPcJxwrzuc6movh8fxQAsUUfYklJ/EG+hZqQ=="
122
+ "version": "17.0.2",
123
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.2.tgz",
124
+ "integrity": "sha512-JepeIUPFDARgIs0zD/SKPgFsJEAF0X5/qO80llx59gOxFTboS9Amv3S+QfB7lqBId5sFXJ99BN0J6zFRvL9dDA=="
125
125
  },
126
126
  "call-bind": {
127
127
  "version": "1.0.2",
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "node_modules/@types/node": {
29
- "version": "14.18.1",
30
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.1.tgz",
31
- "integrity": "sha512-fTFWOFrgAkj737w1o0HLTIgisgYHnsZfeiqhG1Ltrf/iJjudEbUwetQAsfrtVE49JGwvpEzQR+EbMkIqG4227g=="
29
+ "version": "14.18.2",
30
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.2.tgz",
31
+ "integrity": "sha512-fqtSN5xn/bBzDxMT77C1rJg6CsH/R49E7qsGuvdPJa20HtV5zSTuLJPNfnlyVH3wauKnkHdLggTVkOW/xP9oQg=="
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.1",
62
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.1.tgz",
63
- "integrity": "sha512-fTFWOFrgAkj737w1o0HLTIgisgYHnsZfeiqhG1Ltrf/iJjudEbUwetQAsfrtVE49JGwvpEzQR+EbMkIqG4227g=="
61
+ "version": "14.18.2",
62
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.2.tgz",
63
+ "integrity": "sha512-fqtSN5xn/bBzDxMT77C1rJg6CsH/R49E7qsGuvdPJa20HtV5zSTuLJPNfnlyVH3wauKnkHdLggTVkOW/xP9oQg=="
64
64
  },
65
65
  "is-promise": {
66
66
  "version": "4.0.0",
@@ -7,7 +7,17 @@ const BACKGROUND_SUFFIX = '-background'
7
7
  const difference = (setA, setB) => new Set([...setA].filter((item) => !setB.has(item)))
8
8
 
9
9
  class NetlifyFunction {
10
- constructor({ config, directory, mainFile, name, projectRoot, runtime, timeoutBackground, timeoutSynchronous }) {
10
+ constructor({
11
+ config,
12
+ directory,
13
+ mainFile,
14
+ name,
15
+ projectRoot,
16
+ runtime,
17
+ settings,
18
+ timeoutBackground,
19
+ timeoutSynchronous,
20
+ }) {
11
21
  this.config = config
12
22
  this.directory = directory
13
23
  this.errorExit = errorExit
@@ -17,6 +27,7 @@ class NetlifyFunction {
17
27
  this.runtime = runtime
18
28
  this.timeoutBackground = timeoutBackground
19
29
  this.timeoutSynchronous = timeoutSynchronous
30
+ this.settings = settings
20
31
 
21
32
  // Determines whether this is a background function based on the function
22
33
  // name.
@@ -93,6 +104,10 @@ class NetlifyFunction {
93
104
  return { result: null, error }
94
105
  }
95
106
  }
107
+
108
+ get url() {
109
+ return `http://localhost:${this.settings.port}/.netlify/functions/${this.name}`
110
+ }
96
111
  }
97
112
 
98
113
  module.exports = { NetlifyFunction }
@@ -2,6 +2,8 @@
2
2
  const { mkdir } = require('fs').promises
3
3
  const { env } = require('process')
4
4
 
5
+ const terminalLink = require('terminal-link')
6
+
5
7
  const { NETLIFYDEVERR, NETLIFYDEVLOG, chalk, log, warn } = require('../../utils')
6
8
  const { getLogMessage } = require('../log')
7
9
 
@@ -10,12 +12,13 @@ const runtimes = require('./runtimes')
10
12
  const { watchDebounced } = require('./watcher')
11
13
 
12
14
  class FunctionsRegistry {
13
- constructor({ capabilities, config, isConnected = false, projectRoot, timeouts }) {
15
+ constructor({ capabilities, config, isConnected = false, projectRoot, settings, timeouts }) {
14
16
  this.capabilities = capabilities
15
17
  this.config = config
16
18
  this.isConnected = isConnected
17
19
  this.projectRoot = projectRoot
18
20
  this.timeouts = timeouts
21
+ this.settings = settings
19
22
 
20
23
  // An object to be shared among all functions in the registry. It can be
21
24
  // used to cache the results of the build function — e.g. it's used in
@@ -140,7 +143,7 @@ class FunctionsRegistry {
140
143
  this.functions.set(name, func)
141
144
  this.buildFunctionAndWatchFiles(func)
142
145
 
143
- log(`${NETLIFYDEVLOG} ${chalk.green('Loaded')} function ${chalk.yellow(name)}.`)
146
+ log(`${NETLIFYDEVLOG} ${chalk.green('Loaded')} function ${terminalLink(chalk.yellow(name), func.url)}.`)
144
147
  }
145
148
 
146
149
  async scan(directories) {
@@ -192,6 +195,7 @@ class FunctionsRegistry {
192
195
  runtime,
193
196
  timeoutBackground: this.timeouts.backgroundFunctions,
194
197
  timeoutSynchronous: this.timeouts.syncFunctions,
198
+ settings: this.settings,
195
199
  })
196
200
 
197
201
  this.registerFunction(name, func)
@@ -180,6 +180,7 @@ const startFunctionsServer = async ({
180
180
  config,
181
181
  isConnected: Boolean(siteUrl),
182
182
  projectRoot: site.root,
183
+ settings,
183
184
  timeouts,
184
185
  })
185
186
 
@@ -3,7 +3,6 @@ const os = require('os')
3
3
  const process = require('process')
4
4
  const { format, inspect } = require('util')
5
5
 
6
- // eslint-disable-next-line local-rules/no-direct-chalk-import
7
6
  const { Instance: ChalkInstance } = require('chalk')
8
7
  const WSL = require('is-wsl')
9
8
  const { default: omit } = require('omit.js')
@@ -52,21 +52,21 @@ const deploySite = async (
52
52
  phase: 'start',
53
53
  })
54
54
 
55
- const [{ files, filesShaMap }, { fnShaMap, functions, functionsWithNativeModules }] = await Promise.all([
56
- hashFiles(dir, configPath, { concurrentHash, hashAlgorithm, assetType, statusCb, filter }),
57
- hashFns(fnDir, {
58
- functionsConfig,
59
- tmpDir,
60
- concurrentHash,
61
- hashAlgorithm,
62
- statusCb,
63
- assetType,
64
- rootDir,
65
- manifestPath,
66
- skipFunctionsCache,
67
- }),
68
- ])
69
-
55
+ const [{ files, filesShaMap }, { fnShaMap, functionSchedules, functions, functionsWithNativeModules }] =
56
+ await Promise.all([
57
+ hashFiles(dir, configPath, { concurrentHash, hashAlgorithm, assetType, statusCb, filter }),
58
+ hashFns(fnDir, {
59
+ functionsConfig,
60
+ tmpDir,
61
+ concurrentHash,
62
+ hashAlgorithm,
63
+ statusCb,
64
+ assetType,
65
+ rootDir,
66
+ manifestPath,
67
+ skipFunctionsCache,
68
+ }),
69
+ ])
70
70
  const filesCount = Object.keys(files).length
71
71
  const functionsCount = Object.keys(functions).length
72
72
  const hasFunctionDirectories = fnDir.length !== 0
@@ -106,6 +106,7 @@ For more information, visit https://ntl.fyi/cli-native-modules.`)
106
106
  body: {
107
107
  files,
108
108
  functions,
109
+ function_schedules: functionSchedules,
109
110
  async: Object.keys(files).length > syncFileLimit,
110
111
  branch,
111
112
  draft,
@@ -107,7 +107,9 @@ const hashFns = async (
107
107
  normalizedPath: path.basename(functionPath, path.extname(functionPath)),
108
108
  runtime,
109
109
  }))
110
-
110
+ const functionSchedules = functionZips
111
+ .map(({ name, schedule }) => schedule && { name, cron: schedule })
112
+ .filter(Boolean)
111
113
  const functionsWithNativeModules = functionZips.filter(
112
114
  ({ nativeNodeModules }) => nativeNodeModules !== undefined && Object.keys(nativeNodeModules).length !== 0,
113
115
  )
@@ -125,7 +127,7 @@ const hashFns = async (
125
127
 
126
128
  await pump(functionStream, hasher, manifestCollector)
127
129
 
128
- return { functions, functionsWithNativeModules, fnShaMap }
130
+ return { functionSchedules, functions, functionsWithNativeModules, fnShaMap }
129
131
  }
130
132
 
131
133
  module.exports = { hashFns }