Skip to content

Commit d26b542

Browse files
committed
Merge branch 'master' into beta
2 parents f71cb40 + 48d49ce commit d26b542

22 files changed

Lines changed: 4007 additions & 2433 deletions

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: CI
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest]
18+
node-version: [10.x, 12.x, 14.x, 15.x]
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- name: Install dependencies
29+
run: npm install
30+
- name: Install Serverless
31+
run: npm install -g serverless
32+
- name: Test
33+
run: npm run test

.travis.yml

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

README.md

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# serverless-bundle [![Build Status](https://travis-ci.com/AnomalyInnovations/serverless-bundle.svg?branch=master)](https://travis-ci.com/AnomalyInnovations/serverless-bundle) [![npm](https://img.shields.io/npm/v/serverless-bundle.svg)](https://www.npmjs.com/package/serverless-bundle)
1+
# serverless-bundle [![Build Status](https://img.shields.io/github/workflow/status/AnomalyInnovations/serverless-bundle/CI)](https://github.com/AnomalyInnovations/serverless-bundle/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/serverless-bundle.svg)](https://www.npmjs.com/package/serverless-bundle)
22

33
serverless-bundle is a [Serverless Framework](https://www.serverless.com) plugin that optimally packages your ES6 or TypeScript Node.js Lambda functions with sensible defaults so you **don't have to maintain your own Webpack configs**. It uses the [serverless-webpack](https://www.github.com/serverless-heaven/serverless-webpack) plugin internally.
44

@@ -109,6 +109,7 @@ custom:
109109
- isomorphic-webcrypto # They'll be included in the node_modules/, more below
110110
forceExclude: # Don't include these in the package
111111
- chrome-aws-lambda # Because it'll be provided through a Lambda Layer
112+
excludeFiles: "**/*.test.ts" # Exclude files from Webpack that match the glob
112113
fixPackages: # Include fixes for specific packages
113114
- "formidable@1.x" # For ex, formidable@1.x doesn't work by default with Webpack
114115
copyFiles: # Copy any additional files to the generated package
@@ -417,9 +418,9 @@ custom:
417418
externals: all
418419
```
419420

420-
### Externals vs forceExclude
421+
### Externals vs forceExclude vs excludeFiles
421422

422-
The two options (`externals` and `forceExclude`) look similar but have some subtle differences. Let's look at them in detail:
423+
The three options (`externals`, `forceExclude`, and `excludeFiles`) look similar but have some subtle differences. Let's look at them in detail:
423424

424425
- `externals`
425426

@@ -429,6 +430,10 @@ The two options (`externals` and `forceExclude`) look similar but have some subt
429430

430431
These packages are available in the Lambda runtime. Either by default (in the case of `aws-sdk`) or through a Lambda layer that you might be using. So these are not included in the Lambda package. And they are also marked as `externals`. Meaning that packages that are in `forceExclude` are automatically added to the `externals` list as well. By default, `aws-sdk` is listed in the `forceExclude`.
431432

433+
- `excludeFiles`
434+
435+
These are a glob of files that can be excluded from the function resolution. This happens when you have multiple files that are in the same directory and Serverless Framework tries to use them as a function handler. For example, if you have a `index.js` and a `index.test.js` and your function is pointing to `index`, you'll get a warning saying, `WARNING: More than one matching handlers found for index. Using index.js`. To fix this, use `excludeFiles: **/*.test.js`.
436+
432437
## Support
433438

434439
- Open a [new issue](https://github.com/AnomalyInnovations/serverless-bundle/issues/new) if you've found a bug or have some suggestions.
@@ -462,10 +467,21 @@ To install locally in another project.
462467
$ npm install /path/to/serverless-bundle
463468
```
464469

470+
## Releases
471+
472+
1. Label the PRs with `breaking`, `enhancement`, `bug`, `documentation`, or `internal`
473+
2. Merge the PRs
474+
3. Generate changelog `npm run changelog`
475+
4. Draft a new release with the changelog
476+
5. Up the version based on the PR labels `npm version <major|minor|patch>`
477+
6. Push the tag `git push origin <tag_name>`
478+
7. Publish to npm `npm publish`
479+
8. Update the tag in release and publish release notes
480+
465481
## Thanks
466482

467483
This plugin would not be possible without the amazing [serverless-webpack](https://github.com/serverless-heaven/serverless-webpack) plugin and the ideas and code from [Create React App](https://www.github.com/facebook/create-react-app).
468484

469485
---
470486

471-
This plugin is maintained by [Anomaly Innovations](https://anoma.ly); makers of [Seed](https://seed.run) and [Serverless Stack](https://serverless-stack.com).
487+
This plugin is maintained by [Serverless Stack](https://serverless-stack.com).

index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ function applyWebpackOptions(custom, config) {
3232
packagePath: path.relative(
3333
config.servicePath,
3434
pkgUp.sync({ cwd: config.servicePath })
35-
)
36-
}
35+
),
36+
},
37+
excludeFiles: config.options.excludeFiles,
3738
};
3839
}
3940

@@ -75,7 +76,7 @@ class ServerlessPlugin extends ServerlessWebpack {
7576
this.serverless = serverless;
7677
this.options = options;
7778

78-
this.hooks["before:webpack:validate:validate"] = function() {
79+
this.hooks["before:webpack:validate:validate"] = function () {
7980
const service = this.serverless.service;
8081
const servicePath = this.serverless.config.servicePath;
8182

0 commit comments

Comments
 (0)