netlify-cli 10.3.1 → 10.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "10.3.1",
4
+ "version": "10.5.0",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
@@ -13,7 +13,6 @@
13
13
  "Ardie Wen",
14
14
  "Arthur Puyou <arthur@puyou.fr> (https://twitter.com/apuyou)",
15
15
  "Ashal Farhan",
16
- "Axel Fuhrmann (https://twitter.com/axelfuh)",
17
16
  "Battulga Tsogtgerel <theonlytulga@gmail.com>",
18
17
  "Be <be.0@gmx.com> (https://beasintheverb.me/)",
19
18
  "Benaiah Mischenko <benaiah@mischenko.com> (https://benaiah.me)",
@@ -30,6 +29,7 @@
30
29
  "Cole Bosmann",
31
30
  "Dan Croak (https://twitter.com/croaky)",
32
31
  "Dan Loewenherz <dan@lionheartsw.com> (https://twitter.com/dwlz)",
32
+ "Daniel Tschinder (https://twitter.com/TschinderDaniel)",
33
33
  "Daniel Woelfel <dwwoelfel@gmail.com> (https://twitter.com/danielwoelfel)",
34
34
  "Dave Ackerman <dmackerman@gmail.com>",
35
35
  "David Calavera <david@netlify.com> (https://twitter.com/calavera)",
@@ -61,6 +61,7 @@
61
61
  "Jon Sullivan <hey@jonsully.net> (https://jonsully.net)",
62
62
  "Jonas Brusman (https://jonas.brusman.se)",
63
63
  "Jonathan Cardoso <me@jonathancardoso.com> (https://twitter.com/_jonathancardos)",
64
+ "Jordan Whistler (www.jordanwhistler.info)",
64
65
  "Joshua T. (http://localhost:8080)",
65
66
  "João Antunes <me@jgantunes.com> (https://twitter.com/jgantunes)",
66
67
  "Karagulamos (https://twitter.com/karagulamos)",
@@ -112,6 +113,7 @@
112
113
  "Shawn Erquhart <shawn@erquh.art>",
113
114
  "Shawn Makinson (http://smakinson.github.io)",
114
115
  "Souma Suzuki <subayai.kobashiri@gmail.com>",
116
+ "Sven Serlier (dypodex.nl/sven/)",
115
117
  "Sébastien Chopin <seb@nuxtjs.com> (https://twitter.com/Atinux)",
116
118
  "Takumi Hirunuma <m.111_t.1230_nittc@outlook.com> (https://twitter.com/mg111_)",
117
119
  "Tan Zhen Yong (https://www.beyondthesprawl.com)",
@@ -122,6 +124,7 @@
122
124
  "Tim Perry (https://twitter.com/pimterry)",
123
125
  "Tim Trautman (timtrautman.com)",
124
126
  "Tom Dyson (https://wagtail.io/)",
127
+ "Tom Hu (https://twitter.com/thomasrockhu)",
125
128
  "Travis Horn <travis@travishorn.com> (https://twitter.com/horn_travis)",
126
129
  "Try Ajitiono <ballinst@gmail.com> (https://twitter.com/Ajiballinst)",
127
130
  "Victor Dadfar",
@@ -208,13 +211,13 @@
208
211
  "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\""
209
212
  },
210
213
  "dependencies": {
211
- "@netlify/build": "^27.1.1",
212
- "@netlify/config": "^18.0.0",
213
- "@netlify/edge-bundler": "^1.1.0",
214
+ "@netlify/build": "^27.1.3",
215
+ "@netlify/config": "^18.0.1",
216
+ "@netlify/edge-bundler": "^1.2.0",
214
217
  "@netlify/framework-info": "^9.0.2",
215
218
  "@netlify/local-functions-proxy": "^1.1.1",
216
- "@netlify/plugins-list": "^6.19.0",
217
- "@netlify/zip-it-and-ship-it": "^5.9.0",
219
+ "@netlify/plugins-list": "^6.27.0",
220
+ "@netlify/zip-it-and-ship-it": "^5.10.0",
218
221
  "@octokit/rest": "^18.0.0",
219
222
  "@sindresorhus/slugify": "^1.1.0",
220
223
  "ansi-escapes": "^5.0.0",
@@ -335,7 +338,6 @@
335
338
  "nock": "^13.2.4",
336
339
  "p-timeout": "^4.0.0",
337
340
  "rewiremock": "^3.14.3",
338
- "seedrandom": "^3.0.5",
339
341
  "serialize-javascript": "^6.0.0",
340
342
  "sinon": "^13.0.0",
341
343
  "sort-on": "^4.1.0",
@@ -345,7 +347,7 @@
345
347
  "tomlify-j0.4": "^3.0.0",
346
348
  "tree-kill": "^1.2.2",
347
349
  "typescript": "^4.4.4",
348
- "verdaccio": "^5.4.0"
350
+ "verdaccio": "^5.10.2"
349
351
  },
