Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: issue #7892 - fix for npm install creating directories and empty package.json file #7938

Closed
wants to merge 0 commits into from

Conversation

Kyle-Ignis
Copy link

fix for npm install creating directories and empty package.json file when accidentally run in the wrong directory in a project.

References

Fixes #7892

@Kyle-Ignis Kyle-Ignis requested a review from a team as a code owner November 25, 2024 23:14
@Kyle-Ignis
Copy link
Author

ready for review, likely will need some updates.

@wraithgar
Copy link
Member

While this does appear to fix the immediate problem, it does so in a pretty heavy-handed way. Typically we don't want to add single-use lib files to npm. If code needs to be shared between commands that's usually a signal that the code belongs elsewhere. Also, we tend not to add new unit tests. All new tests should interact with npm at the highest level possible, right now that means the mock-npm in tests. If this ends up in arborist it would need to go into the appropriate test and interact w/ arborist directly, not this new code in isolation.

This likely is something that applies to all arborist commands. Off the top of my head I know that npm update isn't accounted for here, but it would need to be.

The fix for this probably needs to live in arborist itself. That's the package that "owns" this process.

@Kyle-Ignis
Copy link
Author

Thank you for the guidance. I will take another stab at this from that route. Hopefully we can get this fixed and solve this issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] npm install creates directories and empty package.json
2 participants