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-enhanced-config

v0.0.2-0

Published

Serverless plugin to enhance configuration with template features and easier variable handling

Downloads

1

Readme

serverless-enhanced-config

A serverless plugin to enhance configuration with template features and easier variable handling.

serverless-enhanced-config uses mustache.js to improve Serverless Framework configuration functionality, flexibility and reusability.

An enhanced configuration is rendered in runtime - based on provided template and variables - and then used by serverless, replacing the regular one.

Installation

You can install serverless-enhanced-config via npm:

npm install serverless-enhanced-config

or yarn:

yarn add serverless-enhanced-config

Usage

Using the plugin is quite simple. You'll need:

  1. A valid serverless configuration to load serverless-enhanced-config, its settings and variables. For instance, the following serverless.yml:
service: helloworld #=> mandatory: serverless needs it

plugins:
  - serverless-enhanced-config

provider: #===========> mandatory: serverless needs it
  name: aws

custom:
  enhancedConfig: #===> plugin setup with template and variables
    template: template.yml
    variables:
      function:
        name: myfunc
        handler: handlers/myfunc.main
        path: mypath/myfunc
        method: get
  1. A template with proper variables placeholders. For example, the template.yml below:
service: helloworld

package:
  individually: true

plugins:
  - serverless-dotenv-plugin

provider:
  name: aws
  runtime: nodejs12.x
  stage: ${opt:stage, env:stage, 'dev'}
  region: ${opt:region, env:region, 'us-east-1'}

functions:
  {{ function.name }}:
    handler: {{ function.handler }}
    events:
      - http:
          path: {{ function.path }}
          method: {{ function.method }}
          authorizer: aws_iam

All set! You can see the enhanced configuration generated by using the serverless built-in print command:

sls print

Features

Most of the mustache.js features are supported, such as:

  • Template and variables decoupled
  • Partials (or includes)
  • Sections
  • Custom delimiters

Serverless native variables ${self.*}, ${env.*} and ${opt.*} are supported within variables and template/partials. Same is true for file includes ${file(*)}.

Examples

Author

Ricardo Aielo @aielo

License

serverless-enhanced-config is licensed under the ISC License.