Using Dependabot for npm package updates, you can automate your dependencies more efficiently.
For that, you’ll need to create a dependabot.yml file in your repository, in a .github directory at the project’s root. Here’s how to set it up.
Create the File
To get started with Dependabot version updates, you’ll need to specify which package ecosystem to update and where the package manifest is located.
Create a file at .github/dependabot.yml and set the minimal configuration:
|
|
This configuration:
- Uses version 2 of the Dependabot syntax
- Monitors npm packages specified in the
package.jsonfound at the root directory - Checks for updates daily and create a PR on your repository if a package needs an update
But that’s not what you’d use. I use a custom configuration so let’s look at my example for advanced configurations, which works well if you followed the steps of this previous article.
Advanced Configuration
On my Vue and Supabase project template, I have set up my dependabot.yml as follows:
|
|
When a package update exists, dependabot creates a branch and submits a new PR to merge the update to develop, if you followed the steps of this previous article.
Consequently, it will also run the CI to check the project still builds.
Wanna Learn More
Please head to the documentation for all configuration options. You might find what you’re looking for your specific need.
Follow me
Thanks for reading this article. Make sure to follow me on X, subscribe to my Substack publication and bookmark my blog to read more in the future.
Photo by Pixabay.