fix(package-manager): ignore managed npm folders in cloud sync
closes #4763
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { realpathSync } from "node:fs";
|
||||
import { isAbsolute, relative, resolve as resolvePath, sep } from "node:path";
|
||||
import { spawnProcessSync } from "./child-process.ts";
|
||||
|
||||
/**
|
||||
* Resolve a path to its canonical (real) form, following symlinks.
|
||||
@@ -55,3 +56,20 @@ export function formatPathRelativeToCwdOrAbsolute(filePath: string, cwd: string)
|
||||
const absolutePath = resolveAgainstCwd(filePath, cwd);
|
||||
return (getCwdRelativePath(absolutePath, cwd) ?? absolutePath).split(sep).join("/");
|
||||
}
|
||||
|
||||
export function markPathIgnoredByCloudSync(path: string): void {
|
||||
const attrs =
|
||||
process.platform === "darwin"
|
||||
? ["com.dropbox.ignored", "com.apple.fileprovider.ignore#P"]
|
||||
: process.platform === "linux"
|
||||
? ["user.com.dropbox.ignored"]
|
||||
: [];
|
||||
|
||||
for (const attr of attrs) {
|
||||
if (process.platform === "darwin") {
|
||||
spawnProcessSync("xattr", ["-w", attr, "1", path], { encoding: "utf-8", stdio: "ignore" });
|
||||
} else {
|
||||
spawnProcessSync("setfattr", ["-n", attr, "-v", "1", path], { encoding: "utf-8", stdio: "ignore" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user