2.0.0 • Published 6 years ago

is-install-needed v2.0.0

Weekly downloads
16
License
ISC
Repository
github
Last release
6 years ago

is-install-needed

GitHub license Build Status Coverage Dependencies

A simple devtool that tells you if you need to run install or not. It does so by checking if the lock file of your preferred package manager has changed. Supports the most popular package managers out there: npm, yarn and pnpm.

Installation

Install the is-install-needed package with your preferred package manager.

Add is-install-needed --postinstall to your postscript to automatically write a check file after install.

Usage

CLI

$ is-install-needed

It will automatically look for yarn.lock, package-lock.json and shrinkwrap.yaml when no preferred package manager is provided.

FlagAvailable optionsDescription
--prefernpm, yarn or pnpmPreferred package manager
--cwd\Current working directory
--postinstallPostinstall script

Programmatic API

Check if install is needed

import { isInstallNeeded } from 'is-install-needed';

async () => {
  const isNeeded = await isInstallNeeded();
  if (result) {
    console.error('You need to run install');
    process.exit(1);
  }
};

Find closest lock file

import { findClosestLockfile } from 'is-install-needed';

async () => {
  const lockfile = await findClosestLockfile();
  console.log(lockfile); // > /path/to/package/.yarn.lock
};
2.0.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago