-
Notifications
You must be signed in to change notification settings - Fork 105
Implement npm install foo --save equivalent #118
base: master
Are you sure you want to change the base?
Conversation
Update package.json's jam.dependencies or jam.devDependencies if --save or --save-dev passed
if (opt.save || opt.save_dev) { | ||
exports.cpDir(name, v, from_cache, cdir, opt, function() { | ||
fs.readFile('package.json', function(err, data) { | ||
var deps = opt.save ? 'dependencies' : 'devDependencies'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also possible to use jam.dependencies in package.json... devDependencies is currently unused by jam. I'd recommend we only use jam.dependencies to avoid conflicting with NPM's 'dependencies' property when saving.
...and I've just noticed you are namespacing it under 'jam' later on ;)
Seems like a nice feature to have. Can you please take a look at my comments on the diff and add an integration test? Thanks :) |
I'll get on that tomorrow, cheers. |
@@ -406,7 +407,34 @@ exports.installRepo = function (name, range, opt, callback) { | |||
if (err) { | |||
return callback(err); | |||
} | |||
exports.cpDir(name, v, from_cache, cdir, opt, callback); | |||
if (opt.save) { | |||
exports.cpDir(name, v, from_cache, cdir, opt, function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no error handling for the cpDir callback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out I had no reason at all for leaving that out. Fix'd!
Any update on this? I would like to see this soon. |
data.jam = {}; | ||
} | ||
data.jam.dependencies = data.jam.dependencies || {}; | ||
data.jam.dependencies[name] = v; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assumes the dependences are stored in the jam property. storing dependencies on the root of the package.json is acceptable. So you should test which way the current package is setup (if any)
Any update on this @wombleton ? |
Bump... |
I want this too. +1 |
Update package.json's jam.dependencies or jam.devDependencies if --save
or --save-dev passed