Socket
Socket
Sign inDemoInstall

check-package-manager

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    check-package-manager

Check that you're using the correct package manager


Version published
Weekly downloads
498
decreased by-48.87%
Maintainers
1
Install size
10.0 kB
Created
Weekly downloads
 

Readme

Source

check-package-manager

Node.js CI

Check that the correct package manager is being used with your project.

To configure the correct package manager, you can use the packageManager property in your package.json file or you can specify it in the cli arguments.

:information_source: This package requires Node >= 18. If you use an older Node version, the cli will exit and print a warning.

Install

npm i check-package-manager -D

:information_source: You can use npx check-package-manager [options] in your preinstall script if you don't want to add it as a dependency.

Usage

check-package-manager [options] [packageManager]

:information_source: Depending on the package manager being used, the preinstall script may get invoked after dependencies are installed.

Arguments

packageManager (optional) - <package manager name>[@<version>]

Options

--info - Print info messages

--debug - Print debug messages

Examples

When using corepack:

{
  "name": "YOUR-PACKAGE-NAME",
  "version": "1.0.0",
  "packageManager": "pnpm@7.19.0",
  "scripts": {
    "preinstall": "npx check-package-manager"
  }
}

Specify the package manager name and version yourself:

{
  "name": "YOUR-PACKAGE-NAME",
  "version": "1.0.0",
  "scripts": {
    "preinstall": "npx check-package-manager npm@9.2.0"
  }
}

Specify only the package manager name:

{
  "name": "YOUR-PACKAGE-NAME",
  "version": "1.0.0",
  "scripts": {
    "preinstall": "npx check-package-manager yarn"
  }
}

Local development

fnm use
corepack enable
pnpm install
pnpm build

Keywords

FAQs

Last updated on 24 Dec 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc