https://github.com/jbenner-radham/node-yarn-lockfile-exists
Check for a Yarn lockfile in the current working directory.
https://github.com/jbenner-radham/node-yarn-lockfile-exists
exists file lock lockfile yarn
Last synced: 14 days ago
JSON representation
Check for a Yarn lockfile in the current working directory.
- Host: GitHub
- URL: https://github.com/jbenner-radham/node-yarn-lockfile-exists
- Owner: jbenner-radham
- License: mit
- Created: 2017-12-17T01:50:34.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2022-12-25T14:58:50.000Z (almost 3 years ago)
- Last Synced: 2025-09-10T00:37:52.750Z (about 2 months ago)
- Topics: exists, file, lock, lockfile, yarn
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
yarn-lockfile-exists
====================
[](https://github.com/jbenner-radham/node-yarn-lockfile-exists/actions/workflows/ci.yaml)
[](https://www.npmjs.com/package/yarn-lockfile-exists)
[](https://nodejs.org/)
[](LICENSE)
Check for a Yarn lockfile in the current working directory.
Install
-------
```sh
yarn add yarn-lockfile-exists # Or alternatively: `npm install yarn-lockfile-exists`
```
Usage
-----
### JavaScript
```js
import yarnLockfileExists from 'yarn-lockfile-exists';
// Returns `true` or `false` based off of if there is a `yarn.lock` file in the location
// that `process.cwd()` points to.
yarnLockfileExists();
// Optionally you can specify the current working directory for the function to operate in.
const cwd = '/home/myself/awesome-project';
yarnLockfileExists({ cwd });
```
### TypeScript
```ts
import yarnLockfileExists, { type YarnLockfileExistsConfig } from 'yarn-lockfile-exists';
// Returns `true` or `false` based off of if there is a `yarn.lock` file in the location
// that `process.cwd()` points to.
yarnLockfileExists();
// Optionally you can specify the current working directory for the function to operate in.
const config: YarnLockfileExistsConfig = {
cwd: '/home/myself/awesome-project'
};
yarnLockfileExists(config);
```
**NOTE**: This is a pure ESM package. See [here](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) for details.
Testing
-------
```sh
yarn test # Or alternatively: `npm test`
```
License
-------
The MIT License. See the [license file](LICENSE) for details.