This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
further simplify adding new deps to the root #49
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The previous revision of the buildIdealTree/reify
add
option convertedthe package.json-esque data structure into instead passing a list of
specs for each location in the package, since the name couldn't be known
100% of the time up front.
However, that still puts too much of the burden of placing deps onto the
caller.
When you run
npm install foo
, iffoo
is already a devDependency,then the updated save spec gets added there, unless specified otherwise.
Since we aren't guaranteed to know the name of the dep until we've
resolved it, how is the caller (ie, the npm CLI) supposed to know where
to put it in the objecet?
At the expense of a slight amount of flexibility, this changes things
further so that the
add
option mirrors exactly the positionalarguments passed to the
npm install
command: it's just a list ofspecs, that's it.
Two more options were added:
If the saveType is not set, then added deps are added wherever they
already exist, or to
dependencies
if they're not already present.Otherwise, it should be set to one of the edge type values:
If
saveBundle
is true, then newly added deps are added to thebundleDependencies
list as well.