@freshworks/shiftleft-tools 1.1.9 → 1.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/link.js +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@freshworks/shiftleft-tools",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"description": "CLI for managing Cursor rules/skills and Postman test infrastructure across Java Spring Boot and Node.js/Express projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/commands/link.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
existsSync,
|
|
3
3
|
lstatSync,
|
|
4
4
|
rmSync,
|
|
5
|
+
unlinkSync,
|
|
5
6
|
symlinkSync,
|
|
6
7
|
statSync,
|
|
7
8
|
readdirSync,
|
|
@@ -43,11 +44,20 @@ function cursorRuleLinks(stack) {
|
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
function removeExisting(p) {
|
|
47
|
+
let st;
|
|
46
48
|
try {
|
|
47
|
-
lstatSync(p); // throws if absent
|
|
48
|
-
rmSync(p, { recursive: true, force: true });
|
|
49
|
+
st = lstatSync(p); // throws if absent
|
|
49
50
|
} catch {
|
|
50
|
-
|
|
51
|
+
return; // nothing there
|
|
52
|
+
}
|
|
53
|
+
// unlink symlinks (incl. dangling) and plain files; only recurse for real
|
|
54
|
+
// dirs. rmSync({recursive,force}) silently no-ops on a dangling symlink
|
|
55
|
+
// (force swallows the ENOENT from following the dead link), leaving it in
|
|
56
|
+
// place — so a later mkdir/write follows it and fails with ENOENT.
|
|
57
|
+
if (st.isSymbolicLink() || !st.isDirectory()) {
|
|
58
|
+
unlinkSync(p);
|
|
59
|
+
} else {
|
|
60
|
+
rmSync(p, { recursive: true, force: true });
|
|
51
61
|
}
|
|
52
62
|
}
|
|
53
63
|
|