npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

add-dependabot

v1.3.7

Published

A CLI tool to add Dependabot configuration once dependencies are present.

Downloads

102

Readme

add-dependabot

add-dependabot is an npm package that automatically adds a dependabot.yml configuration file to your repository if dependencies are detected in package.json. This allows Dependabot to keep your npm dependencies up-to-date with minimal effort.

Features

  • Automatically detects dependencies in package.json and creates a .github/dependabot.yml file.
  • Sets up a customizable update schedule for npm dependencies.
  • Skips configuration if no dependencies are found in the project.
  • Offers user-friendly prompts to configure Dependabot using checkboxes.
  • Supports command-line flags for specifying update intervals and modes.

Usage (To use in repo without adding to package.json)

Once installed, run the following command in the root directory of your project:

npx add-dependabot

This will:

  1. Check if your package.json contains any dependencies.
  2. If dependencies are found, it creates a .github/dependabot.yml file based on user input.
  3. If the file already exists, it skips creating a new one and logs a message.

Command-Line Flags

You can also use command-line flags to specify the update interval and mode:

  • Mode Options:

    • --local: Creates a direct dependabot.yml file in the .github directory.
    • --action: Sets up a GitHub Actions workflow for Dependabot updates.
  • Interval Options:

    • --daily: Sets Dependabot to check for updates daily.
    • --weekly: Sets Dependabot to check for updates weekly (default).
    • --monthly: Sets Dependabot to check for updates monthly.

Example command with flags:

npx add-dependabot --mode local --interval weekly

Installation

To install add-dependabot globally, use the following command:

npm install -g add-dependabot

Or add it to your project as a dev dependency:

npm install --save-dev add-dependabot

File Structure

  • .github/
    • dependabot.yml (if applicable)
    • workflows/
      • dependabot-action.yml (created by the script)

Example

A typical run might look like:

$ npx add-dependabot
Checking for dependencies...
Dependencies detected. Adding Dependabot configuration...
Dependabot configuration file created at .github/dependabot.yml

If you use command-line flags:

$ npx add-dependabot --mode action --interval daily
Creating GitHub Actions workflow for checking Dependabot...
GitHub Actions workflow created at .github/workflows/dependabot.yml

Configuration

The generated .github/dependabot.yml file will look like this:

version: 2
updates:
  - package-ecosystem: 'npm'
    directory: '/'
    schedule:
      interval: 'weekly' # Adjusts based on user input

You can manually adjust the update schedule or other settings in the generated file.

Troubleshooting

  • Dependabot configuration already exists: If the .github/dependabot.yml file already exists, the package will not overwrite it. You can manually edit the file if you need to change the schedule or other settings.
  • No dependencies found: If the script detects no dependencies in package.json, it will skip creating the configuration file.

Contributing

Contributions are welcome! Please feel free to contact me here - GitHub to submit a pull request or open an issue if you find a bug or have a feature request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Developed by Prathamesh Shanbhag.

Key Additions

  1. Command-Line Flags Section: Explained the options for the mode (local or action) and the intervals (daily, weekly, monthly).
  2. Example with Flags: Provided an example of how to use the command with flags to clarify usage.

Codebase

  1. NPM.
  2. Github.