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

@lyv/depwatch

v0.1.8

Published

Detects dependency changes so you know when you need to restore them

Downloads

17

Readme

Dep-watch

dep-watch is a tool for detecting changes to dependencies so you know whether anything needs to be restored. This is useful for workflows that involve frequent merging of other branches. Rather than always running npm i or pod install after every merge to be certain that you have the latest dependencies installed, just run dep-watch to know what to restore.

This is done by storing a snapshot of the dependencies, and comparing to the snapshot when ran. Default snapshot file is ./depwatch.cache.json. You will likely want to include the snapshot file in your .gitignore file. If you are using the default file name you can do this automatically by running depwatch gitignore from the project root.

Motivation

Most of my work is done in react-native. I am frequently changing branches, merging changes, etc. As part of my workflow I have become accustomed to running npm ci && (cd ios && pod install) frequently to ensure that all dependencies are correct before running the application. For large projects with multiple pre- and post-install scripts this often takes 2-5 minutes to run to completion. In order to save some time, I decided to build a tool that would detect if any changes were made to dependencies, so I could have confidence skipping this step without having to diff the dependency manifests manually.

Disclaimer

This library is currently being built for my specific use cases. At this time I will not be implementing requested features that are not in the Future Work section. If you have a feature that you would like to include, please contact me or put in a pull request.

Installation

npm install -g @lyv/depwatch

Usage

depwatch [command] [options]

CLI Commands

Check

Performs comparison of dependencies with the snapshot.

Gitignore

Appends an entry in the .gitignore file to prevent the default snapshot file from being commited.

Update

Updates the snapshot without running check. Recommended to add this to postinstall script to ensure that it is kept in sync.

CLI options

| Option | Alias | Description | |----------|-------|--------------------------------------------------------------| | all | -a | Checks for changes to all dependencies | | restore | -r | Restore dependencies if missing | | update | -u | Update the snapshot | | node | -n | Check for changes to JavaScript dependencies | | pods | -n | Check for changes to CocoaPod dependencies (not implemented) |

Package.json

Alternatively, you can specify configuration in the package.json file.

{
    "depwatch": {
        "cacheFile": "./cache/depwatch.cache.json", // path to dependency cache file
        "checkNode": true,                          // Whether to check JavaScript dependencies
        "restore": true                             // Whether to restore missing dependencies
    }
}

Future work

  • [ ] support for CocoaPods
  • [ ] ability to restore packages automatically from dep-watch
  • [ ] option to only restore dependencies that have changed
  • [ ] option to store configuration in .depwatchrc instead of just package.json
  • [ ] add watcher