2.2.1 • Published 1 year ago

@beesley/push-function-zips v2.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@beesley/push-function-zips

Zips up and uploads build artifacts for serverless functions

usage

cli

Typically this module would be used from the command line. The command line args are described here.

ArgumentDescriptionTypeRequired?
--helpShow help[boolean]
--versionShow version number[boolean]
--inputPathThe path to the lambda code and node_modules[string][required]
--includeAn array of globs defining what to bundle[array][required]
--excludeAn array of globs defining what not to bundle[array]
--rootDirAn optional path within the zip to save the files to[string]
--regionsA list of regions to upload the assets in[array][required]
--bucketsA list of buckets to upload to (same order as the regions please)[array][required]
--functionKeyThe path/filename of the zip file in the bucket (you don't need to add the .zip extension, but remember to include a version string of some sort)[string][required]
--layerKeyTells the module to split out the node modules into a zip that you can create a lambda layer from[string]
--versionSuffixAn optional string to append to layer and function keys to use as a version indicator[string]
--platformWhich cloud provider we are uploading to (AWS or GCP)[string]
npx @beesley/push-function-zips --inputPath './' --include 'dist/**' --regions 'eu-central-1' --buckets 'my-lambda-artefacts' --functionKey 'hello-function' --layerKey 'hello-function-dependencies' --platform 'AWS' --versionSuffix '1.0.0' 

programmatic

It is possible to use this module programmatically if you so desire.

import { packageAndUpload } from '@beesley/push-function-zips';

await packageAndUpload({
  inputPath: './',
  include: ['dist/**'],
  createLayer: true,
  region: 'eu-central-1',
  bucket: 'my-lambda-artefacts',
  functionKey: 'hello-function',
  layerKey: 'hello-function-dependencies',
});

API

Table of Contents

Options

src/@types/options.ts:11-78

Options to define an upload task

Type: {inputPath: string, include: Array[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, exclude: Array[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?, createLayer: boolean?, rootDir: string?, region: string, bucket: string, functionKey: string, layerKey: string?, project: string?, platform: Platform}

Properties

inputPath

src/@types/options.ts:17-17

A pointer to where the files to upload are located

Type: string

include

src/@types/options.ts:23-23

An array of globs to include in the zip

Type: Array[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

exclude

src/@types/options.ts:29-29

An array of globs to exclude from the zip

Type: Array[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)

createLayer

src/@types/options.ts:35-35

Whether or not to create a layer zip

Type: boolean

rootDir

src/@types/options.ts:41-41

A position within the zip to mount the files

Type: string

region

src/@types/options.ts:47-47

The AWS region to upload the assets to

Type: string

bucket

src/@types/options.ts:53-53

The name of the S3 bucket to upload to

Type: string

functionKey

src/@types/options.ts:59-59

The key name to upload the function zip as

Type: string

layerKey

src/@types/options.ts:65-65

The key name to upload the layer as

Type: string

project

src/@types/options.ts:71-71

The name of a google project to upload to

Type: string

platform

src/@types/options.ts:77-77

The target we're uploading to

Type: Platform

packageAndUpload

src/package-and-upload.ts:15-33

Packages up an asset based on globs and uploads zips to storage

Parameters

  • arg Options Configuration defining what to upload to where

Returns any {Promise}

2.2.1

1 year ago

2.2.0

1 year ago

2.1.9

1 year ago

2.1.16

1 year ago

2.1.17

1 year ago

2.1.14

1 year ago

2.1.15

1 year ago

2.1.12

1 year ago

2.1.13

1 year ago

2.1.10

1 year ago

2.1.11

1 year ago

2.1.18

1 year ago

2.1.8

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

2.1.2

1 year ago

2.0.3

1 year ago

2.1.1

1 year ago

2.0.2

1 year ago

2.1.4

1 year ago

2.0.13

1 year ago

2.0.5

1 year ago

2.1.3

1 year ago

2.0.4

1 year ago

2.1.6

1 year ago

2.0.11

1 year ago

2.0.7

1 year ago

2.1.5

1 year ago

2.0.12

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.1.7

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.23

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago