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

Merge appsync-emulator-serverless with serverless-appsync-offline #91

Open
bboure opened this issue Feb 26, 2019 · 3 comments
Open

Merge appsync-emulator-serverless with serverless-appsync-offline #91

bboure opened this issue Feb 26, 2019 · 3 comments

Comments

@bboure
Copy link
Contributor

bboure commented Feb 26, 2019

I was wondering if we should merge this repo and https://github.com/aheissenberger/serverless-appsync-offline

Does this repo make sense as a standalone?
I see a couple of refactoring that would simplify everything.
As a Serverless plugin, you receive in the constructor the Serverless instance which I think would remove all the responsibility from the emulator form parsing the yml and instantiating its own (incomplete and wrongly configured) Serverless instance which by the way adds overhead.

If I am not mistaken, The serverless instance would already come with the service object containing everything the emulator needs.

Right now, things like sls offline start ---stage local --profile foo does not work because the dummy Serverless instance (ServerlessConfig) uses dev for stage by default and I assume the default profile.

Or Did I miss something?

Thanks

@lightsofapollo
Copy link
Contributor

Not opposed to this but when we built this library initially the conversations we had (some with aws) included using the code with other platforms than serverless. I still have vague dreams to do this so I would be very open to refactoring to make this lib easier to use with serverless as a plugin but I am less supportive of a future where this only works with serverless. I would like to move in the opposite direction where we can integrate with other platforms such as the new amplify tooling/plugins.

@bboure
Copy link
Contributor Author

bboure commented Feb 27, 2019

@lightsofapollo I get your point; and I agree.
In that case we should move in a direction where createServer receives normalized object containing all the info needed: schema, datasources, templates.

Then anything using the emulator your be responsible of normalizing the input and pass it to the emulator.

In this case, the appsync-offline plugin would extract the info from the serverless instance, normalize it, and inject it into the emulator.

@lightsofapollo
Copy link
Contributor

@bboure I love that approach!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants