You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 968B

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # has-yarn [![Build Status](https://travis-ci.org/sindresorhus/has-yarn.svg?branch=master)](https://travis-ci.org/sindresorhus/has-yarn)
  2. > Check if a project is using [Yarn](https://yarnpkg.com)
  3. Useful for tools that needs to know whether to use `yarn` or `npm` to install dependencies.
  4. It checks if a `yarn.lock` file is present in the working directory.
  5. ## Install
  6. ```
  7. $ npm install has-yarn
  8. ```
  9. ## Usage
  10. ```
  11. .
  12. ├── foo
  13. │   └── package.json
  14. └── bar
  15. ├── package.json
  16. └── yarn.lock
  17. ```
  18. ```js
  19. const hasYarn = require('has-yarn');
  20. hasYarn('foo');
  21. //=> false
  22. hasYarn('bar');
  23. //=> true
  24. ```
  25. ## API
  26. ### hasYarn([cwd])
  27. Returns a `boolean` of whether the project uses Yarn.
  28. #### cwd
  29. Type: `string`<br>
  30. Default: `process.cwd()`
  31. Current working directory.
  32. ## Related
  33. - [has-yarn-cli](https://github.com/sindresorhus/has-yarn-cli) - CLI for this module
  34. ## License
  35. MIT © [Sindre Sorhus](https://sindresorhus.com)