exile.watch engineering
  • exile.watch engineering blog
  • April 2024
    • Why doesn't Dependabot update package.json?
  • March 2024
    • The savior amidst the chaos of dependency updates - Dependabot
    • Why project's local setup instructions are not part of README?
    • Leveraging Lefthook to enforce commit guidelines at exile.watch
    • The package manager of exile.watch
    • Lerna - the hidden powerhouse of exile.watch
      • 1. Separate repository and monorepo tool
      • 2. A module bundler - the fun begins
      • 3. Module registry (a place where packages get to chill)
      • 4. Versioning, Publishing, and Configuring lerna.json for Commit Conventions
      • 5. Some automation magic using the (Lerna) CLI
      • 6. How does one test lerna packages at exile.watch: locally and in the real world
    • To open source or to not open source
    • exile.watch architecture
Powered by GitBook
On this page
  • Enter Dependabot
  • Enabling the budget Skynet
  • Group updates

Was this helpful?

  1. March 2024

The savior amidst the chaos of dependency updates - Dependabot

4 min read

PreviousWhy doesn't Dependabot update package.json?NextWhy project's local setup instructions are not part of README?

Last updated 1 year ago

Was this helpful?

I briefly touched on Dependabot in , but now it's time to dive deeper into the topic.


So, you have a list of . Sometimes it's short, sometimes it's a mile long.

But the big question is, how do you keep those dependencies up-to-date?

Sure, that's one approach, reacting to warnings that pop up post-install.

But this mainly applies to security updates.

What about regular dependency updates, like bumping from a patch version to a minor version, or from a minor version to a major version, without security concerns?

Enter Dependabot

Here's what that might look like:

# {root}/.github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
  directory: "/"
  schedule:
    interval: "weekly"

Pretty straightforward, right?


Now, you might wonder: "Okay, automated pull requests sound great, but what if we have tons of dependencies? Will it flood our repo with individual pull requests for each one?"

So, am I suggesting that every project gets bombarded with a barrage of pull requests on a weekly (or whatever interval you set) basis for every single dependency update?

But here's the game-changer:

Group updates

It allows you to group sets of dependencies (by package manager) so that Dependabot can open a single pull request to update multiple dependencies simultaneously.

# {root}/.github/dependabot.yml
version: 2
registries:
  github:
    type: npm-registry
    url: https://npm.pkg.github.com
    token: ${{ secrets.GH_TOKEN }}
updates:
  - package-ecosystem: "npm"
    directory: "/"
    registries: [github]
    schedule:
      interval: "weekly"
      day: "saturday"
      time: "10:35"
      timezone: "Europe/Warsaw"
    groups:
      exile-watch-build-tools:
        patterns:
          - "@exile-watch/biome-config"
          - "@exile-watch/conventional-changelog-config"
          - "@exile-watch/lefthook-config"
          - "@exile-watch/postcss-config"
          - "@exile-watch/rollup-config"
          - "@exile-watch/typescript-config"
      exile-watch-design-system:
        patterns:
          - "@exile-watch/writ-icons"
          - "@exile-watch/writ-react"
      exile-watch-data:
        patterns:
          - "@exile-watch/encounter-data"

You might notice the registries field:

registries:
  github:
    type: npm-registry
    url: https://npm.pkg.github.com
    token: ${{ secrets.GH_TOKEN }}

By default, when using the npm registry, there's no need to specify the registry.

# {root}/.github/dependabot.yml
version: 2
registries:
  github:
    type: npm-registry
    url: https://npm.pkg.github.com
    token: ${{ secrets.GH_TOKEN }}
updates:
  - package-ecosystem: "npm"
    directory: "/"
    registries: [github]
    schedule:
      interval: "weekly"
      day: "saturday"
      time: "10:35"
      timezone: "Europe/Warsaw"
    groups:
      exile-watch:
        patterns:
          - "@exile-watch*"
      rollup-config-deps:
        patterns:
          - "@rollup*"
      lefthook-config-deps:
        patterns:
          - "@commitlint*"
          - "commitizen"
          - "lefthook"
          - "cz-conventional-changelog"
      unit-testing-config-deps:
        patterns:
          - "@testing-library*"
          - "vite-tsconfig-paths"
          - "vitest"

With this approach, managing our dependencies suddenly feels like a walk in the park, and the once daunting architecture, brimming with countless dependencies, doesn't seem so scary anymore :).


?

is GitHub's solution for automated dependency updates, covering a wide range of programming languages including Ruby, JavaScript, Python, .

Enabling the budget

All it takes is adding a config file to your .github repo directory.

Yes, that's exactly what would happen. And at , with our multitude of dependencies spread across projects, that could easily become overwhelming.

.

are a lifesaver, especially for those managing extensive dependency lists.

This feature was long requested and for good reason.

Even with grouped updates, if there's a security concern with one of the packages, to address the vulnerability promptly, ensuring you're always informed of potential risks.

Here's an example dependabot.yml that uses:

However, , we needed to include this field.

In the case of the project, I've opted for grouping all internal dependencies. Meanwhile, for the project, the strategy is to group updates by config dependency:

And here's the result—:

Author: About exile.watch: Github: Visit to experience it first hand

npm audit fix
Dependabot
and many more
Skynet
dependabot.yml
exile.watch
By default, yes, Dependabot opens a separate pull request for each dependency update
Group updates
relatively new
Dependabot will still prioritize a separate pull request
exile.watch
since exile.watch has chosen to host packages on GitHub's NPM registry
crucible
splinters
grouped pull requests in action
Sebastian Krzyżanowski
https://docs.exile.watch/
https://github.com/exile-watch
https://exile.watch/
dependencies
this section
exile.watch logo
List of group pull requests opened by Dependabot