Skip to content

PacktDev/serverless-plugin-package

Repository files navigation

Serverless Plugin Package

Packt serverless Greenkeeper badge npm CircleCI Codecov

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.

# Becomes name: my-awesome-service-1
name: ${package:name}-${package:semver.major}
...
custom:
  # Uses your description from package.json
  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}

About

A serverless plugin to expose package.json variables

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •