Turborepo

boundaries

Experimental

Boundaries ensure that Turborepo features work correctly by checking for package manager Workspace violations.

Terminal
turbo boundaries

This feature is experimental, and we're looking for your feedback on the Boundaries RFC.

This command will notify for two types of violations:

  • Importing a file outside of the package's directory
  • Importing a package that is not specified as a dependency in the package's package.json

Tags

Boundaries also has a feature that lets you add tags to packages. These tags can be used to create rules for Boundaries to check. For example, you can add an internal tag to your UI package:

./packages/ui/turbo.json
{
  "tags": ["internal"]
}

And then declare a rule that packages with a public tag cannot depend on packages with an internal tag:

./turbo.json
{
  "boundaries": {
    "tags": {
      "public": {
        "dependencies": {
          "deny": ["internal"]
        }
      }
    }
  }
}

Alternatively, you may want public packages to only depend on other public packages:

turbo.json
{
  "boundaries": {
    "tags": {
      "public": {
        "dependencies": {
          "allow": ["public"]
        }
      }
    }
  }
}

Likewise, you can add restrictions for a tag's dependents, i.e. packages that import packages with the tag.

turbo.json
{
  "boundaries": {
    "tags": {
      "private": {
        "dependents": {
          "deny": ["public"]
        }
      }
    }
  }
}

Tags allow you to ensure that the wrong package isn't getting imported somewhere in your graph. These rules are applied even for dependencies of dependencies, so if you import a package that in turn imports another package with a denied tag, you will still get a rule violation.

hours

Total Compute Saved
Get started with
Remote Caching →

On this page