@netlify/functions-utils 4.0.3 → 4.1.3
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/README.md +3 -5
- package/package.json +3 -3
- package/src/main.js +2 -5
package/README.md
CHANGED
|
@@ -11,11 +11,9 @@ This allows plugins to:
|
|
|
11
11
|
# Example
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
await utils.functions.add('./path/to/function')
|
|
18
|
-
},
|
|
14
|
+
// Add a Netlify Functions file or directory to a build
|
|
15
|
+
export const onPreBuild = async function ({ utils }) {
|
|
16
|
+
await utils.functions.add('./path/to/function')
|
|
19
17
|
}
|
|
20
18
|
```
|
|
21
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/functions-utils",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "Utility for adding Functions files in Netlify Build",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./src/main.js",
|
|
@@ -45,13 +45,13 @@
|
|
|
45
45
|
},
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@netlify/zip-it-and-ship-it": "^5.4.
|
|
48
|
+
"@netlify/zip-it-and-ship-it": "^5.4.1",
|
|
49
49
|
"cpy": "^8.1.0",
|
|
50
50
|
"path-exists": "^4.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"ava": "^3.15.0",
|
|
54
|
-
"del": "^
|
|
54
|
+
"del": "^6.0.0",
|
|
55
55
|
"sinon": "^12.0.0",
|
|
56
56
|
"sort-on": "^4.1.0",
|
|
57
57
|
"tmp-promise": "^3.0.0"
|
package/src/main.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { promises as fs } from 'fs'
|
|
2
2
|
import { basename, dirname } from 'path'
|
|
3
|
-
import { promisify } from 'util'
|
|
4
3
|
|
|
5
4
|
import { listFunctions, listFunctionsFiles } from '@netlify/zip-it-and-ship-it'
|
|
6
5
|
import cpy from 'cpy'
|
|
7
6
|
import pathExists from 'path-exists'
|
|
8
7
|
|
|
9
|
-
const pStat = promisify(stat)
|
|
10
|
-
|
|
11
8
|
// Add a Netlify Function file to the `functions` directory so it is processed
|
|
12
9
|
// by `@netlify/plugin-functions-core`
|
|
13
10
|
export const add = async function (src, dist, { fail = defaultFail } = {}) {
|
|
@@ -29,7 +26,7 @@ export const add = async function (src, dist, { fail = defaultFail } = {}) {
|
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
const getSrcGlob = async function (src, srcBasename) {
|
|
32
|
-
const srcStat = await
|
|
29
|
+
const srcStat = await fs.stat(src)
|
|
33
30
|
|
|
34
31
|
if (srcStat.isDirectory()) {
|
|
35
32
|
return `${srcBasename}/**`
|