Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Update globby to v11 #6776

Merged
merged 62 commits into from
Feb 18, 2020
Merged

Conversation

fisker
Copy link
Member

@fisker fisker commented Nov 1, 2019

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory)
  • (If the change is user-facing) I’ve added my changes to the CHANGELOG.unreleased.md file following the template.
  • I’ve read the contributing guidelines.

Try the playground for this PR

Christopher J. Brody and others added 30 commits October 29, 2019 15:50
with some minor test snapshot updates in tests_integration since
fast-glob does not always keep the same file order as node-glob
use of no `nodir: true` option was introduced in 639c523
but it does not seem to be needed with some newer
versions of globby
ref: https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows

Co-authored-by: fisker Cheung <lionkay@gmail.com>
Co-authored-by: Christopher J. Brody <chris@brody.consulting>
and update some snapshots in tests_integration
# Conflicts:
#	package.json
#	yarn.lock
@fisker
Copy link
Member Author

fisker commented Feb 10, 2020

@evilebottnawi I think we can merge this when we got a stable release after this beta version.

@alexander-akait
Copy link
Member

@fisker @mrmlnc already released 3.2.0 😄

@fisker
Copy link
Member Author

fisker commented Feb 10, 2020

@evilebottnawi No, he didn't.

image

@alexander-akait
Copy link
Member

Oh, yes, I was wrong mrmlnc/fast-glob#251

# Conflicts:
#	tests_integration/__tests__/__snapshots__/patterns.js.snap
@fisker fisker changed the title [WIP] Update Globby to v11 (with fast-glob) Update globby to v11 Feb 16, 2020
@fisker fisker force-pushed the globby-10-update-with-fast-glob branch from aa5893b to becc585 Compare February 16, 2020 15:59
@fisker fisker force-pushed the globby-10-update-with-fast-glob branch from becc585 to ea7ceb0 Compare February 16, 2020 16:00
@fisker fisker marked this pull request as ready for review February 16, 2020 16:12
@fisker
Copy link
Member Author

fisker commented Feb 16, 2020

@evilebottnawi @thorn0

We got the fast-glob version we want, should good to merge.

Thanks to @mrmlnc @brodybits

src/cli/util.js Outdated Show resolved Hide resolved
@thorn0 thorn0 mentioned this pull request Feb 16, 2020
Copy link
Member

@alexander-akait alexander-akait left a comment

Choose a reason for hiding this comment

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

Good job, but we have bad idea here

// https://github.com/mrmlnc/fast-glob#how-to-write-patterns-on-windows
if (path.sep === "\\") {
patterns = patterns.map(path => path.replace(/\\/g, "/"));
}
Copy link
Member

Choose a reason for hiding this comment

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

It is bad idea, on linux I can use \ as part of directory or file name

Copy link
Member

Choose a reason for hiding this comment

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

That's exactly why I asked to wrap this replace into if (path.sep === "\\").

Copy link
Member

Choose a reason for hiding this comment

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

What about WSL? It is allow to use linux filenames and run commands on windows and verse vice. Yes we can try to keep backward compatibility but I think we should throw a warning on using \ as part of glob

Copy link
Member

Choose a reason for hiding this comment

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

No problems with WSL as far as I can see. It behaves just like 'normal' Linux. You can create a file named \ there, but if you look at that file from Windows it won't be named \. The names are somehow mapped.

Please describe the scenario that you worry about. I don't understand. What exactly can go wrong? Are you simply uncomfortable about the fact that commands with \ aren't cross-platform compatible?

Copy link
Member

Choose a reason for hiding this comment

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

Please describe the scenario that you worry about. I don't understand. What exactly can go wrong?

Glob should use / always, please read - https://github.com/micromatch/micromatch#backslashes

To solve this, you might be inspired to do something like 'foo\*'.replace(/\/g, '/'), but this causes another, potentially much more serious, problem.

I can spend time investigation in detail why is dangerous, but I also prefer to trust the documentation and not make some mistakes that we are warned about.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should use path.normalize to allow using ../../foo too?

Copy link
Member

Choose a reason for hiding this comment

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

It's a horrible mess, but everyone seems to be okay with it. So I guess we should be okay too.

Copy link
Member

Choose a reason for hiding this comment

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

Let's move tests for normalize to #7587

Copy link
Member

Choose a reason for hiding this comment

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

Also we will add more tests when implement expand directories, so 👍 on that

@thorn0 thorn0 merged commit 3cef19c into prettier:next Feb 18, 2020
@mrmlnc
Copy link

mrmlnc commented Feb 18, 2020

JFYI: This problem may affect your package: mrmlnc/fast-glob#253

@thorn0
Copy link
Member

thorn0 commented Feb 18, 2020

I think we're okay. Our yarn.lock contains only picomatch 2.2.1. The "direct install from GitHub" use case can be broken though.

@fisker fisker deleted the globby-10-update-with-fast-glob branch March 17, 2020 02:53
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2021
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

6 participants