Skip to content

Commit de2e5fa

Browse files
Merge pull request #626 from serverless-heaven/fix/update-examples
Update all examples
2 parents 8167ca7 + 7d4c09b commit de2e5fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+26886
-22701
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ install:
1212
- npm --version
1313

1414
test_script:
15-
- npm test
15+
- npm run test
1616

1717
# Don't actually build.
1818
build: off

.travis.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,27 @@ os: linux
22
dist: xenial
33
language: node_js
44

5+
# avoid double Travis build when the PR is created on upstream
6+
if: |
7+
type = pull_request OR \
8+
branch = master
9+
510
jobs:
611
include:
712
- node_js: '10'
813
- node_js: '12'
14+
env: COVERAGE=run
915

1016
install:
1117
- travis_retry npm install
1218

1319
script:
1420
- npm run eslint
15-
- npm test
21+
- if [[ $COVERAGE = run ]]; then npm run test-coverage ; fi;
22+
- if [[ $COVERAGE = '' ]]; then npm run test ; fi;
1623

1724
after_success:
18-
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
25+
- |
26+
if [[ $COVERAGE = run ]]; then
27+
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
28+
fi
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
/\*
1+
## WARNING!
22

3-
* WARNING!
4-
*
5-
* This example is only there to show that you _can_ overtake the configuration
6-
* manually. This is _strongly discouraged_ since serverless-webpack V3 as it
7-
* does not work with individual packaging of functions and prevents you to
8-
* use optimizations like Webpack's tree shaking.
9-
\*/
3+
This example is only there to show that you _can_ overtake the configuration
4+
manually. This is *strongly discouraged* since serverless-webpack V3 as it
5+
does not work with individual packaging of functions and prevents you to
6+
use optimizations like Webpack's tree shaking.
7+
8+
You can also try to invoke a function locally:
9+
```
10+
serverless invoke local --function=first --path=./event.json
11+
```

examples/babel-multiple-statically-entries/WARNING

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

examples/babel-multiple-statically-entries/first.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if (!global._babelPolyfill) {
2-
require('babel-polyfill');
3-
}
4-
51
export const hello = (event, context, cb) => {
62
const p = new Promise((resolve, reject) => {
73
resolve('success');

examples/babel-multiple-statically-entries/package.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
"author": "Nicola Peduzzi <[email protected]> (http://nikso.net)",
99
"license": "MIT",
1010
"devDependencies": {
11-
"babel-core": "^6.25.0",
12-
"babel-loader": "^7.1.1",
13-
"babel-plugin-transform-runtime": "^6.23.0",
14-
"babel-polyfill": "^6.23.0",
15-
"babel-preset-env": "^1.6.0",
16-
"serverless-webpack": "file:../../",
17-
"webpack": "^3.3.0"
11+
"@babel/core": "^7.10.5",
12+
"@babel/plugin-transform-runtime": "^7.10.5",
13+
"@babel/preset-env": "^7.10.4",
14+
"babel-loader": "^8.1.0",
15+
"babel-plugin-source-map-support": "^2.1.2",
16+
"serverless": "^1.77.1",
17+
"serverless-offline": "^6.5.0",
18+
"serverless-webpack": "file:../..",
19+
"webpack": "^4.44.1"
1820
}
1921
}

examples/babel-multiple-statically-entries/second.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if (!global._babelPolyfill) {
2-
require('babel-polyfill');
3-
}
4-
51
export const hello = (event, context, cb) => {
62
const p = new Promise((resolve, reject) => {
73
resolve('success');

examples/babel-multiple-statically-entries/serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins:
66

77
provider:
88
name: aws
9-
runtime: nodejs6.10
9+
runtime: nodejs12.x
1010

1111
# Individual packaging MUST NOT be enabled as we use static entry definitions!
1212
# package:

examples/babel-multiple-statically-entries/webpack.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
const path = require('path');
2+
const slsw = require('serverless-webpack');
23

34
module.exports = {
45
entry: {
56
first: ['./first.js'],
67
second: ['./second.js']
78
},
89
target: 'node',
10+
mode: slsw.lib.webpack.isLocal ? 'development': 'production',
911
module: {
1012
rules: [
1113
{

0 commit comments

Comments
 (0)