Tags
Tags are used to selectively apply checks and constraints to packages.
Tags are defined in a package configuration file located in your package’s root directory.
Commonality Studio is the best way to create and edit tags for packages. Start Studio in any JavaScript project by running: npx commonality studio
Tags allow you to group packages by their purpose, concern, or domain without a tight coupling to directory structure.
Below are some examples for inspiration but tags can be used to create any grouping that best suits your project.
Tooling
Tags can be used to enforce a consistent toolchain for subsets of packages.
Examples:
- Check that packages with the
buildable
tag havebuild
anddev
scripts. - Check that packages with the
testable
tag have atest
script and avitest.config.ts
file. - Check that packages with the
typed
tag havetypescript
as a devDependency.
Concern
Tags can be used to create a hierarchy of packages based on their concern.
Examples:
- Enforce that no package can depend on a package with the tag
deployable
. - Enforce that packages with the tag
config
can only depend on packages also with the tagconfig
. - Enforce that a database utility package with the tag
data
cannot depend on packages with the tagui
.
Domain
Tags can be used to create separation between teams or domains working in the same monorepo.
- Limit that packages with the tag
marketing
can only depend on packages with the tagmarketing
orshared
.
Workflow
Tags can be used to create workflows like deprecating or creating beta warnings.
- Enforce that packages with the tag
high-stability
cannot depend on package with the tagbeta
. - Enforce that no package can depend on a package with the tag
deprecated
.
Was this page helpful?