Skip to content
Add scripting capabilities to the Serverless Framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Initial implementation Jan 10, 2017
.babelrc Initial implementation Jan 10, 2017
.eslintignore Initial implementation Jan 10, 2017
.eslintrc Initial implementation Jan 10, 2017
.gitignore Initial implementation Jan 10, 2017
README.md Readme: Add a link to the lifecycle events gist page Jan 16, 2018
package.json 1.0.2 Jan 10, 2017

README.md

serverless-plugin-scripts npm version

Add scripting capabilities to the Serverless Framework.

Installation

Install the plugin in your Serverless (v1.0 or higher) project:

npm install --save serverless-plugin-scripts

And activate it by adding the following configuration to your serverless.yml file:

plugins:
  - serverless-plugin-scripts

Usage

Custom commands

To add a custom command to the Serverless CLI, just define a custom.scripts.commands property in your serverless.yml file:

custom:
  scripts:
    commands:
      hello: echo Hello from ${self:service} service!

You can now run serverless hello to execute the hello command.

Simple hooks

It is possible to define simple hooks for existing Serverless CLI commands by adding a custom.scripts.hooks property in your serverless.yml file:

custom:
  scripts:
    hooks:
      'deploy:createDeploymentArtifacts': npm run compile

The next time you run serverless deploy, your script will be automatically invoked during the deploy:createDeploymentArtifacts lifecycle event.

To find out about existing lifecycle events, check out this page.

Author

Created and maintained by Manuel Vila.

License

MIT

You can’t perform that action at this time.