serverless-nested-yml

1.0.7 • Public • Published

NPM serverless js-standard-style MIT licensed

Serverless Nested Yml

This plugin help to tiddy your project by splitting your yaml file by sub directory. It then merge all the globed files in to one configuration.

Install

This plugin only works for Serverless 1.0 and up. And require node >= 8 to work properly

npm install serverless-nested-yml --save-dev

Next, add the serverless-nested-yml plugin in to serverless.yml file: If you don't already have a plugins section, create one that looks like this:

plugins:
  - serverless-nested-yml

To verify that the plugin was added successfully, run this in your command line:

serverless The plugin should show up in the "Plugins" section of the output as "ServerlessNestedYml"

Usage

In your main serverless.yml file you should define the common properties used by all your functions.

configure

custom:
  nestedYml:
    filename: // Filename to search | optional, string - default *serverless.yml
    paths:    // Path to search | optional, string | array - default ['src']
    exclude:  // Path to exclude from search | optional, string | array - default []
    monorepo:  // add global path to each handler and force root webpack config file | optional, boolean - default false

project structure

<root>
- serverless.yml
- src
    - service1
      - handler.js
      - serverless.yml
    - service2
      - handler.js
      - serverless.yml

main serverless.yml


service: myService

plugins:
  - serverless-nested-yml
  
provider:
  name: aws
  runtime: nodejs8.10
  stage: staging
  region: eu-west-1

service 1 serverless.yml

! headup ! The handler path is always based on the root project.

functions:
  myFunction:
    handler: src/service1/handler.handler
    events:
      - http:
          method: get
          path: /

Contribute

Help us making this plugin better and future proof.

  • Clone the code
  • Install the dependencies with npm install
  • Create a feature branch git checkout -b new_feature
  • Lint with standard npm run lint

License

This software is released under the MIT license. See the license file for more details.

Readme

Keywords

none

Package Sidebar

Install

npm i serverless-nested-yml

Weekly Downloads

1

Version

1.0.7

License

MIT

Unpacked Size

9.23 kB

Total Files

5

Last publish

Collaborators

  • goopil