1.0.0 • Published 1 year ago

serverless-local-nodejs-manager v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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 versionAllow?
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 versionAllow?
16.18.0
16.18.1
16.17.1
16.19.1

If localNodejsVersion is set to 16.18.1:

Installed Node.js versionAllow?
16.18.1
16.18.0