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-plugin-bind-deployment-id

v2.0.3

Published

Serverless plugin to bind the randomly generated deployment id to custom resources

Downloads

23,467

Readme

serverless-plugin-bind-deployment-id

Coverage Status Build Status

Bind the serverless deployment to your custom resources like magic! Simply use __deployment__ in place of anywhere you want the deployment to show up.

Usage


custom:
  myVariable: bar

resources:
  Resources:
    PathMapping:
      Type: AWS::ApiGateway::BasePathMapping
      DependsOn: ApiGatewayStage
      Properties:
        BasePath: basePath
        DomainName: ${self:provider.domain}
        RestApiId:
          Ref: ApiGatewayRestApi
        Stage: ${self:provider.stage}
    __deployment__:
      Properties:
        Description: This is my deployment
    ApiGatewayStage:
      Type: AWS::ApiGateway::Stage
      Properties:
        DeploymentId:
          Ref: __deployment__
        RestApiId:
          Ref: ApiGatewayRestApi
        StageName : ${self:provider.stage}
        MethodSettings:
          - DataTraceEnabled: true
            HttpMethod: "*"
            LoggingLevel: INFO
            ResourcePath: "/*"
            MetricsEnabled: true
    ApiGatewayStage2:
      Type: AWS::ApiGateway::Stage
      Properties:
        DeploymentId:
          Ref: __deployment__
        RestApiId:
          Ref: ApiGatewayRestApi
        StageName : myOtherStage
        Variables: [${self:custom.myVariable}]

plugins:
  - serverless-plugin-bind-deployment-id

When built, this will merge the custom properties set above with the default CloudFormation template, allowing you to apply custom properties to your Deployment or Stage. This will even allow you to add multiple Stages!

Compatibility Note

If you are using Serverless 0.12+, please use the 1.x.x plugin. For previous Serverless versions, use the 0.1.x plugin.

Advanced Usage

By default __deployment__ is the sentinel value which is replaced by the API Deployment Id. This is configurable. If you'd like to use a different value, you can set:

custom:
  deploymentId:
    variableSyntax: ApiGatewayDeployment

In this example, any instance of ApiGatewayDeployment in your custom resources will be replaced with the true deployment Id.

Known Issues

Because the deployment id is not stable across CloudFormation stack updates, you cannot make changes to the default stage with the StageDescription property. If you attempt to do so, you will see an error:

An error occurred while provisioning your stack: ApiGatewayDeployment1490846212163
     - StageDescription cannot be specified when stage referenced
     by StageName already exists.

The easiest way to get around this is to leave the default stage unused, and create a new stage that you actually use. By default, we name this default stage unused_stage, but you could change it to something else by setting:

__deployment__:
      Properties:
        StageName: myUnusedStage

Release Notes

  • 2.0.3 - Dependency security update
  • 2.0.2 - Fix default export breaking change
  • 2.0.1 - Remove serverless peer dependency (thanks @johnmee)
  • 2.0.0 - Major dependency upgrades, force node >= 12.
  • 1.2.0 - The Serverless framework has added support for the resources.extensions block, which has slightly-more-formalized merge behaviour. 1.2.0 adds support for replacing the deployment ID in the extensions block. (thanks @glb)
  • 1.1.1 - Dependency upgrades from dependabot
  • 1.1.0 - Dependency upgrade (thanks @ericsorensen)
  • 1.0.2 - Update lodash to fix known security issue (thanks @brownjava)
  • 1.0.1 - Fix peer dependency
  • 1.0.0 - Fix an incompatibility with serverless 1.12
  • 0.1.0 - Initial release

Contributors