Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

adio

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adio

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

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
200
increased by2.04%
Maintainers
1
Weekly downloads
 
Created
Source

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
  }
}

Keywords

FAQs

Package last updated on 07 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc