Skip to content

Precogs-com/lambda-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda Boilerplate

dependencies Status Build Status Coverage Status

Description

Simple generator of Lambda boilerplate. You can either use predefined boilerplate (see list below), or add your owns.

Requirements

Nodejs > 6.0.0

Installation

npm install -g lambda-boilerplate

Templates

Default templates

Default templates are stored in template folder.

Template Language Description
es2017-lambda-boilerplate NodeJS See template page on Github
hello-world NodeJS A simple hello world template with tests and lint

Use your own templates

As lambda-boilerplate can be used as a CLI, you can define your own templates directory path. You just have to export your templates directory path LAMBDA_TEMPLATES_PATH environment variable.

$ export LAMBDA_TEMPLATES_PATH=/absolute/path/to/your/templates/directory

You can also add this line to your bash profile to keep it permanent.

Template variable

For templating, we use ECT library. Following variables are availables:

Variable Description
projectName Lambda name

Use as CLI

$ lambda-boilerplate --help

  Usage: lambda-boilerplate [options] [lambda_path] [lambda_name]

  Generate a Lambda boilerplate from template

  Options:

    -V, --version  output the version number
    -h, --help     output usage information

If it sets, CLI use LAMBDA_TEMPLATES_PATH environment variable as templates directory path, otherwise it uses local templates directory.

Arguments Default Description
lambda_path Current directory Path where new Lambda folder should be created
lambda_name Lambda project name

Use as API

const lb = require('lambda-boilerplate');

lb.prompt(destination, srcTemplates, name)
  .then(() => {
    console.log('generated');
  })
  .catch(console.log);
Arguments Default Description
destination Current directory Path where new Lambda folder should be created
srcTemplates ../templates Lambda templates directory
name Lambda project name

Want to contribute ?

Wow, that's great !
Feedback, bug reports and pull requests are more than welcome !

You can test your code with:

$ git clone git@github.com:Precogs-com/lambda-boilerplate.git
$ cd lambda-boilerplate
$ npm run lint
$ npm run test

TODO

  • Add more templates in different languages
  • Support ECT variables as parameters

Inspired by @harrietty

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published