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

@gilangjavier/lockscript-guard

v0.1.0

Published

Detect newly introduced npm lifecycle scripts across lockfile changes.

Readme

lockscript-guard

Detect newly introduced npm lifecycle scripts (preinstall, install, postinstall, prepare) when dependencies change.

lockscript-guard helps teams review lockfile-heavy pull requests by surfacing script changes that can execute during install.

Why this exists

Dependency updates can silently introduce install-time code. Reviewing this manually in large package-lock.json diffs is painful and error-prone.

lockscript-guard turns that diff into a focused report.

Install

npm i -D @gilangjavier/lockscript-guard

Or run without installing:

npx @gilangjavier/lockscript-guard scan

CLI usage

lockscript scan [--lockfile package-lock.json] [--format text|json] [--fail-on-risk medium|high]

lockscript diff --base <git-ref> [--head <git-ref>] \
  [--lockfile package-lock.json] \
  [--format text|json] \
  [--fail-on-change] \
  [--fail-on-risk medium|high]

Example: fail CI if new lifecycle scripts appear

lockscript diff --base origin/main --fail-on-change

Example: fail CI on medium/high risk scripts

lockscript diff --base origin/main --fail-on-risk medium

Library API

import {
  parseLockfile,
  collectLifecycleScripts,
  diffLifecycleScripts,
} from "@gilangjavier/lockscript-guard";

const base = collectLifecycleScripts(parseLockfile(baseLockfileText));
const head = collectLifecycleScripts(parseLockfile(headLockfileText));
const issues = diffLifecycleScripts(base, head);

For AI agents

  • Use lockscript diff --base <trusted-ref> --format json.
  • If count > 0, inspect issues[] and include only changed packages in your report.
  • For strict gates, run with --fail-on-change or --fail-on-risk medium.

Example:

lockscript diff --base origin/main --format json --fail-on-risk medium

For humans

  • Run this in dependency-update PRs (Renovate/Dependabot or manual updates).
  • Prefer diff over scan in CI, because it focuses on newly introduced behavior.
  • If a package is flagged, review the script command and changelog before merging.

Example:

lockscript diff --base origin/main

GitHub Actions example

- name: Detect new lifecycle scripts
  run: npx @gilangjavier/lockscript-guard diff --base origin/main --fail-on-change

License

MIT