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 🙏

© 2022 – Pkg Stats / Ryan Hefner

@side/npm-dependency-stats-action

v2.3.3

Published

Github action for getting stats about npm dependencies

Downloads

50

Readme

NPM Dependency Stats Action

Github action for getting stats about npm dependencies

NPM version Build Status Code Coverage License semantic-release Code Style

NOTE: Currently only packages using yarn are supported since the yarn outdated command is used. There is a plan to support npm in the future.

Features

  • Loads dependency ignore settings from .github/dependabot.yml if it exists

Examples

Basic

The following workflow logs out dependency stats within Github Actions

name: Check Outdated Dependencies

on:
  push:
    branches:
      - main

jobs:
  check:
    name: Check Dependencies
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/[email protected]

      - name: Use Node.js
        uses: actions/[email protected]
        with:
          node-version: 16.x

      - name: Check Outdated
        id: dep-stats
        uses: reside-eng/[email protected]
        with:
          output-file: ./dep-stats.json

      - name: Message Outdated
        run: |
          echo "counts: ${{ fromJSON(steps.dep-stats.outputs.counts) }}"
          percents=${{ fromJSON(steps.dep-stats.outputs.percents) }}
          counts=${{ fromJSON(steps.dep-stats.outputs.counts) }}
          totalDeps=${{ fromJSON(steps.dep-stats.outputs.counts).total }}
          echo "counts total: $counts.total"
          echo "up to date: ${{ fromJSON(steps.dep-stats.outputs.counts).upToDate }}/$totalDeps (${{ fromJSON(steps.dep-stats.outputs.percents).upToDate }} %)"
          echo "major behind: ${{ fromJSON(steps.dep-stats.outputs.counts).major }}/$totalDeps (${{ fromJSON(steps.dep-stats.outputs.percents).major }} %)"
          echo "minor behind: ${{ fromJSON(steps.dep-stats.outputs.counts).minor }}/$totalDeps (${{ fromJSON(steps.dep-stats.outputs.percents).minor }} %)"
          echo "patch behind: ${{ fromJSON(steps.dep-stats.outputs.counts).patch }}/$totalDeps (${{ fromJSON(steps.dep-stats.outputs.percents).patch }} %)"

Save File And Upload

The following workflow saves a file of stats information which is then uploaded to Google Cloud Storage. This is useful if you would like to load this data in another tool, such as Retool.

name: Check Outdated Dependencies

on:
  push:
    branches:
      - master

jobs:
  check:
    name: Upload Dependency Stats
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/[email protected]

      - name: Use Node.js
        uses: actions/[email protected]
        with:
          node-version: 16.x

      - name: Check Outdated
        id: dep-stats
        uses: reside-eng/[email protected]
        with:
          output-file: ./dep-stats.json

      # Setup gcloud CLI for uploading to storage in "Deploy Changed Functions" step
      - name: Set up Google Cloud SDK
        uses: google-github-actions/[email protected]
        with:
          project_id: 'some-project'
          service_account_key: ${{ secrets.STAGE_SERVICE_ACCOUNT }}
          export_default_credentials: true

        # Deploy only Cloud Functions which have changed based on cache stored in Google Cloud Storage
      - name: Upload Dependency Stats To Cloud Storage
        run: |
          echo "Uploading results to cloud storage"
          echo ""
          bucket=some-project.appspot.com
          depStatsFolder=dependency-stats
          gsutil -m -q cp ./dep-stats.json gs://$bucket/$depStatsFolder/$(date +%Y-%m-%d_%H-%M-%S).json
          gsutil -m -q cp ./dep-stats.json gs://$bucket/$depStatsFolder/latest.json
          echo ""
          echo "Successfully uploaded dependency stats to Cloud Storage"

Ideas

  • ignore input to ignore dependencies (instead of loading from dependabot config)
  • Use npm outdated if yarn is not being used
  • Output stats for multiple package levels in a single run

FAQ

  1. Why is the dist folder included on major version branches? This is a built version of the action which is necessary to have in place for Github Actions to be able to use the action since the action's source code is written in Typescript (Actions runs Node). When using an exact version Github will pick up from releases, but using a major version point to the major version branch.