babel-preset-latest is automatically included, but you can easily add additional presets and plugins.
To get started, download the latest template files:
$ curl -o- https://ribjyr1g9l.execute-api.us-east-1.amazonaws.com/nodelambdababeltemplate/latest | bash
Before running the command above, please take a look at https://ribjyr1g9l.execute-api.us-east-1.amazonaws.com/nodelambdababeltemplate/latest directly. Piping anything unknown through
bashcan be dangerous!
The install script is created using this: https://gist.github.com/flesch/8ed6f47942350e858ebd3283e10f8a9b.
To download a specific release, use the following:
$ curl -o- https://ribjyr1g9l.execute-api.us-east-1.amazonaws.com/nodelambdababeltemplate/v2.1.0 | bash
Or clone this repository and remove the
$ git clone --depth 1 https://github.com/flesch/node-lambda-babel-template.git && cd node-lambda-babel-template && rm -rf .git
Next, install the dependencies.
$ npm install
postinstall npm hook will run
node-lambda setup, giving you the
See https://github.com/motdotla/node-lambda#setup for more details.
AWS_HANDLER are defined in the npm
webpack will watch
index.js and transform it as
dist/index.js while you make changes.
$ npm start
.babelrc to add addtional plugins and presets.
You can test your changes by running:
$ npm test
event.json to mock your event.
To deploy your compiled
index.js to AWS Lambda, simply run:
$ npm run deploy
predeploy npm hook will recompile
index.js using Webpack in production mode.
node-lambda deploy is then executed, including
(The MIT License)
Copyright (c) 2016 John Flesch.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.