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

config: only create config dir before write #20212

Closed
wants to merge 1 commit into from

Conversation

buddydvd
Copy link
Contributor

This change fixes the bug that creates unnecessary ./etc folder when calling npm with the --prefix flag.

See: #7249 (comment)

This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.
@buddydvd buddydvd requested a review from a team as a code owner March 31, 2018 01:36
@buddydvd
Copy link
Contributor Author

buddydvd commented Apr 3, 2018

PR #7249 (meant to fix #7233) introduced a regression that causes creation of extraneous etc folders when calling npm with the --prefix flag. The effect of the regression is documented in #7249 (closed), #11486 (closed), #11802 (closed), #17322.

This PR fixes the issue by reverting #7249 (while retaining the associated tests) and implementing the suggested fix as described here: #7249 (comment).

The essence of the fix is to only create the possibly missing etc folder just before npm is ready write to the global config file located at $prefix/etc/npmrc.

iarna pushed a commit that referenced this pull request Apr 9, 2018
This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.

PR-URL: #20212
Credit: @buddydvd
Reviewed-By: @iarna
Fixes: #17322
iarna pushed a commit that referenced this pull request Apr 10, 2018
This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.

PR-URL: #20212
Credit: @buddydvd
Reviewed-By: @iarna
Fixes: #17322
iarna pushed a commit that referenced this pull request Apr 10, 2018
This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.

PR-URL: #20212
Credit: @buddydvd
Reviewed-By: @iarna
Fixes: #17322
iarna pushed a commit that referenced this pull request Apr 10, 2018
This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.

PR-URL: #20212
Credit: @buddydvd
Reviewed-By: @iarna
Fixes: #17322
iarna pushed a commit that referenced this pull request Apr 11, 2018
This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.

PR-URL: #20212
Credit: @buddydvd
Reviewed-By: @iarna
Fixes: #17322
iarna pushed a commit that referenced this pull request Apr 11, 2018
This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.

PR-URL: #20212
Credit: @buddydvd
Reviewed-By: @iarna
Fixes: #17322
iarna pushed a commit that referenced this pull request Apr 11, 2018
This change fixes the bug that creates
unnecessary ./etc folder when calling npm
with the --prefix flag.

PR-URL: #20212
Credit: @buddydvd
Reviewed-By: @iarna
Fixes: #17322
@zkat
Copy link
Contributor

zkat commented Apr 18, 2018

This was already merged and is part of npm@6. Cheers!

@zkat zkat closed this Apr 18, 2018
@buddydvd buddydvd deleted the fix_globalconfig_mkdirp branch April 18, 2018 20:58
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.

None yet

3 participants