1.0.1 • Published 7 months ago

serverless-layer-organizer v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Serverless Layer Organizer

GitHub license NPM version

Serverless Layer Organizer is a plugin for the Serverless Framework that helps you to better organize your layers.

Create the structure you want and let us take care of the rest!

Installation

npm install serverless-layer-organizer --save-dev

or

yarn add serverless-layer-organizer --dev

Configuration

Add the plugin to your serverless.yml file:

plugins:
  - serverless-layer-organizer

Define your custom layer organization under the custom key:

custom:
  serverless-layer-organizer:
    layers:
      YourLayerName:
        pathPrefix: 'your/path/prefix'

Usage

This plugin is designed to reorganize the structure of your Serverless layers. Specifically, it allows you to set a custom path prefix for each of your layers, so that you can group and manage them more efficiently within your Serverless application.

Example: Standard layer

Assume you have a layer named commonLayer located at ./layers/common. You want the layer to be prefixed with utilities. Update your serverless.yml as follows:

custom:
  serverless-layer-organizer:
    layers:
      commonLayer:
        pathPrefix: 'utilities'

After packaging, your commonLayer will be reorganized under utilities.

Example: node_modules layer

├── lambda.js
├── node_modules
├── package.json
├── package-lock.json
└── .gitignore

Serverless.yaml

service: my-serverless

package:
individually: true

#... other configurations

layers:
  nodeModules:
    path: node_modules
    description: Node.js modules for my service


custom:
  serverless-lambda-layer-packager:
    layers:
      nodeModules:
        pathPrefix: nodejs

plugins:
- serverless-layer-organizer

Output ( zip folder):

// nodeModules.zip
├── nodejs
│   ├── node_modules

License

MIT

1.0.1

7 months ago

1.0.0

7 months ago