@@ -32,15 +32,11 @@ npm install @netlify/zip-it-and-ship-it
32
32
- _ Return value_ : ` Promise<object[]> `
33
33
34
34
``` js
35
- const { zipFunctions } = require ( ' @netlify/zip-it-and-ship-it' )
35
+ import { zipFunctions } from ' @netlify/zip-it-and-ship-it'
36
36
37
- const zipNetlifyFunctions = async function () {
38
- const archives = await zipFunctions (' functions' , ' functions-dist' , {
39
- archiveFormat: ' zip' ,
40
- })
41
-
42
- return archives
43
- }
37
+ const archives = await zipFunctions (' functions' , ' functions-dist' , {
38
+ archiveFormat: ' zip' ,
39
+ })
44
40
```
45
41
46
42
Creates Zip ` archives ` from Node.js, Go, and Rust programs. Those ` archives ` are ready to be uploaded to AWS Lambda.
@@ -258,13 +254,9 @@ Additionally, the following properties also exist for Node.js functions:
258
254
- _ Return value_ : ` object | undefined `
259
255
260
256
``` js
261
- const { zipFunction } = require (' @netlify/zip-it-and-ship-it' )
262
-
263
- const zipNetlifyFunctions = async function () {
264
- const archive = await zipFunctions (' functions/function.js' , ' functions-dist' )
257
+ import { zipFunction } from ' @netlify/zip-it-and-ship-it'
265
258
266
- return archive
267
- }
259
+ const archive = await zipFunctions (' functions/function.js' , ' functions-dist' )
268
260
```
269
261
270
262
This is like [ ` zipFunctions() ` ] ( #zipfunctionssrcfolder-destfolder-options ) except it bundles a single Function.
@@ -276,13 +268,9 @@ The return value is `undefined` if the function is invalid.
276
268
Returns the list of functions to bundle.
277
269
278
270
``` js
279
- const { listFunctions } = require (' @netlify/zip-it-and-ship-it' )
280
-
281
- const listNetlifyFunctions = async function () {
282
- const functions = await listFunctions (' functions/function.js' )
271
+ import { listFunctions } from ' @netlify/zip-it-and-ship-it'
283
272
284
- return functions
285
- }
273
+ const functions = await listFunctions (' functions/function.js' )
286
274
```
287
275
288
276
### ` srcFolders `
@@ -326,12 +314,9 @@ Like [`listFunctions()`](#listfunctionssrcfolder), except it returns not only th
326
314
their required files. This is much slower.
327
315
328
316
``` js
329
- const { listFunctionsFiles } = require ( ' @netlify/zip-it-and-ship-it' )
317
+ import { listFunctionsFiles } from ' @netlify/zip-it-and-ship-it'
330
318
331
- const listNetlifyFunctionsFiles = async function () {
332
- const functions = await listFunctionsFiles (' functions/function.js' )
333
- return functions
334
- }
319
+ const functions = await listFunctionsFiles (' functions/function.js' )
335
320
```
336
321
337
322
### ` srcFolders `
@@ -400,20 +385,16 @@ included in the bundle.
400
385
You can enable esbuild by setting the [ ` config ` option] ( #config ) when calling ` zipFunction ` or ` zipFunctions ` :
401
386
402
387
``` js
403
- const { zipFunctions } = require (' @netlify/zip-it-and-ship-it' )
404
-
405
- const zipNetlifyFunctions = async function () {
406
- const archives = await zipFunctions (' functions' , ' functions-dist' , {
407
- config: {
408
- // Applying these settings to all functions.
409
- ' *' : {
410
- nodeBundler: ' esbuild' ,
411
- },
412
- },
413
- })
388
+ import { zipFunctions } from ' @netlify/zip-it-and-ship-it'
414
389
415
- return archives
416
- }
390
+ const archives = await zipFunctions (' functions' , ' functions-dist' , {
391
+ config: {
392
+ // Applying these settings to all functions.
393
+ ' *' : {
394
+ nodeBundler: ' esbuild' ,
395
+ },
396
+ },
397
+ })
417
398
```
418
399
419
400
# Feature flags
1 commit comments
github-actions[bot] commentedon Feb 8, 2022
⏱ Benchmark results
largeDepsEsbuild: 7.6s
largeDepsNft: 33.2s
largeDepsZisi: 59.4s