Skip to content

Conversation

nlf
Copy link
Contributor

@nlf nlf commented Oct 29, 2020

this makes it so that instead of deleting the entire node_modules directory, we instead delete only its contents. this used to be the case in npm 6 and the current state of things is a regression.

@nlf nlf requested a review from a team as a code owner October 29, 2020 20:31
@nlf nlf force-pushed the nlf/delete-contents-not-dir branch from e365961 to f00d475 Compare October 29, 2020 20:38
@darcyclarke darcyclarke added Release 7.x work is associated with a specific npm 7 release release: next These items should be addressed in the next release labels Oct 29, 2020
@@ -31,7 +31,7 @@ const ci = async () => {
'later to generate a package-lock.json file, then try again.'
throw new Error(msg)
}),
rimraf(`${where}/node_modules/`),
rimraf(`${where}/node_modules/*`, { glob: { dot: true, nosort: true, silent: true } }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this include .bin and other dotfiles?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes! the default options passed to glob from rimraf are { nosort: true, silent: true } adding dot: true is the effective change here, which per glob's documentation:

You can make glob treat dots as normal characters by setting dot:true in the options.

@ruyadorno ruyadorno mentioned this pull request Oct 30, 2020
@ruyadorno ruyadorno closed this in 2a680e9 Oct 30, 2020
@nlf nlf deleted the nlf/delete-contents-not-dir branch March 28, 2022 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: next These items should be addressed in the next release Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants