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

assert-pm

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert-pm

Assert that a certain package manager was used when running a yarn/npm script.

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

assert-pm

yarn and npm have started to diverge in feature set. For example yarn introduced workspaces, which do not work with npm (yet).

To avoid contributors accidentally using the "wrong" package manager and getting hard to debug errors, you can use assert-pm as a postinstall script. It'll cause the installation to fail and warn the user.

Installation

yarn add --dev assert-pm
npm install --dev assert-pm

Usage

If you are managing your packages with workspaces, you can add it to your parent package.json as postinstall script. Make sure to not add it to packages you do publish as this script will also be run upon installation by users.

 "scripts": {
    "postinstall": "assert-pm yarn --message"
  }

If anyone now runs

npm install

they will get an error:

 pmtest@1.0.0 postinstall
> assert-pm yarn

Please use yarn.
npm ERR! code ELIFECYCLE

Options

assert-pm package-manager --message "We are managing our packages using yarn workspaces. Therefore this project requires yarn to install packages."

FAQs

Package last updated on 05 Feb 2018

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