@netlify/functions-utils 2.0.0-rc → 3.0.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.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/src/main.js +3 -14
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/functions-utils",
3
- "version": "2.0.0-rc",
3
+ "version": "3.0.0",
4
4
  "description": "Utility for adding Functions files in Netlify Build",
5
5
  "main": "src/main.js",
6
6
  "files": [
@@ -43,18 +43,18 @@
43
43
  },
44
44
  "license": "MIT",
45
45
  "dependencies": {
46
- "@netlify/zip-it-and-ship-it": "^4.13.0",
46
+ "@netlify/zip-it-and-ship-it": "^4.30.0",
47
47
  "cpy": "^8.1.0",
48
48
  "path-exists": "^4.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "ava": "^2.4.0",
51
+ "ava": "^3.15.0",
52
52
  "del": "^5.1.0",
53
- "sinon": "^11.0.0",
53
+ "sinon": "^12.0.0",
54
54
  "sort-on": "^4.1.0",
55
55
  "tmp-promise": "^3.0.0"
56
56
  },
57
57
  "engines": {
58
- "node": ">=8.3.0"
58
+ "node": "^12.20.0 || ^14.14.0 || >=16.0.0"
59
59
  }
60
60
  }
package/src/main.js CHANGED
@@ -4,6 +4,7 @@ const { stat } = require('fs')
4
4
  const { basename, dirname } = require('path')
5
5
  const { promisify } = require('util')
6
6
 
7
+ const { listFunctions, listFunctionsFiles } = require('@netlify/zip-it-and-ship-it')
7
8
  const cpy = require('cpy')
8
9
  const pathExists = require('path-exists')
9
10
 
@@ -39,18 +40,11 @@ const getSrcGlob = async function (src, srcBasename) {
39
40
  return srcBasename
40
41
  }
41
42
 
42
- const isEmptyArray = (input) => Array.isArray(input) && input.length === 0
43
-
44
43
  const list = async function (functionsSrc, { fail = defaultFail } = {}) {
45
- if (functionsSrc === undefined || isEmptyArray(functionsSrc)) {
44
+ if (functionsSrc === undefined || functionsSrc.length === 0) {
46
45
  return fail('No function directory was specified')
47
46
  }
48
47
 
49
- // This package currently supports Node 8 but not zip-it-and-ship-it
50
- // @todo put the `require()` to the top-level scope again once Node 8 support
51
- // is removed
52
- // eslint-disable-next-line node/global-require
53
- const { listFunctions } = require('@netlify/zip-it-and-ship-it')
54
48
  try {
55
49
  return await listFunctions(functionsSrc)
56
50
  } catch (error) {
@@ -59,15 +53,10 @@ const list = async function (functionsSrc, { fail = defaultFail } = {}) {
59
53
  }
60
54
 
61
55
  const listAll = async function (functionsSrc, { fail = defaultFail } = {}) {
62
- if (functionsSrc === undefined || isEmptyArray(functionsSrc)) {
56
+ if (functionsSrc === undefined || functionsSrc.length === 0) {
63
57
  return fail('No function directory was specified')
64
58
  }
65
59
 
66
- // This package currently supports Node 8 but not zip-it-and-ship-it
67
- // @todo put the `require()` to the top-level scope again once Node 8 support
68
- // is removed
69
- // eslint-disable-next-line node/global-require
70
- const { listFunctionsFiles } = require('@netlify/zip-it-and-ship-it')
71
60
  try {
72
61
  return await listFunctionsFiles(functionsSrc)
73
62
  } catch (error) {