sindresorhus/update-notifier

Default `pkg` to the current package

Open

#172 aberto em 30 de nov. de 2019

Ver no GitHub
 (5 comments) (2 reactions) (0 assignees)JavaScript (1.800 stars) (164 forks)user submission
enhancementhelp wanted

Description

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.

Guia do colaborador