#monorepo #dependabot #configuration #package #generate #config-file #language

app monorepo-dependabot-config

A tool to generate Dependabot configuration for a monorepo with multiple languages

4 releases

0.1.3 May 6, 2024
0.1.2 Jan 12, 2024
0.1.1 Jan 12, 2024
0.1.0 Jan 12, 2024

#573 in Development tools

MIT license

12KB
143 lines

monorepo-dependabot-config

Problem: Dependabot configuration files are hard to maintain in a monorepo. It can't auto discover the different package ecosystems in the monorepo. Solution: A tool that can auto generate dependabot configuration files based on the package ecosystems in the monorepo.

Features

  • Generate dependabot configuration files based on the package ecosystems
  • Detect package ecosystems based on the files in the monorepo
  • Have a configuration file to specify extra rules
  • Have default rules for common package ecosystems

Quick Star

Just run the monorepo-dependabot-config . command in the root of your monorepo. It will generate a dependabot configuration file based on the package ecosystems it finds in the monorepo.

You can also run this in CI to validate no package/project is left behind.

How to install

Install from crates.io

cargo install monorepo-dependabot-config

Build from source

After cloning the repository run:

cargo run

How to Run

  1. Generate a config file for a new repository
monorepo-dependabot-config --enable-default-rules .

Will generate all the possible dependabot rules it can find.

  1. Configure specific rules
monorepo-dependabot-config --extra-configuration-file=extra-config.yml .

where the configuration is

# extra-config.yml
generators:
- detector:
    type: DIRECOTRY_HAS_FILE_FILE_MATCHING
    config:
      regex: ".*.tf"
  generated_block:
    package-ecosystem: terraform
    schedule:
      interval: daily
- detector:
    type: DIRECOTRY_HAS_FILE_FILE_MATCHING
    config:
      regex: ".*.hcl"
  generated_block:
    package-ecosystem: terraform
    schedule:
      interval: daily

Other detectors

We could also have some detectors detectors:

generators:
- detector:
    type: HAS_FILE
    config:
      file_names:
      match_type: ALL | ANY

generators:
- detector:
    type: HAS_FILE_WITH_CONTENT_MATCHING
    config:
      regex: "a-regex"

Alternative usage

The config file could have

generate:
- detector:
  direcotry-has-file-file-matching:
    regex: "aaa"
  generated_block:
    TBD

Dependencies

~6–15MB
~182K SLoC