Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
find-package
Advanced tools
Find the nearest package.json in your current node module.
The find-package module will look upstream in every paren directory until it finds a package.json file or return null. If it finds a package.json, it wild require it and return it as an object.
npm install find-package
If you need to access the information in the package.json of your module, simply require the find-package module and pass either __dirname
or process.cwd()
as the directory from where to look:
var findPackage = require('find-package');
console.log(findPackage(__dirname).name);
//Should return the name of the current module
//as appears in the package.json
If you pass true as the second argument of find-package, the module will add paths object to the package.json. This object will have a relative
and an absolute
properties, with the correspondent relative and absolute paths to the package.json. The relative path is relative to the script calling the find-package module:
var package = require('find-package')(__diname, true);
package.paths.relative //string with the relative path to package.json
package.paths.absolute //string with the absolute path to package.json
This modules has been tested only in a UNIX environment. Although, theoretically, it should also work with Windows. If that is not the case, please let me know.
FAQs
Find the nearest package.json in your current node module
The npm package find-package receives a total of 8,332 weekly downloads. As such, find-package popularity was classified as popular.
We found that find-package 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.