shelljs / shx

Portable Shell Commands for Node
MIT License
1.72k stars 44 forks source link

Npm package should always have a main module #180

Closed clayrisser closed 4 years ago

clayrisser commented 4 years ago

The package.json is missing the main property. Because this is a cli, I understand why it was neglected, but it can create problems, for example if I am running require.resolve('shx').

nfischer commented 4 years ago

Why would you try to require shx? We intentionally don't support this case. If you want to require a library in your own code, you should use ShellJS.

clayrisser commented 4 years ago

I'm sure there are many reasons to require shx aside from the reason why I need to. I need to find the path to the shx module, and require.resolve('shx') is the way to do that, except it does not work without "main".

nfischer commented 4 years ago

Why do you need the path to the module? Npm is responsible for adding the executable to the $PATH, both for npm lifecycle scripts and for global installs (npm install -g).

nfischer commented 4 years ago

https://github.com/sindresorhus/clipboard-cli/blob/master/package.json is a CLI which does not support require'ing

clayrisser commented 4 years ago

@nfischer ok thanks for the clarity.