https://github.com/ibrado/serverless-eval-plugin
Evaluates conditional and other expressions within serverless.yml
https://github.com/ibrado/serverless-eval-plugin
Last synced: 8 months ago
JSON representation
Evaluates conditional and other expressions within serverless.yml
- Host: GitHub
- URL: https://github.com/ibrado/serverless-eval-plugin
- Owner: ibrado
- Created: 2019-09-04T11:24:55.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-16T01:49:04.000Z (over 6 years ago)
- Last Synced: 2025-02-16T20:36:32.537Z (over 1 year ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Serverless Eval Plugin
This Serverless plugin evaluates and replaces expressions within `serverless.yml`.
## Install
```
npm install --save-dev serverless-eval-plugin
```
## Usage
Add `serverless-eval-plugin` to your `serverless.yml` plugin section:
```yaml
plugins:
- serverless-eval-plugin
```
### Configuration
The only configurable option is for verbose output:
```yaml
custom:
serverless-eval-plugin:
verbose: true # (default: false) Print the resulting values during deploy
```
`serverless-eval-plugin` supports basic `eval()` support for expressions bounded by `` $`..` `` or `$|..|`.
> NOTE: Nesting `eval()`s using the same expression delimiters is currently not supported. Also, you may need to `eval()` inside a string.
```yaml
custom:
serverless-eval-plugin:
verbose: true
test: "$`'5 minutes from now is $|(new Date((new Date()).getTime() + 300000))|'`"
provider:
profile: "$`'{self:provider.stage}' === 'prod' ? 'production-minimal' : 'testing-minimal'`"
environment:
DEPLOY_TIME: $|(new Date()).getTime()|
```
which results in:
```
Serverless: serverless-eval-plugin set test to "5 minutes from now is Wed Sep 04 2019 18:29:46 GMT+0800 (PST)"
Serverless: serverless-eval-plugin set profile to "testing-minimal"
Serverless: serverless-eval-plugin set DEPLOY_TIME to "1567592686825"
```
## See also
Generate deployed version info for your Lambdas with [serverless-version-info](https://www.npmjs.com/package/serverless-version-info).
## Contribute
Please see the [Github repository](https://github.com/ibrado/serverless-eval-plugin.git).