mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-28 04:02:18 +01:00
fix(server): ignore sibling worktrees in dev watch
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
ddcaaebe57
commit
9dc630196d
2 files changed
+16
No files matched your search
@@ -36,6 +36,9 @@ describe("resolveServerDevWatchIgnorePaths", () => {
|
||||
expect(ignorePaths).toContain(fs.realpathSync(path.join(sharedUiRoot, ".vite")));
|
||||
expect(ignorePaths).toContain(path.join(worktreeUiRoot, "dist"));
|
||||
expect(ignorePaths).toContain(fs.realpathSync(path.join(sharedUiRoot, "dist")));
|
||||
const sharedWorktreesRoot = path.join(tempRoot, "repo", ".paperclip", "worktrees");
|
||||
expect(ignorePaths).toContain(sharedWorktreesRoot);
|
||||
expect(ignorePaths).toContain(`${sharedWorktreesRoot.replaceAll(path.sep, "/")}/**`);
|
||||
expect(ignorePaths).toContain("**/{node_modules,bower_components,vendor}/**");
|
||||
expect(ignorePaths).toContain("**/.vite-temp/**");
|
||||
});
|
||||
|
||||
@@ -18,6 +18,11 @@ function addIgnorePath(target: Set<string>, candidate: string): void {
|
||||
}
|
||||
|
||||
export function resolveServerDevWatchIgnorePaths(serverRoot: string): string[] {
|
||||
const checkoutRoot = path.dirname(serverRoot);
|
||||
const linkedWorktreesRoot = path.dirname(checkoutRoot);
|
||||
const isLinkedWorktree =
|
||||
path.basename(linkedWorktreesRoot) === "worktrees" &&
|
||||
path.basename(path.dirname(linkedWorktreesRoot)) === ".paperclip";
|
||||
const ignorePaths = new Set<string>([
|
||||
"**/{node_modules,bower_components,vendor}/**",
|
||||
"**/.vite-temp/**",
|
||||
@@ -28,6 +33,14 @@ export function resolveServerDevWatchIgnorePaths(serverRoot: string): string[] {
|
||||
"../ui/node_modules/.vite-temp",
|
||||
"../ui/.vite",
|
||||
"../ui/dist",
|
||||
// Git worktrees live under <repo>/.paperclip/worktrees, each a full
|
||||
// checkout (source + its own .paperclip). Watching them can add hundreds
|
||||
// of thousands of files, stalling tsx watch before it ever spawns the
|
||||
// server. None of them are part of this checkout's reloadable source.
|
||||
// A linked checkout has serverRoot at
|
||||
// <repo>/.paperclip/worktrees/<branch>/server. In that case, the shared
|
||||
// worktree directory is the checkout's parent, not a nested path.
|
||||
isLinkedWorktree ? "../.." : "../.paperclip/worktrees",
|
||||
// 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",
|
||||
|
||||
Reference in new issue
Block a user