From a14f45c772a35212b513dab0f66c6c61235bf54e Mon Sep 17 00:00:00 2001
From: Oleksandr Ladnov <ladnovsasha@gmail.com>
Date: Tue, 14 Aug 2018 11:14:53 +0300
Subject: [PATCH 1/2] Fix windows symlink creation

---
 src/index.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/index.ts b/src/index.ts
index ef134950..7e805d52 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -138,12 +138,12 @@ export class TypeScriptPlugin {
   async copyExtras() {
     // include node_modules into build
     if (!fs.existsSync(path.resolve(path.join(buildFolder, 'node_modules')))) {
-      fs.symlinkSync(path.resolve('node_modules'), path.resolve(path.join(buildFolder, 'node_modules')))
+      fs.symlinkSync(path.resolve('node_modules'), path.resolve(path.join(buildFolder, 'node_modules')), 'dir')
     }
 
     // include package.json into build so Serverless can exlcude devDeps during packaging
     if (!fs.existsSync(path.resolve(path.join(buildFolder, 'package.json')))) {
-      fs.symlinkSync(path.resolve('package.json'), path.resolve(path.join(buildFolder, 'package.json')))
+      fs.symlinkSync(path.resolve('package.json'), path.resolve(path.join(buildFolder, 'package.json')), 'file')
     }
 
     // include any "extras" from the "include" section

From f45b1212016d5456acd54a0ffbe9a3a8c7a3398e Mon Sep 17 00:00:00 2001
From: Oleksandr Ladnov <ladnovsasha@gmail.com>
Date: Fri, 5 Oct 2018 12:52:38 +0300
Subject: [PATCH 2/2] Add support for serverless-plugin-simulate

---
 README.md    | 15 +++++++++++++++
 src/index.ts |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/README.md b/README.md
index 16b7d00a..e579f231 100644
--- a/README.md
+++ b/README.md
@@ -120,6 +120,21 @@ plugin as follows:
 
 Run `serverless offline start`.
 
+#### serverless-plugin-simulate
+
+Add the plugins to your `serverless.yml` file and make sure that `serverless-plugin-typescript`
+precedes `serverless-plugin-simulate` as the order is important:
+```yaml
+  plugins:
+    ...
+    - serverless-plugin-typescript
+    ...
+    - serverless-simulate-simulate
+    ...
+```
+
+`serverless-plugin-typescript` attaches to `simulate lambda` and `simulate apigateway` events
+
 #### Other useful options
 
 You can reduce the clutter generated by `serverless-offline` with `--dontPrintOutput` and
diff --git a/src/index.ts b/src/index.ts
index 7e805d52..03b6efac 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -39,6 +39,8 @@ export class TypeScriptPlugin {
         await this.compileTs()
         this.watchAll()
       },
+      'before:simulate:lambda:start': this.compileTs.bind(this),
+      'before:simulate:apigateway:initialize': this.compileTs.bind(this),
       'before:package:createDeploymentArtifacts': this.compileTs.bind(this),
       'after:package:createDeploymentArtifacts': this.cleanup.bind(this),
       'before:deploy:function:packageFunction': this.compileTs.bind(this),