Skip to content
This repository has been archived by the owner on Aug 7, 2019. It is now read-only.

Implement npm install foo --save equivalent #118

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

wombleton
Copy link

Update package.json's jam.dependencies or jam.devDependencies if --save
or --save-dev passed

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';
Copy link
Owner

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 ;)

@caolan
Copy link
Owner

caolan commented Dec 17, 2012

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 :)

@wombleton
Copy link
Author

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() {
Copy link
Owner

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?

Copy link
Author

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!

@thebigredgeek
Copy link

Any update on this? I would like to see this soon.

data.jam = {};
}
data.jam.dependencies = data.jam.dependencies || {};
data.jam.dependencies[name] = v;
Copy link
Collaborator

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)

@thebigredgeek
Copy link

Any update on this @wombleton ?

@thebigredgeek
Copy link

Bump...

@suisho
Copy link

suisho commented Jun 2, 2014

I want this too.

+1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants