2026-03-26 10:36:49 -05:00
|
|
|
import fs from "node:fs";
|
|
|
|
|
import path from "node:path";
|
|
|
|
|
|
2026-03-26 12:27:17 -05:00
|
|
|
function toGlobstarPath(candidate: string): string {
|
|
|
|
|
return `${candidate.replaceAll(path.sep, "/")}/**`;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-26 10:36:49 -05:00
|
|
|
function addIgnorePath(target: Set<string>, candidate: string): void {
|
|
|
|
|
target.add(candidate);
|
2026-03-26 12:27:17 -05:00
|
|
|
target.add(toGlobstarPath(candidate));
|
2026-03-26 10:36:49 -05:00
|
|
|
try {
|
2026-03-26 12:27:17 -05:00
|
|
|
const realPath = fs.realpathSync(candidate);
|
|
|
|
|
target.add(realPath);
|
|
|
|
|
target.add(toGlobstarPath(realPath));
|
2026-03-26 10:36:49 -05:00
|
|
|
} catch {
|
|
|
|
|
// Ignore paths that do not exist in the current checkout.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function resolveServerDevWatchIgnorePaths(serverRoot: string): string[] {
|
2026-03-26 12:27:17 -05:00
|
|
|
const ignorePaths = new Set<string>([
|
|
|
|
|
"**/{node_modules,bower_components,vendor}/**",
|
|
|
|
|
"**/.vite-temp/**",
|
|
|
|
|
]);
|
2026-03-26 10:36:49 -05:00
|
|
|
|
2026-03-26 12:27:17 -05:00
|
|
|
for (const relativePath of [
|
|
|
|
|
"../ui/node_modules",
|
|
|
|
|
"../ui/node_modules/.vite-temp",
|
|
|
|
|
"../ui/.vite",
|
|
|
|
|
"../ui/dist",
|
2026-03-31 20:21:13 +01:00
|
|
|
// npm install during reinstall would trigger a restart mid-request
|
|
|
|
|
// if tsx watch sees the new files. Exclude the managed plugins dir.
|
|
|
|
|
process.env.HOME + "/.paperclip/adapter-plugins",
|
2026-03-26 12:27:17 -05:00
|
|
|
]) {
|
2026-03-26 10:36:49 -05:00
|
|
|
addIgnorePath(ignorePaths, path.resolve(serverRoot, relativePath));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return [...ignorePaths];
|
|
|
|
|
}
|