Does anyone have any suggestions on how to structure a codebase that contains multiple services and has some library code that can be shared between various services? For example:
If you then have this in your serverless.yml file:
Your zip that serverless builds will result in this:
So in FooService.js you must reference SomeSharedLibrary with
../lib/src/SomeSharedLibrary even though the real path is
../../lib/src/SomeSharedLibrary (notice the extra level of nesting).
That works, except then tests won't work because when you run tests FooService can't find SomeSharedLibrary.
So, it seems that either:
- I need to have a different way of structuring the codebase with the shared code, or
- I need to do some magic for testing to make it mimic the directory structure that Serverless will create for my deployed code, or
- I need to use symlinks or something to make the lib code appear inside the service that uses it.