Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 2 months ago
JSON representation

Check for a Yarn lockfile in the current working directory.

Awesome Lists containing this project

README

        

yarn-lockfile-exists
====================
[![CI Status](https://img.shields.io/github/actions/workflow/status/jbenner-radham/node-yarn-lockfile-exists/ci.yaml?branch=main)](https://github.com/jbenner-radham/node-yarn-lockfile-exists/actions/workflows/ci.yaml)
[![npm](https://img.shields.io/npm/v/yarn-lockfile-exists.svg)](https://www.npmjs.com/package/yarn-lockfile-exists)
[![Node.js](https://img.shields.io/node/v/yarn-lockfile-exists.svg)](https://nodejs.org/)
[![License](https://img.shields.io/github/license/jbenner-radham/node-yarn-lockfile-exists.svg)](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.