![]() ![]() An update to these libraries would redeploy all your services. ![]() You have some common code libraries that are used across multiple services. This setup works pretty well but as your team and project grows, you run into a new issue. This included how to share code between your services and how to deploy a Serverless app with interdependent services. It's true though that one of the limitations for npm v7 workspaces right now is that we're unable to resolve local workspace dependencies, as we're only performing a npm install in the sub-package essentially.In the Organizing Serverless Projects chapter we covered the standard monorepo setup. It assumes the use of npm v7 can't say for sure that will work, would need to test it, but could be interesting □. It could be a promising pattern (assuming it works) for deploying monorepo projects containing multiple Netlify sites with shared local dependencies. I need to test out the following (haven’t yet because I should be working). Each git push leads to recompiling the exact same dependencies 4 - 5 times (once per site) which is very slow and costly.Īssuming you're using yarn I believe that should be addressed via #526 Our case is a bit extreme because we have dependencies that need to be compiled and it takes a lot of time. Feel free to take a look and see if something could be of use for you. Also, not sure if it helps, but while working on this I've setup a couple of example test cases in this repo - under different branches. We have something more thorough being worked on. maybe that will be helpful to curb excess builds?Īnyhoo, I’m supposed to be working, so I’ll come back and test this type of configuration later if I Is there currently a full guide about using monorepos with we've got some base documentation here. TIL about the git diff :exclude() pattern. # set the repo root as the base folder so that `npm install` runs in that context # we want npm v7 workspaces install behavior and this would theoretically do that base = "././ " # since the base folder is the root of the repo, we first need to change back down into `apps/cms` before building the app command = "cd apps/cms/ & npm run build " # since the in the cms package, or in a shared package) the build runs per usual # the following git diff asks, “what changed in this latest commit, ignoring the apps/www folder” ignore = "git diff HEAD^ HEAD ':(exclude)apps/www' " Let me know if I missed anything in here, else I believe we can close this issue and move any remaining discussions around yarn workspaces to the respective issues □ This, however, is being discussed in Support for caching yarn workspaces' node_modules #479 Yarn workspaces are not properly cached #432 and feat: better cache support for JS workspaces #526 The persisting problem currently is the inability to properly cache yarn projects using workspaces.Given npm cannot detect it's running under a monorepo within a sub-directory of the project, no dependencies are hoisted, and the module is installed as if it was a regular JS project. If you're using npm and lerna or the newest npm v7 workspaces, the npm install process of your package and the respective node_modules caching should work as usual.If you want to, you can force yarn usage even in the absence of a yarn.lock file in the sub-directory via the NETLIFY_USE_YARN variable.Currently, you should be able to either rely on a root netlify.toml with a base directory config on your root project to deploy a single site from your monorepo, or have multiple netlify.toml configs per monorepo package, each with its own netlify site.Since this ended up working as a "catch-all" issue for many different problems with monorepo support on our build system over time, I wanted to clarify what is supported already and what's missing. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |