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

adio

v1.2.1

Published

Checks if the dependencies in package.json and in the actual code are synced.

Downloads

866

Readme

adio

Build Status Coverage Status code style: prettier All Contributors PRs Welcome

adio (all-dependencies-in-order) is a small library that checks your code for dependencies that are not listed in the package.json and vice-versa, checks package.json files for dependencies that are not used in code.

Install

npm install --save adio

Or if you prefer yarn:

yarn add adio

Basic usage

Once you've installed the library, you can run the adio command like so:

adio --packages "components/*" --packages "packages/*"

This will check all folders located in packages folder, eg. packages/something-1 and packages/something-2. If all dependencies are in order, the process will exit with the exit code 0, and will print a success message. Otherwise, the exit code 1 will be returned, and a list of all issues will be printed in the console.

Configuration files

Even though it can be done via the CLI, parameters can also be set via the .adiorc.js or similar cosmiconfig supported config types (eg. .adiorc.json or even via the adio key in package.json), placed in the current working directory. This is often a better alternative to passing parameters inline via the CLI.

By just creating a following .adiorc.json file in the current working directory...

{
  "packages": ["packages/*", "components/*", "..."]
}

and then running the adio command in the same directory, we can achieve the same effect as by manually running the previsuly shown adio --packages "components/*" --packages "packages/*" command.

This way will also make it easier to pass in additional config parameters.

Additional configuration parameters

  • ignoreDirs: Array containing directories to ignore. By default, adio ignores ['node_modules']
  • ignore: Object containing dependencies for adio to ignore.
    • src: dependencies to ignore in source files. This can be an array of strings or simply true to ignore checking all deps in source files
    • dependencies: ignore dependencies in package.json. This can be an array of strings, to ignore certain deps, or simply true to ignore checking all dependencies from package.json
    • devDependencies: ignore devDependencies in package.json. This can be an array of strings, to ignore certain deps, or simply true to ignore checking all devDependencies from package.json
    • peerDependencies: ignore peerDependencies in package.json. This can be an array of strings, to ignore certain deps, or simply true to ignore checking all peerDependencies from package.json
  • parser: any options to pass to @babel/parser see here for available options

A more comprehensive .adiorc might look like this:

{
  "packages": ["packages/*"],
  "ignoreDirs": ["node_modules", "dist", "coverage"],
  "ignore": {
    "src": ["path", "url", "http"],
    "devDependencies": true,
    "peerDependencies": true
  },
  "parser": {
    "plugins": ["typescript", "optionalChaining", "numericSeparator", "classProperties"]
  }
}

Configuration Overriding

It is common to have an adio configuration at the root of a monorepo. Then, say I did want adio to check peerDependencies usage in a particular package, I could extend the configuration above by adding a package local packages/*/.adiorc like so:

{
  "ignore": {
    "peerDependencies": false
  }
}