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

npm init brings in flattened dependencies in v3 #8716

Closed
ghost opened this issue Jun 27, 2015 · 4 comments
Closed

npm init brings in flattened dependencies in v3 #8716

ghost opened this issue Jun 27, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Jun 27, 2015

I usually do npm init right before I publish, so I've already got a ton of files in node_modules/ with the new flatter behavior in v3. When it comes time to npm init, npm thinks all of those flattened dependencies belong in my package.json as top-level dependencies.

@iarna iarna added the bug label Jun 27, 2015
@iarna iarna added this to the 3.x milestone Jun 27, 2015
@iarna
Copy link
Contributor

iarna commented Jun 27, 2015

Yup, it should totally do the right thing here.

To do this it needs to use read-package-tree like everything else in npm@3 and then look for packages with a _requiredBy containing #USER, which indicates they were installed by direct user action and not due to a subdep or an existing package.json. It might be reasonable to also include any module that doesn't have a _requiredBy field– that'd be modules installed via npm@2, and any module with a _requiredBy containing /, which would be from a previous package.json.

@govpack
Copy link

govpack commented Jun 29, 2015

I heard it always does the "right thing".
based both on universal standards & models for ethical and absolute correctness.
I mean, they exist don't they!! RTFM or RTFSC it's all in there. init'ing after the fact, i like that, that's so manga, now they're busy re-wiring who put what where!! 😱

@iarna iarna modified the milestones: 3.x-next-next, 3.x Jul 20, 2015
@iarna
Copy link
Contributor

iarna commented Jul 30, 2015

Aaand, this lives off in init-package-json, which complicates matters because it's building its tree in an entirely npm independent manner. I think this is going to require some (much needed) refactoring to extract those parts of the new installer into independent modules.

@iarna iarna modified the milestones: 3.x-next-next, 3.x-next Jul 30, 2015
@iarna iarna modified the milestones: 3.x-next-next, 3.x-next Aug 10, 2015
@iarna iarna self-assigned this Aug 13, 2015
@iarna iarna modified the milestones: 3.x-next-next, 3.x-next Aug 13, 2015
iarna added a commit that referenced this issue Aug 13, 2015
zkat added a commit that referenced this issue Aug 14, 2015
@zkat zkat closed this as completed in 139dd92 Aug 14, 2015
@iarna iarna modified the milestones: 3.3.0, 3.x-next-next Aug 14, 2015
@iarna
Copy link
Contributor

iarna commented Aug 14, 2015

So yeah, this landed in 2.14.0 and 3.3.0!

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

No branches or pull requests

3 participants