Find the topmost package.json file.
- Find the end user's project.
- Useful to find where developer projects might live.
- Keeps you resilient to filesystem changes.
npm install pkg-down --save
Get it into your program.
const pkgDown = require('pkg-down');
Find the package.json file closest to the root of the filesystem.
pkgDown().then(filepath => {
console.log(filepath); // => '/Users/sholladay/foo/package.json'
});
See our contributing guidelines for more details.
- Fork it.
- Make a feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
Go make something, dang it.