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

expandDirectories doesn't work with ** #147

Open
arcanis opened this issue Jul 21, 2020 · 0 comments
Open

expandDirectories doesn't work with ** #147

arcanis opened this issue Jul 21, 2020 · 0 comments

Comments

@arcanis
Copy link

arcanis commented Jul 21, 2020

Runkit

const fs = require(`fs`);
const globby = require(`globby`);

fs.mkdirSync(`foo`);
fs.writeFileSync(`foo/bar.ts`, ``);

// Works -> ["foo/bar.ts"]
console.log(globby.sync(`foo`));

// Doesn't work -> []
console.log(globby.sync(`**/foo`));
github-merge-queue bot pushed a commit to yarnpkg/berry that referenced this issue Jul 26, 2023
**What's the problem this PR addresses?**
<!-- Describe the rationale of your PR. -->
<!-- Link all issues that it closes. (Closes/Resolves #xxxx.) -->

`globby` is built on top of `fast-glob` (which we already use in
`@yarnpkg/shell`), but the only useful feature it adds for us is
`expandDirectories` which [has been broken for 3
years](sindresorhus/globby#147) so we can't
use it anyways.

In addition, `globby` is maintained by a person that handles reasonable
criticism by blocking our lead maintainer on both Twitter and GitHub,
which makes it harder than necessary to communicate ¯\\_(ツ)_/¯.

**How did you fix it?**
<!-- A detailed description of your implementation. -->

Replaced `globby` with `fast-glob`.

Bundle size:
- Before: `2730152 bytes`
- After: `2720218 bytes`
- Improvement: `0.36%`

Benchmarks:
- Before:
```
Benchmark 1: YARN_IGNORE_PATH=1 node packages/yarnpkg-cli/bundles/yarn.js run
  Time (mean ± σ):     293.0 ms ±   4.2 ms    [User: 387.2 ms, System: 91.8 ms]
  Range (min … max):   285.8 ms … 299.5 ms    10 runs
```
- After:
```
Benchmark 1: YARN_IGNORE_PATH=1 node packages/yarnpkg-cli/bundles/yarn.js run
  Time (mean ± σ):     291.9 ms ±   2.4 ms    [User: 387.6 ms, System: 87.7 ms]
  Range (min … max):   286.6 ms … 294.3 ms    10 runs  
```

**Checklist**
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [X] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).

<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [X] I have set the packages that need to be released for my changes to
be effective.

<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [X] I will check that all automated PR checks pass before the PR gets
reviewed.

---------

Co-authored-by: Kristoffer K <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant