Skip to content

jbenner-radham/node-yarn-lockfile-exists

Repository files navigation

yarn-lockfile-exists

CI Status npm Node.js License

Check for a Yarn lockfile in the current working directory.

Install

yarn add yarn-lockfile-exists # Or alternatively: `npm install yarn-lockfile-exists`

Usage

JavaScript

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

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 for details.

Testing

yarn test # Or alternatively: `npm test`

License

The MIT License. See the license file for details.