repo-visualizer icon indicating copy to clipboard operation
repo-visualizer copied to clipboard

Respect gitignore

Open jlarmstrongiv opened this issue 2 years ago • 1 comments

Other utilities like cloc follow the .gitignore file. It would be great for the repo-visualizer to also follow the .gitignore file, rather than specifying what to ignore again with globs.

Here is an example on how to get the list of files that the repo-visualizer should use:

import { execa } from "execa";
import { getMonorepoPath } from "@nodejs/list-workspaces";

export async function gitLsFiles() {
  const { stdout } = await execa("git", ["ls-files"], {
    maxBuffer: 500_000_000,
    cwd: await getMonorepoPath(),
  });
  return stdout;
}

jlarmstrongiv avatar Mar 16 '22 06:03 jlarmstrongiv

makes a lot of sense, especially if it's ignored if there are paths specified. We would love a PR, if anyone is interested!

Wattenberger avatar Mar 25 '22 22:03 Wattenberger