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

react-archguard

v0.2.0

Published

A polished AST-based CLI for enforcing React component-file conventions.

Readme

react-archguard

react-archguard is a fast TypeScript and ts-morph CLI for enforcing strict React component-file conventions.

Requires Node.js 20 or newer.

Install once, use anywhere

Install it globally:

npm install --global react-archguard

Then run it from any React repository:

react-archguard

You can also run it without a global install:

npx react-archguard

react-guard and react-architecture-guard remain available as compatibility aliases.

Usage

By default, the CLI scans src/components and src/features for *.tsx component files:

react-archguard

Scan a specific component tree:

react-archguard --root src/features/agents/components

Useful options:

-r, --root <path>  component tree to scan
    --json         print a machine-readable report
    --no-color     disable styled terminal output
-q, --quiet       only print output when violations are found
-v, --version     output the installed version
-h, --help        display help for the command

The command exits with status 0 when the scan passes and status 1 when violations are found, so it works in CI, pre-commit hooks, and editor tasks. Use --json when another tool needs the result as structured data.

Releases and updates

For the first release, publish the package once from your machine:

npm login
npm publish --access public

After that first publish, configure npm Trusted Publishing for this repository and the Publish npm package workflow. Select GitHub Actions and use:

Organization or user: alexsilver8
Repository: react-archguard
Workflow filename: publish.yml

Then create a release locally:

npm test
npm version patch
git push origin main --follow-tags

Use minor for backwards-compatible features or major for breaking changes. The tag starts the GitHub Actions workflow, which verifies and publishes the package. Users can update with:

npm install --global react-archguard@latest

The package uses npm's OIDC-based trusted publishing, so the workflow does not need a long-lived npm token.

Development

Install dependencies and run the checker locally:

npm install
npm run check

Build the distributable CLI:

npm run build
node ./dist/scripts/architecture/cli.js

Run the automated checks:

npm test
npx tsc --noEmit

The intentionally invalid fixtures demonstrate the expected non-zero failure:

npm run check:invalid

What it enforces

  • Component filenames use kebab-case, such as user-card.tsx.
  • Each component folder contains an index.ts that explicitly re-exports the component.
  • The component name matches the filename in PascalCase, such as UserCard.
  • The component file contains exactly one named exported component function.
  • The component function has an explicit return type.
  • Default exports and unrelated exports are rejected.
  • Interfaces and type aliases belong in <component>.types.ts.
  • Constants and enums belong in <component>.constants.ts.
  • Helper functions belong in <component>.utils.ts.
  • Additional components, classes, schemas, variables, and unrelated top-level declarations are rejected.
  • Component files live in a matching folder, such as user-card/user-card.tsx.
  • Test, spec, and Storybook files are ignored: *.test.tsx, *.spec.tsx, and *.stories.tsx.

For example, user-card/index.ts must explicitly contain:

export { UserCard } from './user-card';