Skip to content

Commit fd2cc04

Browse files
authored
Merge pull request #25 from irvinlim/0.4.0
0.4.0
2 parents 6f8a0c3 + cdf687b commit fd2cc04

20 files changed

Lines changed: 195 additions & 42 deletions

.babelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"commentEnd": "\n "
2020
}
2121
],
22+
"transform-es2015-modules-commonjs",
2223
"transform-es2017-object-entries",
2324
"transform-object-rest-spread",
2425
"transform-es2015-destructuring",

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
[![Travis CI](https://img.shields.io/travis/irvinlim/es2017-lambda-boilerplate.svg)](https://travis-ci.org/irvinlim/es2017-lambda-boilerplate) ![](https://codebuild.ap-southeast-1.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiNlhFcld3M3VSMFM0MEkzUlBMQk1FdDU1c1RGc2dnVlpNaDdFZHlzSnQydDVJNm9RVFhxbXA3NkYxK3QwUVd4eVZyUTRiejZ1UGhRTFJYMTJJSzNLT2ZBPSIsIml2UGFyYW1ldGVyU3BlYyI6ImRFMWxLcHo2LzJmb3YycGEiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master) [![David](https://img.shields.io/david/irvinlim/es2017-lambda-boilerplate.svg)](https://david-dm.org/irvinlim/es2017-lambda-boilerplate) [![David](https://img.shields.io/david/dev/irvinlim/es2017-lambda-boilerplate.svg)](https://david-dm.org/irvinlim/es2017-lambda-boilerplate?type=dev) [![Greenkeeper badge](https://badges.greenkeeper.io/irvinlim/es2017-lambda-boilerplate.svg)](https://greenkeeper.io/) [![GitHub](https://img.shields.io/github/release/irvinlim/es2017-lambda-boilerplate.svg)](https://github.com/irvinlim/es2017-lambda-boilerplate/releases) [![The MIT License](https://img.shields.io/badge/license-MIT-orange.svg)](http://opensource.org/licenses/MIT)
66

7-
This is a boilerplate for [AWS Lambda](https://aws.amazon.com/lambda/) Node.js 6.10.0 functions, which allows you to use the latest JavaScript [ES2017/ES8 features](https://hackernoon.com/es8-was-released-and-here-are-its-main-new-features-ee9c394adf66). The boilerplate also allows you to test your function in a Docker container (thanks to [docker-lambda](https://github.com/lambci/docker-lambda)), and also includes common configurations for CI/CD, for both [Travis CI](https://travis-ci.org/) and [AWS CodeBuild](https://aws.amazon.com/codebuild/) + [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
7+
This is a boilerplate for [AWS Lambda](https://aws.amazon.com/lambda/) Node.js 6.10.0 functions, which allows you to use the latest JavaScript [ES2016](http://2ality.com/2016/01/ecmascript-2016.html), [ES2017](http://2ality.com/2016/02/ecmascript-2017.html) and [ES2018](http://2ality.com/2017/02/ecmascript-2018.html) features. The boilerplate also allows you to test your function in a Docker container (thanks to [docker-lambda](https://github.com/lambci/docker-lambda)), and also includes common configurations for CI/CD, for both [Travis CI](https://travis-ci.org/) and [AWS CodeBuild](https://aws.amazon.com/codebuild/) + [AWS CloudFormation](https://aws.amazon.com/cloudformation/).
88

9-
## ES2017 features
9+
## Latest JavaScript features
1010

1111
This boilerplate adds support for the following most commonly used JavaScript features that are not natively supported on Node.js 6.10:
1212

@@ -19,8 +19,8 @@ This boilerplate adds support for the following most commonly used JavaScript fe
1919
| [`Object.values`](http://node.green/#ES2017-features-Object-static-methods-Object-values), [`Object.entries`](http://node.green/#ES2017-features-Object-static-methods-Object-entries) | :white_check_mark: |
2020
| [Trailing commas in function syntax](http://node.green/#ES2017-features-trailing-commas-in-function-syntax) | :white_check_mark: |
2121
| [`async`/`await`](http://node.green/#ES2017-features-async-functions) | :white_check_mark: |
22-
| **ESNEXT** | |
23-
| [Object rest/spread properties](http://node.green/#ESNEXT-candidate--stage-3--object-rest-spread-properties) | :white_check_mark: |
22+
| **ES2018/ES9** | |
23+
| [Object rest/spread properties](http://node.green/#ES2018-features-object-rest-spread-properties) | :white_check_mark: |
2424

2525
_Note: Most ES2015/ES6 are earlier features are supported._
2626

@@ -84,7 +84,7 @@ To modify the build process, you can update the CodeBuild configuration file at
8484
If you are new to AWS CI/CD tools, you can follow the official [AWS tutorial](http://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html) to set up a build pipeline using CodePipeline. Take note of the following:
8585

8686
* Set up a S3 bucket for uploading CodeBuild artifacts to.
87-
* If the CodeBuild build fails, you may need to set the `S3_BUCKET` environment variable within CodeBuild directly.
87+
* If the CodeBuild build fails, you may need to set the `S3_BUCKET` environment variable within CodeBuild directly.
8888
* Ensure that the IAM roles have the necessary permissions to access required resources, including the S3 bucket.
8989
* The CloudFormation template filename under CodePipeline settings should be `template.yml`.
9090

@@ -115,7 +115,7 @@ Remember to add more permissions as required if you need to access the SDK in yo
115115

116116
## Why?
117117

118-
### Latest ES2017/ES2016 features
118+
### Reduce callback hell with `async`/`await`
119119

120120
The highest version of Node.js supported on AWS Lambda is 6.10.0, which supports only features up to ES2015/ES6. Newer features in ES2017, such as `async`/`await`, are incredibly useful when performing network requests, such as when used with the [AWS SDK](https://github.com/aws/aws-sdk-js):
121121

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "es2017-lambda-boilerplate",
33
"description": "An ES2017 boilerplate for AWS Lambda (Node.js 6.10)",
4-
"version": "0.3.1",
4+
"version": "0.4.0",
55
"license": "MIT",
66
"repository": {
77
"type": "git",
@@ -14,6 +14,7 @@
1414
"babel-plugin-add-header-comment": "^1.0.3",
1515
"babel-plugin-array-includes": "^2.0.3",
1616
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
17+
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
1718
"babel-plugin-transform-es2017-object-entries": "0.0.4",
1819
"babel-plugin-transform-object-rest-spread": "^6.26.0",
1920
"babel-preset-env": "^1.6.1",
@@ -36,7 +37,7 @@
3637
"deploy": "npm run package && npm run deploy:run",
3738
"deploy:run": "babel-node ./bin/deploy.js",
3839
"package": "npm run build && npm run package:pack",
39-
"package:pack": "rm -f artifact.zip && cd dist/ && zip -r ../artifact.zip *",
40+
"package:pack": "rm -f artifact.zip && cd dist/ && zip -r ../artifact.zip * -x package.json package-lock.json",
4041
"spec": "npm run spec:snapshot && npm run spec:functional",
4142
"spec:snapshot": "jest spec/snapshot",
4243
"spec:functional": "jest spec/functional",

spec/functional/__fixtures__/esnext-object-rest-spread-properties/object-rest.js renamed to spec/functional/__fixtures__/es2018-object-rest-spread-properties/object-rest.js

File renamed without changes.

spec/functional/__fixtures__/esnext-object-rest-spread-properties/object-spread.js renamed to spec/functional/__fixtures__/es2018-object-rest-spread-properties/object-spread.js

File renamed without changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Functional tests for object rest/spread properties
3+
*
4+
* @see http://node.green/#ES2018-features-object-rest-spread-properties
5+
*/
6+
7+
const runTest = require('./utils/runner');
8+
const path = filename => `es2018-object-rest-spread-properties/${filename}.js`;
9+
10+
/**
11+
* @see http://node.green/#ES2018-features-object-rest-spread-properties-object-rest-properties
12+
*/
13+
it('object rest properties', function() {
14+
expect(runTest(path('object-rest'))).toEqual(true);
15+
});
16+
17+
/**
18+
* @see http://node.green/#ES2018-features-object-rest-spread-properties-object-spread-properties
19+
*/
20+
it('object spread properties', function() {
21+
expect(runTest(path('object-spread'))).toEqual(true);
22+
});

spec/functional/esnext-object-rest-spread-properties.test.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

spec/snapshot/__snapshots__/esnext-object-rest-spread.test.js.snap renamed to spec/snapshot/__snapshots__/es2018-object-rest-spread.test.js.snap

File renamed without changes.

spec/snapshot/es2016-array-includes.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { transform } = require('./__utils__');
1+
const { transform } = require('./utils');
22

33
it('array literal expression', () => {
44
const code = transform('[1, 2, 3].includes(1)');

0 commit comments

Comments
 (0)