1.0.0 • Published 3 years ago

serverless-plugin-common v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Serverless Plugin Common

Simple plugin that updates ../common/ path and replaces it with ./common during serverless package step.

Currently, serverless-plugin-common is very simple. Technically, you can achieve the same result by creating a symlink ln -s ../common common and updating manually require functions to be:

const lib = require('./common/lib');

However, using this plugin allows you to use shared common directory without the need of symlinking:

const lib = require('../common/lib');

During packaging, the plugin will update the path. Thus, you don't need to manually change anything.

How To Use?

In your serverless.yml add:

package:
  individually: true
  patterns:
    - ../common/**

plugins:
  - serverless-plugin-common

This will copy common directory to your lambda root directory and serverless-plugin-common will update the path accordingly.

TODO - Known Issues

  • Path is hardcoded
  • Add examples