Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lerna support in serverless jetpack #185

Open
s1mrankaur opened this issue Jan 15, 2021 · 2 comments
Open

lerna support in serverless jetpack #185

s1mrankaur opened this issue Jan 15, 2021 · 2 comments

Comments

@s1mrankaur
Copy link

s1mrankaur commented Jan 15, 2021

My project structure looks like the following:

--root
----shared-modules
------------packageD
-----------------serverless.yml
-----------------package.json
----packageA
--------serverless.yml
--------package.json
----packageB
--------serverless.yml
--------package.json
----packageC
--------serverless.yml
--------package.json

Requirement:

PackageA depends on sharedModules/packageD and packageB
packageB depends on packageC
packageC depends on sharedModules

As of now I am using npm (not yarn). Okay with having to change it to yarn if required for lerna to work but prefer not to.

What configurations do I need to make in serverless-jetpack for this exactly? I see it is supported but not clear on what needs to be done to achieve this.

@ryan-roemer
Copy link
Member

ryan-roemer commented Jan 15, 2021

Lerna is fully supported, and we've used Jetpack in many projects. Just make sure to have everything installed so that package*/**/*.js files can find where the installed modules are (via symlinks, root node_modules, package node_modules, etc.).

We have test fixtures specifically covering Lerna + monorepo on npm and yarn:

(Note that serverless.yml reads in serverless.js variables so just expand those and replace ../../../plugins/wrapper in plugins: with serverless-jetpack since it's just referencing this source).

Jetpack works in both "normal/legacy" mode and tracing mode. In normal mode, just make sure to read the docs about the various options most notably base and maybe roots.

The one thing open with monorepo support is preserving symlinks (see #142 ) wherein normally if you have something like packageA/node_modules/packageB <a symlink> it gets packaged as packageA/node_modules/packageB <copies all the real files>, but that's more of niche use case if you're shipping a monopackage for several lambdas to keep the size down.

@s1mrankaur
Copy link
Author

Thanks for your response. @ryan-roemer My understanding is that in lerna we specify dependencies by adding them to devDependencies. Where is that happening here?

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

No branches or pull requests

2 participants