JSPM

serverless-plugin-staging

0.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q31931F
  • License MIT

Handling stage specific deployment for functions and resources

Package Exports

  • serverless-plugin-staging

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serverless-plugin-staging) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Serverless Staging

Downloads Version License

A plugin to restrict the deployment of resources or functions on a per stage basis.

Installation

npm install serverless-plugin-staging --save-dev

or

yarn add serverless-plugin-staging --dev

Usage

In your project's serverless file, add serverless-plugin-staging within the plugins entry.

Example:

plugins:
  - serverless-plugin-staging

Configuration

To restrict which assets are deployed within a stage, create a custom variable named staging. Within that staged variable, excludeFunctions will be used to control what functions are ignored during a deployment, and the excludeResources to control the resources.

Example excluding the function prodFunctionHandler from deploying on beta stage

custom:
  staging:
    excludeFunctions:
      beta: 
        - prodFunctionHandler

Example excluding the Uploads S3 Bucket from deploying on beta stage

custom: 
  staging:
    excludeResources:
      beta:
        - UploadsBucket

Complete Example

service: serverless-plugin-staging-example

custom: 
  staging:
    excludeFunctions:
      beta:
        - prodFunctionHandler
    excludeResources:
      beta:
        - UploadsBucket

provider:
  name: aws
  runtime: nodejs8.10
  region: us-west-2 

functions:
  prodFunctionHandler:
    handler: handlers.prodLambda
  normalFunctionHandler:
    handler: handlers.normalLambda

resources: 
  Resources:
    UploadsBucket:
      Type: AWS::S3::Bucket
      Properties:
        BucketName: Uploads

plugins:
  - serverless-plugin-staging