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

Corner case when globbing current directory returns zero results #92

Closed
bglw opened this issue Jul 24, 2023 · 1 comment
Closed

Corner case when globbing current directory returns zero results #92

bglw opened this issue Jul 24, 2023 · 1 comment

Comments

@bglw
Copy link

bglw commented Jul 24, 2023

I have a weird case narrowed down where using a glob, a crawl path of ., and the withBasePath option together causes no results to be returned.

Reproduction setup:

npm init -y
npm pkg set type="module"
npm i fdir picomatch

mkdir content
touch content/file1.txt
touch content/file2.txt

Reproduction js:

import { fdir } from "fdir";

const run = async () => {
  const crawler = new fdir().withBasePath();
  crawler.glob("**/*.txt");
  const files = await crawler.crawl(".").withPromise();
  console.log(files);
};

run();

This will log out (on my machine) [].

This only occurs when all three options are configured as so.

  • Removing .withBasePath() causes the files to be found
  • Removing the glob(...) causes all files in the current directory to be found.
    • I haven't found a glob that will return any results, including a more explicit ./**/*.txt
  • Changing the path to crawler.crawl("content") or crawler.crawl(process.cwd()) causes the files to be found
    • "./" also does not work as the directory

I'm on an M1 Macbook, for reference.

@thecodrr
Copy link
Owner

Hi, thanks for reporting this issue! I will take a look at this ASAP.

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

2 participants