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 🙏

© 2024 – Pkg Stats / Ryan Hefner

just-check

v1.2.1

Published

Simple check for installed packages with versions correspond to those specified in the package.json

Downloads

130

Readme

just-check

Check installed dependencies and their versions in your Node.js project. Will exit with code 1 if any problems are found, otherwise will exit with code 0.

This package helps you to identify missing packages and packages with incorrect versions specified in your package.json. It also provides an option to automatically install missing packages.

Installation

You can install this package as a global package or as a local dependency in your project.

globally:

npm install just-check -g

or locally:

npm install just-check -D

Usage

CLI

To use this package as a CLI, run the following command:

just-check [--install[="your-install-command"]] [--skip-dev] [--path="your-project-path"]

If you installed the package, you can add it to your package.json scripts, like this:

"scripts": {
  "check-deps": "just-check --install"
}

or before starting your project:

"scripts": {
  "start": "just-check --install && node index.js"
}

API (ESM only)

To use this package as an dependency, you can import it like this:

import { justCheck } from "just-check";

try {
  const missingDeps = justCheck({
    install: "npm install", // command to install missing dependencies, defaults to `null`(no install)
    checkDevDependencies: true, // check dev dependencies, defaults to true
    path: "." // path to project root, defaults to current working directory
  });
  
  if (missingDeps) {
    console.error("Missing dependencies found!");
    process.exit(1);
  }
  // will throw if package.json is missing or cannot install dependencies
} catch (error) {
  console.error(error);
}

Options

CLI

  • --install[="your-install-command"] If this flag is provided, the script will attempt to install missing dependencies using the specified command. If no install command is provided, it will default to npm install. If you want to use yarn, you can specify it like this: --install="yarn add". By default, will not install missing dependencies.

  • --skip-dev If this flag is provided, the script will not check for missing dev dependencies.

  • --path="your-project-path" If this flag is provided, the script will check for missing dependencies in the specified path. If no path is provided, it will default to process.cwd().

API

  • install?: string | null If this option is provided, the script will attempt to install missing dependencies using the specified command. If you want to use yarn, you can specify it like this: install: "yarn add". Defaults to null (will not install missing dependencies).

  • checkDevDependencies?: boolean If this option is false, the script will not check for missing dev dependencies. Defaults to true.

  • path?: string If this option is provided, the script will check for missing dependencies in the specified path. If no path is provided, it will default to current working directory .. Directory must contain package.json file.

Example output

$ just-check
Checking dependencies in .../some-project
Problematic dependencies:
- package1 (installed: 0.9.0, should be 1.0.0)
- package2 (installed: 2.0.5, should be 2.1.0)
- package3 (not installed, should be 1.2.3)
- package4 (not installed, should be 0.8.1)

License

MIT