Check for a Yarn lockfile in the current working directory.
yarn add yarn-lockfile-exists # Or alternatively: `npm install yarn-lockfile-exists`
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 });
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.
yarn test # Or alternatively: `npm test`
The MIT License. See the license file for details.