rimraf: Wildcards not supported in v4 anymore

Hello, Unfortunately, the recent update broke one of my builds. I run rimraf in a C# project file with the following line, which should delete all markdown files beginning with C:

<Exec Command="npx rimraf ../../../docs/Packets/C*.md"></Exec>

Was this change intended? If yes, is my solution correct by specifying the version in the command like this?:

<Exec Command="npx rimraf@3.0.2 ../../../docs/Packets/C*.md"></Exec>

Thanks

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Ok, decided, I’ll bring back globs when glob v9 lands. https://github.com/isaacs/node-glob/pull/489

Glob v9 published, going to get on this soon.

I understand that it is communicated in the changelog and readme, but I would appreciate a motivation or workaround.

I use rimraf exclusively for my cleanup tasks because it is the only way for me to make sure the globbing works on Windows as well as Linux.

What was the reason for removing glob support? If it was because of dependency and security concerns, will there be glob support in the future built into the package?

It might also be useful to change the error message, it took me some time to realize the glob patterns were removed on windows and the error message wasn’t helping at all

> rimraf packages/*/dist

Error: Illegal characters in path.
    at pathArg (C:\GitHub\lerna-lite\node_modules\.pnpm\rimraf@4.1.1\node_modules\rimraf\dist\cjs\src\path-arg.js:46:33)
    at X:\GitHub\lerna-lite\node_modules\.pnpm\rimraf@4.1.1\node_modules\rimraf\dist\cjs\src\index.js:39:66
    at Array.map (<anonymous>)
    ....

So in my case I was able to fix the issue by just getting rid of the /* (which I didn’t need) and that fixed it, but it would have been more helpful if the error message would say Illegal characters in path. Note that Globs are not supported

Landed on 4.2.0

thanks for considering reincorporating glob! It’s a very useful feature.

That’s the new direction to opt-in via --glob, I assume it’s for perf reasons, is that it?

Yes perf, but also to keep it from being a breaking change from 4.1

Yes, removing globs was intentional, as stated in the readme and changelog. You can specify the version as rimraf@3 to avoid the semver major jump.