0.0.7 • Published 9 months ago

@walery/serverless-plugin-stencil v0.0.7

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

serverless-plugin-stencil

Serverless plugin for templating content in serverless.yml files.

Usage

serverless-plugin-stencil is a serverless plugin that can load templates into a serverless.yml file. To make it possible you need to create a npm module that is marked as stencil module. This can be done by adding @walery/serverless-plugin-stencil property to the package.json file:

{
  // ...

  "@walery/serverless-plugin-stencil": {
    "alias": "account"
  }
}

The alias property is the only one you can add. This property is mandatory and can't be omit. The alias property contains value of stencilAlias that must be unique.

Once this module is created and added as dependency, the serverless-plugin-stencil will be able to find it.

To use it in your serverless.yml file you need to do it in that way:

foo: ${stencil(<stencilAlias>):<blockName>}

The blockName is the second part that is also mandatory.

In the stencil module you need to add blocks directory on the root. In this directory you can add yaml, yml, or js files. The filename is interpreted as a blockName.

If the file is yaml or yml file then the content will be just added. If the file is a js file then the resolve function will be called. The return value will be added to the serverless.yml file.