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!
npm install serverless-layer-organizer --save-dev
or
yarn add serverless-layer-organizer --dev
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'
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.
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
.
├── lambda.js
├── node_modules
├── package.json
├── package-lock.json
└── .gitignore
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
// nodeModules.zip
├── nodejs
│ ├── node_modules
MIT