0.0.7 • Published 5 months ago
nx-codeowners-plugin v0.0.7
nx-codeowners-plugin
An NX plugin alternative to @nx/powerpack-owners
, aiming to provide a simpler API leveraging the basic CODEOWNERS
syntax at the project level. By combining actual CODEOWNERS
files at the project level, you can use your git
implementation's syntax (github, gitlab, bitbucket), without requiring adding anything to your project.json
files. Additionally, provides nice ownership statistics and CODEOWNERS
validation
Install
nx add nx-codeowners-plugin
Generators
Sync Workspace CODEOWNERS
Compile all the Project-level CODEOWNERS
file to a single root CODEOWNERS
file. The generator respects your existing base CODEOWNERS
file, appending the project CODEOWNERS
content to the end.
It is also recommended to setup as a Global Sync Generator and run nx sync
as a git hook.
NX >= 19.8
// ./nx.json
{
...,
"sync": {
"globalGenerators": ["nx-codeowners-plugin:sync-codeowners-file"]
}
}
nx sync
NX < 19.8
nx generate nx-codeowners-plugin:sync-codeowners-file
Example
Before:
# ./CODEOWNERS
* @myorg/myteam
docs/* @myorg/docs-team
# ./apps/myapp/CODEOWNERS
* @myorg/app-team
After
# ./CODEOWNERS
* @myorg/myteam
docs/* @myorg/docs-team
# NX-CODEOWNERS-PLUGIN
# The content below was auto-generated with nx-codeowners-plugin
# do not edit it by hand
# app: myapp
./apps/myapp/* @myorg/app-team
Generate Project CODEOWNERS
Generate a native CODEOWNERS file for a target project:
nx generate nx-codeowners-plugin:codeowners --project=<PROJECT_NAME> --owners=<USERS_OR_GROUPS>
Example:
# ./<PROJECT_DIR>/CODEOWNERS
* <USERS_OR_GROUPS>