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

@kagal/cross-test

v0.1.2

Published

Cross-platform shell conditions and file tests

Downloads

321

Readme

cross-test 🛠️

Cross-platform shell-style conditions for package.json scripts.

cross-test is a lightweight, zero-dependency CLI utility that brings Unix-like test (or [ ]) functionality to any operating system. It allows you to write conditional logic in your package.json scripts that works identically on Windows, macOS, and Linux.


🚀 Why you need it

Standard shell conditions are not portable:

  • Unix: [ -f dist/index.js ] && echo "Ready" (Fails on Windows CMD/PowerShell)
  • Windows: if exist dist\index.js echo Ready (Fails on Bash/Zsh)
  • cross-test: cross-test -f dist/index.js && echo "Ready" (Works everywhere)

✨ Features

  • 📦 Zero Dependencies: Keeps your node_modules tiny.
  • ESM-Native: Built for the modern Node.js ecosystem.
  • 🔧 Internal Variable Expansion: Supports $VAR and ${VAR} using process.env.
  • 🧠 Smart Logic: Full support for !, -a (AND), -o (OR), and ( ) grouping.
  • 🛡️ Provenance: Published with OIDC trusted publishing and SLSA provenance attestation.

📥 Installation

npm install --save-dev @kagal/cross-test

🛠 Usage

Use it directly in your package.json scripts:

{
  "scripts": {
    "dev": "cross-test -f dist/index.js || unbuild --stub",
    "deploy": "cross-test '$NODE_ENV' = 'production' && npm run surge",
    "check": "cross-test '(' -d .git -a -f .env ')' || echo 'Setup incomplete'"
  }
}

Supported Tests

| Flag | Description | | :--- | :--- | | -f <path> | True if path is a file. | | -d <path> | True if path is a directory. | | -e <path> | True if path exists. | | -s <path> | True if path exists and has size > 0. | | -n <str> | True if string has non-zero length. | | -z <str> | True if string is empty. | | s1 = s2 | True if string s1 equals s2. | | s1 != s2 | True if string s1 does not equal s2. |


📖 Grammar

cross-test uses a recursive descent parser. Precedence from lowest to highest:

expr    = or ;
or      = and { "-o" and } ;
and     = primary { "-a" primary } ;
primary = "!" primary
        | "(" expr ")"
        | string ( "=" | "!=" ) string
        | ( "-n" | "-z" ) string
        | ( "-d" | "-e" | "-f" | "-s" ) path
        ;

Variables ($VAR, ${VAR}) are expanded from process.env before parsing.


🔒 Security

This package is published using OIDC trusted publishing and includes a verifiable SLSA provenance attestation. You can verify that the code in the npm package matches the source code in the GitHub repository.

📄 License

MIT © 2026