Skip to content

Commit

Permalink
Do not link .DS_Store file (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
moltam89 authored Jan 6, 2025
1 parent c838052 commit ed2d89a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utils/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ed2d89a

Please sign in to comment.