Coder Social home page Coder Social logo

has-yarn's Introduction

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.

Related

has-yarn's People

Contributors

bendingbender avatar coreyfarrell avatar richienb avatar samverschueren avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

has-yarn's Issues

Add documentation explaining checking

Hi @sindresorhus, nice module as always.

It would probably be good to add a bit of explanation about how this is checking if something is using yarn. The module is small enough that most people can read it themselves, but just explaining "it checks for a yarn.lock" in the readme might be good.

Add support for Yarn workspaces

This package assumes yarn.lock is in cwd folder, which is not always the case for Yarn workspaces, and result will depend on how you run the command:

  • yarn workspace my-package xyz => hasYarn=true
  • cd packages/my-package && yarn xyz => hasYarn=false

I suggest to also look for a Yarn workspace in parent folders, and look for a lock file there too

Usable as cli command?

I love latest-version which is usable as CLI command as well through the ported package called latest-version-cli.

I often forget if my packages I'm working on use Yarn or NPM and if I could just do a quick check from the terminal with a command has-yarn and it returns true or false for that repo, that would be really helpful!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.