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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@actionforge/nx

v0.1.0

Published

Query an Nx workspace from plain Node — project graph, all projects, and projects affected between two git SHAs, with their source roots

Readme

@actionforge/nx

Query an Nx workspace from plain Node: list every project, list the projects affected between two git SHAs, resolve projects to their source roots, and pull the whole project graph.

Why this exists

"Which projects changed between these two commits?" is the question every monorepo CI pipeline needs answered, and Nx already knows. But the original of this code was welded to @actions/exec and @actions/core, so it only ran inside a GitHub Actions runner — you could not use it from a pre-commit hook, a local script, or any other CI system.

This version shells out with node:child_process and logs through an injectable logger, so it works anywhere Node and Nx do.

This package is deliberately Nx-specific. It is not an abstraction over "any monorepo tool" — Nx's affected-graph is a real feature with real semantics, and pretending it is interchangeable with Turborepo's would make both worse.

Install

npm install @actionforge/nx

Nx itself is not a dependency — this package shells out to whatever nx your workspace already has.

Usage

import { buildNxAffectedProjects, getNxAffectedProjects } from '@actionforge/nx'

// Just the names
await getNxAffectedProjects({ baseSha: 'origin/main', headSha: 'HEAD' })
// ['api', 'web']

// Names resolved through to their source directories
await buildNxAffectedProjects({
  baseSha: 'origin/main',
  headSha: 'HEAD',
  excludes: ['e2e'],
})
// ['apps/api/src', 'apps/web/src']

API

| Function | Returns | | --- | --- | | getNxProjects({ excludes? }) | Every project name | | getNxAffectedProjects({ baseSha?, headSha?, excludes? }) | Affected project names | | getNxProject(name) | One project's full Nx configuration | | getNxSourceRoots(names) | sourceRoot for each name | | buildNxProjects({ excludes? }) | Source roots of every project | | buildNxAffectedProjects({ baseSha?, headSha?, excludes? }) | Source roots of affected projects | | buildNxGraph() | The parsed Nx project graph |

Every function accepts NxOptions:

| Option | Default | Purpose | | --- | --- | --- | | cwd | process.cwd() | Workspace root | | env | — | Extra environment variables | | timeout | — | Milliseconds before the child is killed | | logger | silent | debug/info/warn/error sink | | nxCommand | ['npx', 'nx'] | How to invoke Nx | | run | execFile | Command-runner seam |

Point nxCommand at your package manager to skip npx resolution:

await getNxProjects({ nxCommand: ['pnpm', 'exec', 'nx'] })

Errors are errors

A failed Nx command throws an NxCommandError carrying the exit code and both streams.

This is a deliberate behaviour change from the original, which caught every failure and returned []. In an affected-projects check that reads as "nothing changed, skip every downstream job" — a silently green, completely wrong build. If you genuinely want the old behaviour, opt into it explicitly:

const affected = await getNxAffectedProjects({ baseSha, headSha }).catch(() => [])

Testing code that uses this

Swap the run option for a fake instead of standing up a real Nx workspace:

import { buildNxAffectedProjects, type CommandRunner } from '@actionforge/nx'

const run: CommandRunner = async (_cmd, args) => {
  if (args.includes('projects')) {
    return { exitCode: 0, stdout: 'api\nweb\n', stderr: '' }
  }
  return { exitCode: 0, stdout: JSON.stringify({ sourceRoot: 'apps/api/src' }), stderr: '' }
}

await buildNxAffectedProjects({ run, baseSha: 'main', headSha: 'HEAD' })

License

MIT © Andrew Cates