defunctzombie / node-required

identifies which modules your script is using
67 stars 15 forks source link

Behaviour when a module is not installed? #10

Closed DamonOehlman closed 11 years ago

DamonOehlman commented 11 years ago

I had a use case for required where I wanted to install all the modules required by a project that had not specified a package.json file. While I don't think npm install supports reading from stdin, I would ideally love to be able to run something like the following in such a project:

required index.js | npm install

At this stage, required spits the dummy when it cannot find a referenced module on the filesystem (https://github.com/shtylman/node-required/blob/master/index.js#L62). Just wondering if you'd consider changing this behaviour or if it goes against your primary reason for creating the tool in the first place?

If not I'm happy to do make the change and send through a PR :)

defunctzombie commented 11 years ago

The use case doesn't quite make sense to me. Just add a package.json to the project :) npm doesn't support what you are trying to do because it is trivial to add a package.json

DamonOehlman commented 11 years ago

Sure no worries, case in point was me wanting to have a play with @mikolalysenko's raymarch when he first added it to github: https://github.com/mikolalysenko/raymarch/tree/207b709a686f99a2a9bb60d8103c6176fe1df4ec which was prior to the addition of a package.json file.

I agree that it's not something that happens often though...