2.1.3 • Public • Published

    NPM Version Workflow codecov MIT license



    use codeowners anywhere in your monorepo 🛠️
    Explore the docs »
    Report Bug · Request Feature

    Table of Contents

    About The Project

    CODEOWNERS are automatically requested for review when someone opens a pull request that modifies code that they own. This is a great feature, but when working on monorepos ownership is shared between teams and it becomes difficult to maintain.

    codeowners-generator allows you to position CODEOWNERS files anywhere in your project tree and it will take care of compiling all the files into a single generated file, that Github can understand. It also can read the maintainers fields (contributors, author and alternatively maintainers) in package.json (--use-maintainers option in the cli ) making easy to keep CODEOWNERS and package.json in sync. Make sure the author/contributors syntax matches with package.json expected syntax from the documentation.

    Built With


    If you wish to use codeowners-generator as a standalone utility:

    npm -g install codeowners-generator

    This will make the codeowners-generator command available in your terminal.

    codeowners-generator --help

    If instead you would like to add it to a package:

    npm install --only=dev codeowners-generator


    Every command accepts several options through command line or custom configuration see configuration for more

    Generate CODEOWNERS file

      codeowners-generator generate

    Generate CODEOWNERS file (using maintainers field from package.json)

    codeowners-generator generate --use-maintainers

    Specify CODEOWNERS (in case the CODEOWNERS files are named differently)

      codeowners-generator generate --includes '**/CODEOWNERS'


    You can configure codeowners-generator from several places:

    CLI options

    • includes (--includes): The glob used to find CODEOWNERS files in the repo default: ['**/CODEOWNERS', '!CODEOWNERS', '!node_modules']

    • output (--output): The output path and name of the file default: CODEOWNERS

    • useMaintainers (--use-maintainers): It will use maintainers field from package.json to generate codeowners, by default it will use **/package.json

    • groupSourceComments (--group-source-comments): Instead of generating one comment per rule, enabling this flag will group them, reducing comments to one per source file. Useful if your codeowners file gets too noisy.

    • customRegenerationCommand (--custom-regeneration-command): Specify a custom regeneration command to be printed in the generated CODEOWNERS file, it should be mapped to run codeowners-generator (e.g. "npm run codeowners").

    For more details you can invoke:

      codeowners-generator --help

    Custom Configuration

    You can also define custom configuration in your package:

      "name": "my-package",
      "codeowners-generator": {
        "includes": ["**/CODEOWNERS"],
        "output": ".github/CODEOWNERS",
        "useMaintainers": true,
        "groupSourceComments": true,
        "customRegenerationCommand": "npm run codeowners"
      "scripts": {
        "codeowners": " codeowners-generator generate"
      "devDependencies": {
        "codeowners-generator": "^1.0.0"

    When the command is invoked it will look for the codeowners-generator configuration block.

    (my-package)$ npm run codeowners

    Custom configuration can be defined in many places, for more information check cosmiconfig


    See the open issues for a list of proposed features (and known issues).


    Contributions are what makes the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated greatly appreciated.

    1. Fork the Project
    2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
    3. Commit your Changes (git commit -m 'Add some AmazingFeature')
    4. Push to the Branch (git push origin feature/AmazingFeature)
    5. Open a Pull Request


    Distributed under the MIT License. See LICENSE for more information.

    follow on Twitter follow on Twitter


    npm i codeowners-generator

    DownloadsWeekly Downloads






    Unpacked Size

    1.95 MB

    Total Files


    Last publish


    • gagoar