sindresorhus/update-notifier

Default `pkg` to the current package

Open

#172 建立於 2019年11月30日

在 GitHub 查看
 (5 留言) (2 反應) (0 負責人)JavaScript (1,800 star) (164 fork)user submission
enhancementhelp wanted

描述

The pkg option must be set with the package's package.json.

However this does not work well with ES imports. At the moment, importing JSON files with ES imports is still experimental in Node.js.

Also, hardcoding the path to package.json can be tricky when transpiling is involved. For example, my binary file is at src/bin.js, but it is transpiled to build/src/bin.js. If I want to run both files, I need to dynamically find the path to package.json with a library like read-pkg-up.

Adding an option to automatically find the package (with read-pkg-up for example) would solve this problem. This option would probably need user to pass __dirname to be able to find the right package.json.

What do you think?

I can submit a PR if needed.

貢獻者指南

Default `pkg` to the current package · sindresorhus/update-notifier#172 | Good First Issue