Socket
Socket
Sign inDemoInstall

has-yarn

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    has-yarn

Check if a project is using Yarn


Version published
Weekly downloads
4.8M
increased by0.51%
Maintainers
1
Install size
3.98 kB
Created
Weekly downloads
 

Package description

What is has-yarn?

The has-yarn npm package is a simple utility that checks if a project is using Yarn as its package manager by looking for a 'yarn.lock' file in the project directory. It is useful for tooling and scripts that need to adapt their behavior based on the package manager being used.

What are has-yarn's main functionalities?

Check if Yarn is being used

This feature allows you to check if a project is using Yarn by invoking the hasYarn function. It returns true if a 'yarn.lock' file is found in the project directory, indicating that Yarn is being used.

const hasYarn = require('has-yarn');

if (hasYarn()) {
  console.log('The project uses Yarn.');
} else {
  console.log('The project does not use Yarn.');
}

Other packages similar to has-yarn

Readme

Source

has-yarn

Check if a project is using Yarn

Useful for tools that needs to know whether to use yarn or npm to install dependencies.

It checks if a yarn.lock file is present in the working directory.

Install

$ npm install has-yarn

Usage

.
├── foo
│   └── package.json
└── bar
    ├── package.json
    └── yarn.lock
import hasYarn from 'has-yarn';

hasYarn('foo');
//=> false

hasYarn('bar');
//=> true

API

hasYarn(cwd?)

Returns a boolean of whether the project uses Yarn.

cwd

Type: string
Default: process.cwd()

The current working directory.

  • has-yarn-cli - CLI for this module

Keywords

FAQs

Last updated on 10 Sep 2021

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