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

serverless-custom-packaging-plugin

v0.1.2

Published

Plugin for the Serverless Framework - Packages your sourcecode using a custom target path inside the zip. Related to https://github.com/serverless/serverless/issues/3366

Downloads

1,380

Readme

serverless-custom-packaging-plugin

serverless npm version Github All Releases license

What is this plugins purpose?

This plugin was originally built to allow deployment of arbitrarily nested python lambdas using serverless. The functionality is related to the one discussed in this serverless issue (#3366).

The Problem

Vanilla serverless packages your source-code, but retains the folder structure inside the zip-file. However, AWS Lambda can only find the entry-point to your function if it is packaged in a zip-files at root level (see the AWS-Lambda docs).

How it was solved

You define a path that you want to package inside of serverless's package property. The plugin then packages your code, such that te defined path becomes the root-path (.) of the package zip-file.

What else it can do

  1. Custom artifact path. You can define an artifact property. The zip-file will be placed there.
  2. If you want to include only certain file-names or extensions you may define them using the include_globs property.
  3. If you have additional libraries you need inside the lambda environment you may define a path in the libs property. The contents of this folder will be packaged alongside your functions code (in the root of the zip-file). This lets you include arbitrary python modules (i.e. built against the Lambda AMI inside of docker), but keep them away from your code during development.

Installation

npm install serverless-custom-packaging-plugin --save-dev

This installs the plugin into your node_modules and adds the dev-dependency to your package.json.

How to use it

plugins:
  - serverless-custom-packaging-plugin
...
functions:
  myFunction:
    ...
    package:
      path: path/to/my/code
      artifact: path/to/my/artifact.zip
      libs: path/to/libs 
      include_globs:
        - "**/*.py"
        - "**/*.json"

Tested with ...

| Serverless version | serverless deploy | serverless package -f <function-name> | serverless deploy function -f <function_name> | comment | |:---:|:---:|:---:|:---:|---:| | 1.10.0 | | | | | 1.11.0 | | | | not tested | | 1.12.0 | | | | not tested | | 1.13.0 | | | |not tested | | 1.14.0 | | | | | 1.15.0 | | | | | 1.16.0 | | | | | 1.17.0 | | | / | everything works when patched | | 1.18.0 | | | | package.individually = true must be set

Patches

We have created a couple of patches (so far only for serverless version 1.17.0) to get all the functionality we needed working. You are free to use these patches, but be aware that this could potentially break (other) serverless functionality.

A word of caution

This is a work in progress. This means no guarantees that everything will work as promised. If you would like some more functionality you are welcome to contribute. We greatly appreciate any testing you do with different serverless versions and setups.