1.0.4 • Published 6 years ago

lambda-boilerplate v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Lambda Boilerplate

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.

TemplateLanguageDescription
es2017-lambda-boilerplateNodeJSSee template page on Github
hello-worldNodeJSA 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:

VariableDescription
projectNameLambda 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.

ArgumentsDefaultDescription
lambda_pathCurrent directoryPath where new Lambda folder should be created
lambda_nameLambda project name

Use as API

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

lb.prompt(destination, srcTemplates, name)
  .then(() => {
    console.log('generated');
  })
  .catch(console.log);
ArgumentsDefaultDescription
destinationCurrent directoryPath where new Lambda folder should be created
srcTemplates../templatesLambda templates directory
nameLambda 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

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

7 years ago