Skip to content
This repository has been archived by the owner on Sep 13, 2019. It is now read-only.

Commit

Permalink
Merge pull request #12 from ktonon/test-sls-webpack
Browse files Browse the repository at this point in the history
Updating npm dependencies.
  • Loading branch information
ktonon committed Nov 29, 2017
2 parents d7fb0e3 + 0728e7b commit 59377fa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
17 changes: 8 additions & 9 deletions demo/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,35 @@ plugins:

custom:
serverless-offline:
location: .webpack
dontPrintOutput: true

functions:
hello:
handler: hello.handler # Refers to function `handler` exported from `Hello/api.js`
handler: src/Hello/api.handler # Refers to function `handler` exported from `Hello/api.js`
events:
- http:
integration: lambda-proxy
path: /
method: ANY

config:
handler: config.handler
handler: src/Config/api.handler
events:
- http:
integration: lambda-proxy
path: /config
method: ANY

forms:
handler: forms.handler
handler: src/Forms/api.handler
events:
- http:
integration: lambda-proxy
path: /forms
method: ANY

interop:
handler: interop.handler
handler: src/Interop/api.handler
events:
- http:
integration: lambda-proxy
Expand All @@ -51,7 +50,7 @@ functions:
method: ANY

routing:
handler: routing.handler
handler: src/Routing/api.handler
events:
- http:
integration: lambda-proxy
Expand All @@ -63,15 +62,15 @@ functions:
method: ANY

pipelines:
handler: pipelines.handler
handler: src/Pipelines/api.handler
events:
- http:
integration: lambda-proxy
path: /pipelines
method: ANY

sideEffects:
handler: sideEffects.handler
handler: src/SideEffects/api.handler
events:
- http:
integration: lambda-proxy
Expand All @@ -83,7 +82,7 @@ functions:
method: ANY

quoted:
handler: quoted.handler
handler: src/Quoted/api.handler
events:
- http:
integration: lambda-proxy
Expand Down
12 changes: 2 additions & 10 deletions demo/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
const path = require('path');
const webpack = require('webpack');
const slsw = require('serverless-webpack');

const config = {
entry: {
config: './src/Config/api.js',
forms: './src/Forms/api.js',
hello: './src/Hello/api.js',
interop: './src/Interop/api.js',
pipelines: './src/Pipelines/api.js',
quoted: './src/Quoted/api.js',
routing: './src/Routing/api.js',
sideEffects: './src/SideEffects/api.js',
},
entry: slsw.lib.entries,
target: 'node', // Ignores built-in modules like path, fs, etc.

output: {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
"mocha": "^3.4.2",
"ps-list": "^4.0.0",
"rc": "^1.1.6",
"serverless": "^1.17.0",
"serverless-offline": "^3.15.1",
"serverless-webpack": "2.0.0",
"serverless": "^1.19.0",
"serverless-offline": "^3.15.3",
"serverless-webpack": "^4.1.0",
"shebang-loader": "0.0.1",
"should": "^11.2.1",
"sinon": "^2.3.8",
"strip-debug-loader": "^1.0.0",
"superagent-defaults": "^0.1.14",
"supertest": "^3.0.0",
"webpack": "^3.3.0"
"webpack": "^3.5.4"
}
}
7 changes: 4 additions & 3 deletions scripts/test-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ const startServer = () => new Promise((resolve, reject) => {
if (newBytes > 0) {
const data = Buffer.alloc(newBytes);
fs.readSync(out, data, 0, newBytes, seenBytes);
const line = data.toString('utf8');
seenBytes = stat.size;

if (/error/i.test(data)) {
reject(`test server: ${data}`);
if (/error/i.test(line)) {
reject(`test server: ${line}`);
return;
} else if (/Version: webpack \d+\.\d+\.\d+/.test(data)) {
} else if (/Serverless: Offline listening on/.test(line)) {
resolve(server.pid);
return;
}
Expand Down

0 comments on commit 59377fa

Please sign in to comment.