Architecture for PNPM + Turborepo + Multiple Netlify sites in Monorepo

Hi!

Is there any guide or solution to use pnpm workspaces + turborepo + base directory deploy?

I have this structure:

repository-root/
├─ package.json
├─ turbo.json
├─ pnpm-workspace.yaml
├─ site-1/
│  ├─ netlify.toml
│  ├─ package.json
├─ site-2/
│  ├─ netlify.toml
│  ├─ package.json
├─ ui-library/
│  ├─ netlify.toml
│  ├─ package.json
// turbo.json
{
  "$schema": "https://turborepo.org/schema.json",
  "baseBranch": "origin/main",
  "pipeline": {
    "dev": {
      "cache": false
    },
    "build": {
      "dependsOn": [
        "^build"
      ],
      "outputs": [
        "build/**",
        "dist/**"
      ]
    }
  }
}

And these are the dependencies logic

  • site-1 build depends on ui-library build (not working)
  • site-2 build do not depends on any other build ( it works )
  • ui-library build do not depends on any other build ( it works )
// site-1 package.json
  "dependencies": {
    "@organization/ui": "../ui-library",
  }

site-1 build fails because it does not find the proper ui-library package.
If I try to add a cd .. command on the preInstall hook, the build fails with an ENOENT error

I don’t think we do have a guide for that. Our best docs on monorepos are here:

…but it just talks about our preferred layout, one subdirectory per project that is entirely contained.

Since then we’ve implemented npm workspaces support at least: feat: Support npm workspaces caching by zgriesinger · Pull Request #752 · netlify/build-image · GitHub …but I don’t think we have anything turborepo specific in our support yet.

Could you link us to the logs for a failing deploy for site-1, so we can see if we can glean any next steps by examining them? Please do link instead of copy-pasting as we’ll also use that link to find your site in our database to examine its settings there :slight_smile:

Hi!
this is the deploy url:

https://app.netlify.com/sites/amplified-io/deploys/62b35f12258ecd0008482055