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

check-installed

v3.1.0

Published

Minimal Node package to check that dependencies are installed ✅

Downloads

281

Readme

check-installed

Minimal Node package to check that dependencies are installed ✅

npm pipeline status coverage report

Install

$ npm i check-installed --save-dev

Checks

Engines Check

  • Compares the installed version of engines to the versions specified in package.json
  • Engines can be things like node, dotnet, or anything that responds to --version
  • Versions are checked with semver, so you can use any valid semver range
  "engines": {
    "node": ">=12.x",
    "npm": ">=6",
    "dotnet": "^6.0.410"
  },

Modules Check

  • Compares the installed versions of node modules to the versions specified in package.json
  • Versions for modules that have latest are not checked, only that they are installed
  • Optional node module dependencies are only checked if they are installed
  • URL, Git URL, and file path versions are currently skipped

Usage

CLI

Run check-installed before npm scripts or directly to ensure that the environment is set up correctly. If any check fails, the process will throw and exit with a non-zero exit code.

NPM Scripts

You can add a check script and run with npm run check or call it from other commands:

  "scripts": {
    "check": "check-installed",
    "start": "npm run check && node index.js",
    "test": "npm run check && jest"
  }

This repo actually uses check-installed directly 🤯.

Command Line

npx check-installed

API

You can call the checks directly from node programatically if needed like:

const { checkEngines, checkModules } = require('check-installed')
const json = require('./package.json')

await checkEngines(json)
await checkModules(json)
await checkEngines(json, { showEngines: true })
await checkModules(json, { showSuccess: true })

Each check returns a Promise<void> that throws if any check fails. They are typed to accept the entire options object, but only use options they need.

Options

  • All options are optional and will be defaulted
  • CLI formats to change default values:
    • boolean:
      • true: --option-name or --option-name=true
      • false: --option-name=false or --option-name= or --option-name=anythingelse
    • string: --option-name=value
  • Options for checkEngines and checkModules are the same as CLI options but camelCased

--help

Show help (skips check)

Type: boolean, Default: false

--skip-engines

Skip checking engines

Type: boolean, Default: false

--skip-modules

Skip checking node modules

Type: boolean, Default: false

--show-success

Show success message on successful checks

Type: boolean, Default: false

--show-engines

Show installed engines on successful check

Type: boolean, Default: false

--show-modules

Show installed node modules on successful check

Type: boolean, Default: false