aheissenberger / serverless-appsync-offline

Serverless AWS AppSync Offline Plugin - Allow to run AppSync locally for serverless framework
MIT License
90 stars 25 forks source link

Preserve of service path #6

Closed RuBAN-GT closed 5 years ago

RuBAN-GT commented 5 years ago

Good day! When you initialize the instance of appsync emulator you can pass wrong path of yml file, because other plugins (for example serverless-plugin-typescript) can mutate this.serverless object.

The real example with serverless-plugin-typescript: For instance of ServerlessAppSyncPlugin in constructor the object gets original serverless.config.servicePath, but after hooks calling this object changes and servicePath gets path with new prefix (.build). We can't know how the original object can changes, so I find simple solution: store the field with path in object properties:

In class constructor we'll add: this.servicePath = serverless.config.servicePath and this.serverless.config.servicePath callings we'll change to this.servicePath.

If it's good idea I can create the PR. Thank you!