fix: hide compiled build artifacts from project file tree

PR #154 intentionally unhid user-imported reference files (.docx, .zip,
media, ...) but also dropped the ignore rules for compiled build
artifacts, contradicting the __pycache__ skip it kept and the test from
PR #129. Restore ignore rules for .pyc/.pyo/.pyd/.o/.obj/.so/.dylib/.dll
and align the tauri-fs tests with that behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
delibae 2026-08-28 19:22:55 +09:00
parent 67dde775ac
commit 28f61908a7
2 changed files with 14 additions and 6 deletions

View file

@ -23,9 +23,12 @@ describe("tauri fs helpers", () => {
expect(getProjectFileType("script.py")).toBe("other");
});
it("ignores LaTeX build artifacts", () => {
it("ignores LaTeX and compiled build artifacts", () => {
expect(getProjectFileType("main.aux")).toBeNull();
expect(getProjectFileType("main.synctex.gz")).toBeNull();
expect(getProjectFileType("module.pyc")).toBeNull();
expect(getProjectFileType("native.pyd")).toBeNull();
expect(getProjectFileType("libnative.so")).toBeNull();
});
it("keeps imported files with arbitrary extensions visible", () => {
@ -33,8 +36,6 @@ describe("tauri fs helpers", () => {
expect(getProjectFileType("paper.docx")).toBe("other");
expect(getProjectFileType("data.xlsx")).toBe("other");
expect(getProjectFileType("movie.mp4")).toBe("other");
expect(getProjectFileType("module.pyc")).toBe("other");
expect(getProjectFileType("native.pyd")).toBe("other");
});
});
@ -90,7 +91,6 @@ describe("tauri fs helpers", () => {
it("keeps arbitrary file formats visible as other files", async () => {
vi.mocked(readDir).mockResolvedValue([
{ name: "module.pyc", isDirectory: false },
{ name: "worker.py", isDirectory: false },
{ name: "notes.txt", isDirectory: false },
] as any);
@ -99,11 +99,10 @@ describe("tauri fs helpers", () => {
const result = await scanProjectFolder("/project");
expect(result.files.map((file) => file.relativePath)).toEqual([
"module.pyc",
"worker.py",
"notes.txt",
]);
expect(stat).toHaveBeenCalledTimes(3);
expect(stat).toHaveBeenCalledTimes(2);
expect(result.files.every((file) => file.type === "other")).toBe(true);
});
});

View file

@ -81,6 +81,15 @@ const IGNORED_EXTENSIONS = new Set([
".vrb",
".run.xml",
".bcf",
// Compiled build artifacts (never user reference material)
".pyc",
".pyo",
".pyd",
".o",
".obj",
".so",
".dylib",
".dll",
]);
export function shouldSkipProjectDirectory(name: string): boolean {