
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
fd-package-json
Advanced tools
Finds the closest package.json
and returns the path or the contents.
npm i -S fd-package-json
To retrieve the path of the closest package, you can use findPackagePath
:
import {findPackagePath} from 'fd-package-json';
// Closest package path to cwd of the process
await findPackagePath(process.cwd());
// Closest package path to the current file (CJS)
await findPackagePath(__dirname);
// Closest package path to the current file (ESM)
await findPackagePath(fileURLToPath(new URL('.', import.meta.url)));
To retrieve the package itself, you may use findPackage
with the same
parameter:
await findPackage(process.cwd()); // Returns the JSON of the package if found
Synchronous methods also exist:
findPackageSync(process.cwd()); // returns the package
findPackagePathSync(process.cwd()); // returns the package path
MIT
FAQs
Utilities for finding the closest package.json file
The npm package fd-package-json receives a total of 656,511 weekly downloads. As such, fd-package-json popularity was classified as popular.
We found that fd-package-json demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.