pax_global_header00006660000000000000000000000064134502253040014510gustar00rootroot0000000000000052 comment=b7b7b341a2c339050bade6b77152b266c2bdc89c has-yarn-2.1.0/000077500000000000000000000000001345022530400132325ustar00rootroot00000000000000has-yarn-2.1.0/.editorconfig000066400000000000000000000002571345022530400157130ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 has-yarn-2.1.0/.gitattributes000066400000000000000000000000231345022530400161200ustar00rootroot00000000000000* text=auto eol=lf has-yarn-2.1.0/.gitignore000066400000000000000000000000271345022530400152210ustar00rootroot00000000000000node_modules yarn.lock has-yarn-2.1.0/.npmrc000066400000000000000000000000231345022530400143450ustar00rootroot00000000000000package-lock=false has-yarn-2.1.0/.travis.yml000066400000000000000000000000541345022530400153420ustar00rootroot00000000000000language: node_js node_js: - '10' - '8' has-yarn-2.1.0/fixtures/000077500000000000000000000000001345022530400151035ustar00rootroot00000000000000has-yarn-2.1.0/fixtures/bar/000077500000000000000000000000001345022530400156475ustar00rootroot00000000000000has-yarn-2.1.0/fixtures/bar/package.json000066400000000000000000000001351345022530400201340ustar00rootroot00000000000000{ "name": "fixture", "version": "1.0.0", "dependencies": { "chalk": "^1.1.3" } } has-yarn-2.1.0/fixtures/bar/yarn.lock000066400000000000000000000026171345022530400175000ustar00rootroot00000000000000# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 ansi-regex@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.0.0.tgz#c5061b6e0ef8a81775e50f5d66151bf6bf371107" ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: ansi-styles "^2.2.1" escape-string-regexp "^1.0.2" has-ansi "^2.0.0" strip-ansi "^3.0.0" supports-color "^2.0.0" escape-string-regexp@^1.0.2: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" dependencies: ansi-regex "^2.0.0" strip-ansi@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" dependencies: ansi-regex "^2.0.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" has-yarn-2.1.0/fixtures/foo/000077500000000000000000000000001345022530400156665ustar00rootroot00000000000000has-yarn-2.1.0/fixtures/foo/package.json000066400000000000000000000001351345022530400201530ustar00rootroot00000000000000{ "name": "fixture", "version": "1.0.0", "dependencies": { "chalk": "^1.1.3" } } has-yarn-2.1.0/index.d.ts000066400000000000000000000007001345022530400151300ustar00rootroot00000000000000declare const hasYarn: { /** * Check if a project is using [Yarn](https://yarnpkg.com). * * @param cwd - Current working directory. Default: `process.cwd()`. * @returns Whether the project uses Yarn. */ (cwd?: string): boolean; // TODO: Remove this for the next major release, refactor the whole definition to: // declare function hasYarn(cwd?: string): boolean; // export = hasYarn; default: typeof hasYarn; }; export = hasYarn; has-yarn-2.1.0/index.js000066400000000000000000000004141345022530400146760ustar00rootroot00000000000000'use strict'; const path = require('path'); const fs = require('fs'); const hasYarn = (cwd = process.cwd()) => fs.existsSync(path.resolve(cwd, 'yarn.lock')); module.exports = hasYarn; // TODO: Remove this for the next major release module.exports.default = hasYarn; has-yarn-2.1.0/index.test-d.ts000066400000000000000000000002051345022530400161050ustar00rootroot00000000000000import {expectType} from 'tsd'; import hasYarn = require('.'); expectType(hasYarn()); expectType(hasYarn('foo')); has-yarn-2.1.0/license000066400000000000000000000021251345022530400145770ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. has-yarn-2.1.0/package.json000066400000000000000000000011271345022530400155210ustar00rootroot00000000000000{ "name": "has-yarn", "version": "2.1.0", "description": "Check if a project is using Yarn", "license": "MIT", "repository": "sindresorhus/has-yarn", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=8" }, "scripts": { "test": "xo && ava && tsd" }, "files": [ "index.js", "index.d.ts" ], "keywords": [ "yarn", "has", "detect", "is", "project", "app", "module", "package", "manager", "npm" ], "devDependencies": { "ava": "^1.4.1", "tsd": "^0.7.1", "xo": "^0.24.0" } } has-yarn-2.1.0/readme.md000066400000000000000000000017101345022530400150100ustar00rootroot00000000000000# has-yarn [![Build Status](https://travis-ci.org/sindresorhus/has-yarn.svg?branch=master)](https://travis-ci.org/sindresorhus/has-yarn) > Check if a project is using [Yarn](https://yarnpkg.com) 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 ``` ```js const hasYarn = require('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()` Current working directory. ## Related - [has-yarn-cli](https://github.com/sindresorhus/has-yarn-cli) - CLI for this module ## License MIT © [Sindre Sorhus](https://sindresorhus.com) has-yarn-2.1.0/test.js000066400000000000000000000002441345022530400145470ustar00rootroot00000000000000import test from 'ava'; import hasYarn from '.'; test('main', t => { t.true(hasYarn('fixtures/bar')); t.false(hasYarn('fixtures/foo')); t.false(hasYarn()); });