npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@beesley/push-function-zips

v2.2.1

Published

Zips up and uploads build artifacts for serverless functions

Downloads

182

Readme

@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.

| Argument | Description | Type | Required? | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ----------- | | --help | Show help | [boolean] | | | --version | Show version number | [boolean] | | | --inputPath | The path to the lambda code and node_modules | [string] | [required] | | --include | An array of globs defining what to bundle | [array] | [required] | | --exclude | An array of globs defining what not to bundle | [array] | | | --rootDir | An optional path within the zip to save the files to | [string] | | | --regions | A list of regions to upload the assets in | [array] | [required] | | --buckets | A list of buckets to upload to (same order as the regions please) | [array] | [required] | | --functionKey | The 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] | | --layerKey | Tells the module to split out the node modules into a zip that you can create a lambda layer from | [string] | | | --versionSuffix | An optional string to append to layer and function keys to use as a version indicator | [string] | | | --platform | Which 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>?, exclude: Array<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>

exclude

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

An array of globs to exclude from the zip

Type: Array<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}