Skip to content

Simple Serverless plugin for validating local installed Node.js version before packaging and deployment

License

Notifications You must be signed in to change notification settings

sunnycyy/serverless-local-nodejs-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Local Node.js Manager

Simple Serverless plugin for validating local installed Node.js version before packaging and deployment.

serverless license npm

Installation

Install via Serverless

serverless plugin install -n serverless-local-nodejs-manager

Install via NPM

Install the plugin via NPM:

npm install --save-dev serverless-local-nodejs-manager

Then register it in the plugin section of servereless.yml:

# serverless.yml file

plugins:
  - serverless-local-nodejs-manager

Configuration

Add localNodejsVersion value in the custom section of serverless.yml, specify the target installed Node.js version with one of the following format:

  • x (allow any minor and patch versions under specific major version)
  • x.y (allow any patch versions under specific major and minor version)
  • x.y.z (ONLY allow specific version)

For example:

# serverless.yml file

custom:
  localNodejsVersion: '16.18.1'

Usage

When running serverless package, serverless deploy or serverless deploy function, local installed Node.js version will be checked to make sure it matches the target installed version specified. Exception will be thrown when running the above commands if the installed Node.js version does not match the target installed version specified.

For example:

If localNodejsVersion is set to 16:

Installed Node.js version Allow?
16.18.0
16.18.1
16.19.1
14.21.3
18.15.0

If localNodejsVersion is set to 16.18:

Installed Node.js version Allow?
16.18.0
16.18.1
16.17.1
16.19.1

If localNodejsVersion is set to 16.18.1:

Installed Node.js version Allow?
16.18.1
16.18.0

About

Simple Serverless plugin for validating local installed Node.js version before packaging and deployment

Topics

Resources

License

Stars

Watchers

Forks