isaacs/npm — pull request #2999 by lloydwatkin (2012-12-14 15:51:00+00:00)
Title: Write installed modules into package.json

I've hit the issue a couple of times where I develop code, and then forget to `npm i --save` as I go along. So what I've done here is write a small feature which reads all the package.json files in node_modules (first level only), extracts the version number and writes the results to package.json.

If you provide 'insert' after the command then existing dependencies list is not clobbered but any packages already in package.json have their version number overwritten.

I did intend to extend by allowing a user to, if desired, to choose whether the dependency was dev or standard but I'm tight for time at present.

If this is something that gets accepted then I'll possibly come back and add later.

I added docs in doc/cli/backfill.md but if more are required please let me know where.