Comparing version 2.1.0 to 3.0.0
@@ -1,16 +0,7 @@ | ||
declare 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; | ||
/** | ||
Check if a project is using [Yarn](https://yarnpkg.com). | ||
// 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; | ||
@param cwd - The current working directory. Default: `process.cwd()`. | ||
@returns Whether the project uses Yarn. | ||
*/ | ||
export default function (cwd?: string): boolean; |
14
index.js
@@ -1,9 +0,7 @@ | ||
'use strict'; | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
import process from 'node:process'; | ||
import path from 'node:path'; | ||
import fs from 'node: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; | ||
export default function hasYarn(cwd = process.cwd()) { | ||
return fs.existsSync(path.resolve(cwd, 'yarn.lock')); | ||
} |
{ | ||
"name": "has-yarn", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "Check if a project is using Yarn", | ||
"license": "MIT", | ||
"repository": "sindresorhus/has-yarn", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -35,6 +38,6 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"tsd": "^0.7.1", | ||
"xo": "^0.24.0" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.17.0", | ||
"xo": "^0.44.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# has-yarn [![Build Status](https://travis-ci.org/sindresorhus/has-yarn.svg?branch=master)](https://travis-ci.org/sindresorhus/has-yarn) | ||
# has-yarn | ||
@@ -9,3 +9,2 @@ > Check if a project is using [Yarn](https://yarnpkg.com) | ||
## Install | ||
@@ -17,3 +16,2 @@ | ||
## Usage | ||
@@ -31,3 +29,3 @@ | ||
```js | ||
const hasYarn = require('has-yarn'); | ||
import hasYarn from 'has-yarn'; | ||
@@ -41,6 +39,5 @@ hasYarn('foo'); | ||
## API | ||
### hasYarn([cwd]) | ||
### hasYarn(cwd?) | ||
@@ -51,15 +48,9 @@ Returns a `boolean` of whether the project uses Yarn. | ||
Type: `string`<br> | ||
Type: `string`\ | ||
Default: `process.cwd()` | ||
Current working directory. | ||
The 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) |
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
Yes
3055
12
52