lambda-dev

Develop and Bundle Your Lambda Functions With Ease

This package is no longer maintained
Last updated 5 months ago by iiroj .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install lambda-dev 
SYNC missed versions from official npm registry.

λ-dev

GitHub Actions version code size dependencies devDependencies

Develop and Bundle Your Lambda Functions With Ease.

Installation

npm install --save-dev lambda-dev

yarn add --dev lambda-dev

Usage

Development

Use lambda-dev to develop lambda functions locally. lambda-dev serve starts an Express server that proxies http requests to your lambda functions. They are transpiled with @babel/core and @babel/preset-env, with the node target set to --node [target] (default 6.10). This is done through webpack with the help of babel-loader.

lambda-dev serve --help
lambda-dev serve src/functions --node 8.10 --port 9000 --basePath /lambda

Now a given function src/functions/test.js will be invoked with requests to http://localhost:9000/lambda/test.

Build

lambda-dev build --help
lambda-dev serve src/functions build/functions --node 8.10

Bundled functions will be at build/functions.

Custom Webpack configuration

It is possible to supply a custom Webpack configuration for serving and building your Lambda functions:

lambda-dev serve src/functions --webpack-config ./my-webpack.config.js

where the default export of my-webpack.config.js should be either and object or a function. If it's an object, it will be merged with the default configuration using merge.smart from webpack-merge. If it's a function, it will receive the default configuration as its argument and should return a full valid configuration.

Custom babel configuration

It's not possible to directly supply a custom babel configuration, but you can override the webpack configuration's babel-loader options:

const myBabelOptions = require('./my-babel.config.js');

module.exports = {
  module: {
    rules: [
      {
        test: /\.js$/,
        use: {
          loader: require.resolve('babel-loader'),
          options: {
            babelrc: false,
            options: myBabelOptions
          }
        }
      }
    ]
  }
};

Lambda Function Specification

Read the official docs

Lambda functions should export a handler function that receives the following arguments:

import { Request } from 'express';

type Event = {
  path: Request.path,
  httpMethod: Request.method,
  queryStringParameters: Request.query,
  headers: Request.headers,
  body: Request.body
};

type Context = {} // Empty with `lambda-dev serve`

exports.handler: (event: Event, context: Context, callback) => callback(error: Error | null, response: Response | null);

Current Tags

  • 1.8.22                                ...           latest (5 months ago)
  • 1.8.0-0                                ...           prerelease (a year ago)

67 Versions

  • 1.8.22 [deprecated]           ...           5 months ago
  • 1.8.21 [deprecated]           ...           7 months ago
  • 1.8.20 [deprecated]           ...           8 months ago
  • 1.8.19 [deprecated]           ...           8 months ago
  • 1.8.18 [deprecated]           ...           9 months ago
  • 1.8.17 [deprecated]           ...           10 months ago
  • 1.8.16 [deprecated]           ...           a year ago
  • 1.8.15 [deprecated]           ...           a year ago
  • 1.8.14 [deprecated]           ...           a year ago
  • 1.8.13 [deprecated]           ...           a year ago
  • 1.8.12 [deprecated]           ...           a year ago
  • 1.8.11 [deprecated]           ...           a year ago
  • 1.8.10 [deprecated]           ...           a year ago
  • 1.8.9 [deprecated]           ...           a year ago
  • 1.8.2 [deprecated]           ...           a year ago
  • 1.8.1 [deprecated]           ...           a year ago
  • 1.8.0 [deprecated]           ...           a year ago
  • 1.8.0-0                                ...           a year ago
  • 1.7.2 [deprecated]           ...           a year ago
  • 1.7.1 [deprecated]           ...           a year ago
  • 1.7.0 [deprecated]           ...           a year ago
  • 1.6.0 [deprecated]           ...           a year ago
  • 1.5.10 [deprecated]           ...           a year ago
  • 1.5.9 [deprecated]           ...           a year ago
  • 1.5.8 [deprecated]           ...           a year ago
  • 1.5.7 [deprecated]           ...           a year ago
  • 1.5.6 [deprecated]           ...           a year ago
  • 1.5.5 [deprecated]           ...           a year ago
  • 1.5.4 [deprecated]           ...           a year ago
  • 1.5.3 [deprecated]           ...           a year ago
  • 1.5.2 [deprecated]           ...           a year ago
  • 1.5.1 [deprecated]           ...           a year ago
  • 1.5.0 [deprecated]           ...           a year ago
  • 1.4.10 [deprecated]           ...           2 years ago
  • 1.4.9 [deprecated]           ...           2 years ago
  • 1.4.8 [deprecated]           ...           2 years ago
  • 1.4.7 [deprecated]           ...           2 years ago
  • 1.4.6 [deprecated]           ...           2 years ago
  • 1.4.5 [deprecated]           ...           2 years ago
  • 1.4.4 [deprecated]           ...           2 years ago
  • 1.4.3 [deprecated]           ...           2 years ago
  • 1.4.2 [deprecated]           ...           2 years ago
  • 1.4.1 [deprecated]           ...           2 years ago
  • 1.4.0 [deprecated]           ...           2 years ago
  • 1.3.4 [deprecated]           ...           2 years ago
  • 1.3.3 [deprecated]           ...           2 years ago
  • 1.3.2 [deprecated]           ...           2 years ago
  • 1.3.1 [deprecated]           ...           2 years ago
  • 1.3.0 [deprecated]           ...           2 years ago
  • 1.2.2 [deprecated]           ...           2 years ago
  • 1.2.1 [deprecated]           ...           2 years ago
  • 1.2.0 [deprecated]           ...           2 years ago
  • 1.1.0 [deprecated]           ...           2 years ago
  • 1.0.1 [deprecated]           ...           2 years ago
  • 1.0.0 [deprecated]           ...           2 years ago
  • 0.2.2 [deprecated]           ...           2 years ago
  • 0.2.1 [deprecated]           ...           2 years ago
  • 0.2.0 [deprecated]           ...           2 years ago
  • 0.1.3 [deprecated]           ...           2 years ago
  • 0.1.2 [deprecated]           ...           2 years ago
  • 0.1.1 [deprecated]           ...           2 years ago
  • 0.1.0 [deprecated]           ...           2 years ago
  • 0.0.5 [deprecated]           ...           2 years ago
  • 0.0.4 [deprecated]           ...           2 years ago
  • 0.0.3 [deprecated]           ...           2 years ago
  • 0.0.2 [deprecated]           ...           2 years ago
  • 0.0.1 [deprecated]           ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (12)
Dev Dependencies (33)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |