From 78c67ed835c1c3570b345597289a8e1c598797f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Van=20der=20Auwermeulen=20Gr=C3=A9goire?= Date: Fri, 9 Jun 2017 09:49:08 +0200 Subject: [PATCH] Add lifecycle hook for serverless offline start Serverless offline has 2 root commands to start : - `serverless offline` which triggers `offline:start` life cycle hook (This is working) - `serverless offline start` which triggers `offline:start:init` and `offline:start:end` life cycle hooks (This is NOT working) The second one is important, because it has an event on start up and on end. If you want to work with serverless-offline, serverless-webpack and serverless-dynamodb-local. You need to call `sls offline start` which will also stop the db and stop serverless offline --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 240f2ebf7..f3d2c86ee 100644 --- a/index.js +++ b/index.js @@ -123,6 +123,11 @@ class ServerlessWebpack { 'before:offline:start': () => BbPromise.bind(this) .then(this.validate) .then(this.wpwatch), + + 'before:offline:start:init': () => BbPromise.bind(this) + .then(this.validate) + .then(this.wpwatch), + }; } }