From ed2d89ad9bec46411e713408ad790f2343ca1bbb Mon Sep 17 00:00:00 2001 From: Tamas Molnar Date: Mon, 6 Jan 2025 09:03:01 +0100 Subject: [PATCH] Do not link .DS_Store file (#193) --- src/utils/link.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/utils/link.ts b/src/utils/link.ts index a6dfd3d5a..8887e01c2 100644 --- a/src/utils/link.ts +++ b/src/utils/link.ts @@ -5,12 +5,18 @@ import path from "path"; const { mkdir, link } = promises; -const passesFilter = (source: string, options?: Options) => - options?.filter === undefined +const passesFilter = (source: string, options?: Options) => { + const isDSStore = /\.DS_Store$/.test(source); + if (isDSStore) { + return false; // Exclude .DS_Store files + } + + return options?.filter === undefined ? true // no filter : typeof options.filter === "function" ? options.filter(source) // filter is function : options.filter.test(source); // filter is regex +}; /** * The goal is that this function has the same API as ncp, so they can be used * interchangeably.