350
352
  "ava": {
351
353
  "files": [
@@ -27,6 +27,7 @@ const {
27
27
  readGraphQLOperationsSourceFile,
28
28
  } = require('../../lib/one-graph/cli-netlify-graph')
29
29
  const {
30
+ BANG,
30
31
  NETLIFYDEV,
31
32
  NETLIFYDEVERR,
32
33
  NETLIFYDEVLOG,
@@ -195,11 +196,19 @@ const startFrameworkServer = async function ({ settings }) {
195
196
  // 10 minutes
196
197
  const FRAMEWORK_PORT_TIMEOUT = 6e5
197
198
 
199
+ /**
200
+ * @typedef {Object} InspectSettings
201
+ * @property {boolean} enabled - Inspect enabled
202
+ * @property {boolean} pause - Pause on breakpoints
203
+ * @property {string|undefined} address - Host/port override (optional)
204
+ */
205
+
198
206
  /**
199
207
  *
200
208
  * @param {object} params
201
209
  * @param {*} params.addonsUrls
202
210
  * @param {import('../base-command').NetlifyOptions["config"]} params.config
211
+ * @param {InspectSettings} params.inspectSettings
203
212
  * @param {() => Promise<object>} params.getUpdatedConfig
204
213
  * @param {string} params.geolocationMode
205
214
  * @param {*} params.settings
@@ -213,6 +222,7 @@ const startProxyServer = async ({
213
222
  config,
214
223
  geolocationMode,
215
224
  getUpdatedConfig,
225
+ inspectSettings,
216
226
  offline,
217
227
  settings,
218
228
  site,
@@ -224,6 +234,7 @@ const startProxyServer = async ({
224
234
  configPath: site.configPath,
225
235
  geolocationMode,
226
236
  getUpdatedConfig,
237
+ inspectSettings,
227
238
  offline,
228
239
  projectDir: site.root,
229
240
  settings,
@@ -312,6 +323,46 @@ const startPollingForAPIAuthentication = async function (options) {
312
323
  await helper(siteInfo)
313
324
  }
314
325
 
326
+ /**
327
+ * @param {boolean|string} edgeInspect
328
+ * @param {boolean|string} edgeInspectBrk
329
+ * @returns {InspectSettings}
330
+ */
331
+ const generateInspectSettings = (edgeInspect, edgeInspectBrk) => {
332
+ const enabled = Boolean(edgeInspect) || Boolean(edgeInspectBrk)
333
+ const pause = Boolean(edgeInspectBrk)
334
+ const getAddress = () => {
335
+ if (edgeInspect) {
336
+ return typeof edgeInspect === 'string' ? edgeInspect : undefined
337
+ }
338
+ if (edgeInspectBrk) {
339
+ return typeof edgeInspectBrk === 'string' ? edgeInspectBrk : undefined
340
+ }
341
+ }
342
+
343
+ return {
344
+ enabled,
345
+ pause,
346
+ address: getAddress(),
347
+ }
348
+ }
349
+
350
+ const validateShortFlagArgs = (args) => {
351
+ if (args.startsWith('=')) {
352
+ throw new Error(
353
+ `Short flag options like -e or -E don't support the '=' sign
354
+ ${chalk.red(BANG)} Supported formats:
355
+ netlify dev -e
356
+ netlify dev -e 127.0.0.1:9229
357
+ netlify dev -e127.0.0.1:9229
358
+ netlify dev -E
359
+ netlify dev -E 127.0.0.1:9229
360
+ netlify dev -E127.0.0.1:9229`,
361
+ )
362
+ }
363
+ return args
364
+ }
365
+
315
366
  /**
316
367
  * The dev command
317
368
  * @param {import('commander').OptionValues} options
@@ -380,11 +431,14 @@ const dev = async (options, command) => {
380
431
  return normalizedNewConfig
381
432
  }
382
433
 
434
+ const inspectSettings = generateInspectSettings(options.edgeInspect, options.edgeInspectBrk)
435
+
383
436
  let url = await startProxyServer({
384
437
  addonsUrls,
385
438
  config,
386
439
  geolocationMode: options.geo,
387
440
  getUpdatedConfig,
441
+ inspectSettings,
388
442
  offline: options.offline,
389
443
  settings,
390
444
  site,
@@ -522,11 +576,31 @@ const createDevCommand = (program) => {
522
576
  .hideHelp(),
523
577
  )
524
578
  .addOption(new Option('--graph', 'enable Netlify Graph support').hideHelp())
579
+ .addOption(
580
+ new Option(
581
+ '-e, --edgeInspect [address]',
582
+ 'enable the V8 Inspector Protocol for Edge Functions, with an optional address in the host:port format',
583
+ )
584
+ .conflicts('edgeInspectBrk')
585
+ .argParser(validateShortFlagArgs),
586
+ )
587
+ .addOption(
588
+ new Option(
589
+ '-E, --edgeInspectBrk [address]',
590
+ 'enable the V8 Inspector Protocol for Edge Functions and pause execution on the first line of code, with an optional address in the host:port format',
591
+ )
592
+ .conflicts('edgeInspect')
593
+ .argParser(validateShortFlagArgs),
594
+ )
525
595
  .addExamples([
526
596
  'netlify dev',
527
597
  'netlify dev -d public',
528
598
  'netlify dev -c "hugo server -w" --targetPort 1313',
529
599
  'netlify dev --graph',
600
+ 'netlify dev --edgeInspect',
601
+ 'netlify dev --edgeInspect=127.0.0.1:9229',
602
+ 'netlify dev --edgeInspectBrk',
603
+ 'netlify dev --edgeInspectBrk=127.0.0.1:9229',
530
604
  'BROWSER=none netlify dev # disable browser auto opening',
531
605
  ])
532
606
  .action(dev)
@@ -2,4 +2,4 @@ module github.com/someone/{{name}}
2
2
 
3
3
  go 1.15
4
4
 
5
- require github.com/aws/aws-lambda-go v1.31.1
5
+ require github.com/aws/aws-lambda-go v1.32.0
@@ -17,7 +17,7 @@
17
17
  "cookie-parser": "^1.4.5",
18
18
  "express": "^4.17.1",
19
19
  "jsonwebtoken": "^8.5.1",
20
- "passport": "^0.5.0",
20
+ "passport": "^0.6.0",
21
21
  "passport-github2": "^0.1.12",
22
22
  "passport-jwt": "^4.0.0",
23
23
  "serverless-http": "^2.0.2"
@@ -11,4 +11,4 @@ http = "0.2.7"
11
11
  lambda_runtime = "0.5.1"
12
12
  log = "0.4.17"
13
13
  simple_logger = "1.16.0"
14
- tokio = "1.18.2"
14
+ tokio = "1.19.1"
@@ -26,9 +26,9 @@
26
26
  }
27
27
  },
28
28
  "node_modules/@types/node": {
29
- "version": "14.18.16",
30
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.16.tgz",
31
- "integrity": "sha512-X3bUMdK/VmvrWdoTkz+VCn6nwKwrKCFTHtqwBIaQJNx4RUIBBUFXM00bqPz/DsDd+Icjmzm6/tyYZzeGVqb6/Q=="
29
+ "version": "14.18.20",
30
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.20.tgz",
31
+ "integrity": "sha512-Q8KKwm9YqEmUBRsqJ2GWJDtXltBDxTdC4m5vTdXBolu2PeQh8LX+f6BTwU+OuXPu37fLxoN6gidqBmnky36FXA=="
32
32
  },
33
33
  "node_modules/is-promise": {
34
34
  "version": "4.0.0",
@@ -36,9 +36,9 @@
36
36
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
37
37
  },
38
38
  "node_modules/typescript": {
39
- "version": "4.6.4",
40
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
41
- "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==",
39
+ "version": "4.7.3",
40
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz",
41
+ "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==",
42
42
  "bin": {
43
43
  "tsc": "bin/tsc",
44
44
  "tsserver": "bin/tsserver"
@@ -58,9 +58,9 @@
58
58
  }
59
59
  },
60
60
  "@types/node": {
61
- "version": "14.18.16",
62
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.16.tgz",
63
- "integrity": "sha512-X3bUMdK/VmvrWdoTkz+VCn6nwKwrKCFTHtqwBIaQJNx4RUIBBUFXM00bqPz/DsDd+Icjmzm6/tyYZzeGVqb6/Q=="
61
+ "version": "14.18.20",
62
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.20.tgz",
63
+ "integrity": "sha512-Q8KKwm9YqEmUBRsqJ2GWJDtXltBDxTdC4m5vTdXBolu2PeQh8LX+f6BTwU+OuXPu37fLxoN6gidqBmnky36FXA=="
64
64
  },
65
65
  "is-promise": {
66
66
  "version": "4.0.0",
@@ -68,9 +68,9 @@
68
68
  "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="
69
69
  },
70
70
  "typescript": {
71
- "version": "4.6.4",
72
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.4.tgz",
73
- "integrity": "sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg=="
71
+ "version": "4.7.3",
72
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.3.tgz",
73
+ "integrity": "sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA=="
74
74
  }
75
75
  }
76
76
  }
@@ -2,7 +2,7 @@ import { schedule } from '@netlify/functions';
2
2
 
3
3
  // To learn about scheduled functions and supported cron extensions,
4
4
  // see: https://ntl.fyi/sched-func
5
- export const handler = schedule("@hourly", (event) => {
5
+ export const handler = schedule("@hourly", async (event) => {
6
6
  const eventBody = JSON.parse(event.body);
7
7
  console.log(`Next function run at ${eventBody.next_run}.`);
8
8
 
@@ -5,4 +5,5 @@ module.exports = {
5
5
  Geo: 'x-nf-geo',
6
6
  Passthrough: 'x-deno-pass',
7
7
  RequestID: 'X-NF-Request-ID',
8
+ IP: 'x-nf-client-connection-ip',
8
9
  }
@@ -47,6 +47,7 @@ const initializeProxy = async ({
47
47
  configPath,
48
48
  geolocationMode,
49
49
  getUpdatedConfig,
50
+ inspectSettings,
50
51
  offline,
51
52
  projectDir,
52
53
  settings,
@@ -67,6 +68,7 @@ const initializeProxy = async ({
67
68
  directories: [internalFunctionsPath, userFunctionsPath].filter(Boolean),
68
69
  getUpdatedConfig,
69
70
  importMaps: [importMap].filter(Boolean),
71
+ inspectSettings,
70
72
  internalFunctions,
71
73
  port: isolatePort,
72
74
  projectDir,
@@ -114,6 +116,7 @@ const initializeProxy = async ({
114
116
  [headers.ForwardedHost]: `localhost:${mainPort}`,
115
117
  [headers.Passthrough]: 'passthrough',
116
118
  [headers.RequestID]: generateUUID(),
119
+ [headers.IP]: LOCAL_HOST,
117
120
  }
118
121
 
119
122
  if (settings.https) {
@@ -133,6 +136,7 @@ const prepareServer = async ({
133
136
  directories,
134
137
  getUpdatedConfig,
135
138
  importMaps,
139
+ inspectSettings,
136
140
  internalFunctions,
137
141
  port,
138
142
  projectDir,
@@ -150,6 +154,7 @@ const prepareServer = async ({
150
154
  )}. The file does not seem to have a function as the default export.`,
151
155
  formatImportError: (name) => `${NETLIFYDEVERR} ${chalk.red('Failed')} to run Edge Function ${chalk.yellow(name)}:`,
152
156
  importMaps,
157
+ inspectSettings,
153
158
  port,
154
159
  })
155
160
  const registry = new EdgeFunctionsRegistry({
@@ -87,7 +87,7 @@ class NetlifyFunction {
87
87
  this.buildQueue = buildFunction({ cache })
88
88
 
89
89
  try {
90
- const { schedule, srcFiles, ...buildData } = await this.buildQueue
90
+ const { includedFiles = [], schedule, srcFiles, ...buildData } = await this.buildQueue
91
91
  const srcFilesSet = new Set(srcFiles)
92
92
  const srcFilesDiff = this.getSrcFilesDiff(srcFilesSet)
93
93
 
@@ -95,7 +95,7 @@ class NetlifyFunction {
95
95
  this.srcFiles = srcFilesSet
96
96
  this.schedule = schedule || this.schedule
97
97
 
98
- return { srcFilesDiff }
98
+ return { includedFiles, srcFilesDiff }
99
99
  } catch (error) {
100
100
  return { error }
101
101
  }
@@ -137,8 +137,9 @@ class NetlifyFunction {
137
137
  // Not sure why `settings.port` was used here nor does a valid reference exist.
138
138
  // However, it remains here to serve whatever purpose for which it was added.
139
139
  const port = this.settings.port || this.settings.functionsPort
140
+ const protocol = this.settings.https ? 'https' : 'http'
141
+ const url = new URL(`/.netlify/functions/${this.name}`, `${protocol}://localhost:${port}`)
140
142
 
141
- const url = new URL(`/.netlify/functions/${this.name}`, `http://localhost:${port}`)
142
143
  return url.href
143
144
  }
144
145
  }
@@ -76,7 +76,7 @@ class FunctionsRegistry {
76
76
  log(`${NETLIFYDEVLOG} ${chalk.magenta('Reloading')} function ${chalk.yellow(func.name)}...`)
77
77
  }
78
78
 
79
- const { error_, srcFilesDiff } = await func.build({ cache: this.buildCache })
79
+ const { error_, includedFiles, srcFilesDiff } = await func.build({ cache: this.buildCache })
80
80
 
81
81
  if (error_) {
82
82
  log(
@@ -113,7 +113,9 @@ class FunctionsRegistry {
113
113
  // If there is no watcher for this function but the build produced files,
114
114
  // we create a new watcher and watch them.
115
115
  if (srcFilesDiff.added.size !== 0) {
116
- const newWatcher = await watchDebounced([...srcFilesDiff.added], {
116
+ const filesToWatch = [...srcFilesDiff.added, ...includedFiles]
117
+
118
+ const newWatcher = await watchDebounced(filesToWatch, {
117
119
  onChange: () => {
118
120
  this.buildFunctionAndWatchFiles(func, { verbose: true })
119
121
  },
@@ -55,11 +55,12 @@ const invokeFunction = async ({ context, event, func, timeout }) => {
55
55
  })
56
56
 
57
57
  try {
58
- const { body, headers, statusCode } = JSON.parse(stdout)
58
+ const { body, headers, multiValueHeaders, statusCode } = JSON.parse(stdout)
59
59
 
60
60
  return {
61
61
  body,
62
62
  headers,
63
+ multiValueHeaders,
63
64
  statusCode,
64
65
  }
65
66
  } catch {
@@ -36,6 +36,7 @@ const buildFunction = async ({ cache, config, directory, func, hasTypeModule, pr
36
36
  // this case, we use `mainFile` as the function path of `zipFunction`.
37
37
  const entryPath = functionDirectory === directory ? func.mainFile : functionDirectory
38
38
  const {
39
+ includedFiles,
39
40
  inputs,
40
41
  path: functionPath,
41
42
  schedule,
@@ -60,7 +61,7 @@ const buildFunction = async ({ cache, config, directory, func, hasTypeModule, pr
60
61
 
61
62
  clearFunctionsCache(targetDirectory)
62
63
 
63
- return { buildPath, srcFiles, schedule }
64
+ return { buildPath, includedFiles, srcFiles, schedule }
64
65
  }
65
66
 
66
67
  /**
@@ -54,11 +54,12 @@ const invokeFunction = async ({ context, event, func, timeout }) => {
54
54
  })
55
55
 
56
56
  try {
57
- const { body, headers, statusCode } = JSON.parse(stdout)
57
+ const { body, headers, multiValueHeaders, statusCode } = JSON.parse(stdout)
58
58
 
59
59
  return {
60
60
  body,
61
61
  headers,
62
+ multiValueHeaders,
62
63
  statusCode,
63
64
  }
64
65
  } catch {
@@ -467,6 +467,7 @@ const startProxy = async function ({
467
467
  configPath,
468
468
  geolocationMode,
469
469
  getUpdatedConfig,
470
+ inspectSettings,
470
471
  offline,
471
472
  projectDir,
472
473
  settings,
@@ -478,6 +479,7 @@ const startProxy = async function ({
478
479
  configPath,
479
480
  geolocationMode,
480
481
  getUpdatedConfig,
482
+ inspectSettings,
481
483
  offline,
482
484
  projectDir,
483
485
  settings,
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- name: 'scheduled-function',
3
- priority: 1,
4
- description: 'Basic implementation of a scheduled function in Go.',
5
- }
@@ -1,5 +0,0 @@
1
- module github.com/your-github-handle/{{name}}
2
-
3
- go 1.17
4
-
5
- require github.com/aws/aws-lambda-go v1.31.1
@@ -1,21 +0,0 @@
1
- github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
2
- github.com/aws/aws-lambda-go v1.28.0 h1:fZiik1PZqW2IyAN4rj+Y0UBaO1IDFlsNo9Zz/XnArK4=
3
- github.com/aws/aws-lambda-go v1.28.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU=
4
- github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
5
- github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
6
- github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7
- github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
8
- github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9
- github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
10
- github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
11
- github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
12
- github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
13
- github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
14
- github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
15
- github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
16
- github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
17
- gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
18
- gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
19
- gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
20
- gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
21
- gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -1,11 +0,0 @@
1
- [build]
2
- functions = "functions"
3
-
4
- [build.environment]
5
- GO_VERSION = "1.17"
6
-
7
- [functions]
8
- directory = "src/"
9
-
10
- [functions.hourly-schedule]
11
- schedule = "@hourly"
@@ -1,36 +0,0 @@
1
- package main
2
-
3
- import (
4
- "context"
5
- "encoding/json"
6
- "log"
7
- "net/http"
8
- "time"
9
-
10
- "github.com/aws/aws-lambda-go/events"
11
- "github.com/aws/aws-lambda-go/lambda"
12
- )
13
-
14
- type requestBody struct {
15
- NextRun time.Time `json:"next_run"`
16
- }
17
-
18
- // The schedule for this function is defined inside the netlify.toml file. To learn about scheduled functions
19
- // and supported cron extensions, visit https://ntl.fyi/sched-func.
20
- func handler(ctx context.Context, request events.APIGatewayProxyRequest) (*events.APIGatewayProxyResponse, error) {
21
- requestBody := requestBody{}
22
-
23
- if err := json.Unmarshal([]byte(request.Body), &requestBody); err != nil {
24
- log.Fatalf("cannot parse request body: %s", err.Error())
25
- }
26
-
27
- log.Printf("Next run at %s\n", requestBody.NextRun.Local())
28
-
29
- return &events.APIGatewayProxyResponse{
30
- StatusCode: http.StatusNoContent,
31
- }, nil
32
- }
33
-
34
- func main() {
35
- lambda.Start(handler)
36
- }