Serverless Plugin Package
Makes package.json
variables available.in serverless.yml
, and exposes the package.json
version as its semver
components.
Installing
Install the plugin using the serverless cli
serverless plugin install -n @packt/serverless-plugin-package
Manual Installation
Install the package in your service:
npm install --save-dev @packt/serverless-plugin-package
Then register it in your plugins array in serverless.yml
:
plugins:
- "@packt/serverless-plugin-package"
Note: Don't forget to quoe the plugin name in serverless.yml
, @
has a meaning in yml.
Usage
To reference variables from your project's package.json
.
name: ${package:name}-${package:semver.major}
...
custom:
description: ${package:description}
To reference semver
parts of your project's version
:
custom:
patchVersion: ${package:semver.patch}
minorVersion: ${package:semver.minor}
majorVersion: ${package:semver.major}