@swmansion/argent 0.18.1-next.19 → 0.18.1-next.20
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/dist/installer.mjs +52 -8
- package/package.json +1 -1
package/dist/installer.mjs
CHANGED
|
@@ -20955,6 +20955,48 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20955
20955
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20956
20956
|
fs13.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20957
20957
|
}
|
|
20958
|
+
var MAX_SYMLINK_HOPS = 40;
|
|
20959
|
+
function realpathOrSelf(p) {
|
|
20960
|
+
try {
|
|
20961
|
+
return fs13.realpathSync(p);
|
|
20962
|
+
} catch {
|
|
20963
|
+
return p;
|
|
20964
|
+
}
|
|
20965
|
+
}
|
|
20966
|
+
function resolveLinkedDestination(dest) {
|
|
20967
|
+
let current = dest;
|
|
20968
|
+
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20969
|
+
let entry;
|
|
20970
|
+
try {
|
|
20971
|
+
entry = fs13.lstatSync(current);
|
|
20972
|
+
} catch {
|
|
20973
|
+
return current === dest || dirExists(path14.dirname(current)) ? current : dest;
|
|
20974
|
+
}
|
|
20975
|
+
if (!entry.isSymbolicLink()) return current;
|
|
20976
|
+
try {
|
|
20977
|
+
current = path14.resolve(realpathOrSelf(path14.dirname(current)), fs13.readlinkSync(current));
|
|
20978
|
+
} catch {
|
|
20979
|
+
return dest;
|
|
20980
|
+
}
|
|
20981
|
+
}
|
|
20982
|
+
return dest;
|
|
20983
|
+
}
|
|
20984
|
+
function copyDir(src, dest) {
|
|
20985
|
+
if (!fs13.existsSync(src)) return null;
|
|
20986
|
+
const target = resolveLinkedDestination(dest);
|
|
20987
|
+
copyTree(src, target);
|
|
20988
|
+
return target;
|
|
20989
|
+
}
|
|
20990
|
+
function copyTree(src, dest) {
|
|
20991
|
+
const entries = fs13.readdirSync(src, { withFileTypes: true });
|
|
20992
|
+
fs13.mkdirSync(dest, { recursive: true });
|
|
20993
|
+
for (const entry of entries) {
|
|
20994
|
+
const from = path14.join(src, entry.name);
|
|
20995
|
+
const to = resolveLinkedDestination(path14.join(dest, entry.name));
|
|
20996
|
+
if (entry.isDirectory()) copyTree(from, to);
|
|
20997
|
+
else fs13.copyFileSync(from, to);
|
|
20998
|
+
}
|
|
20999
|
+
}
|
|
20958
21000
|
function dirExists(p) {
|
|
20959
21001
|
try {
|
|
20960
21002
|
return fs13.statSync(p).isDirectory();
|
|
@@ -22211,6 +22253,10 @@ function removeClaudePermission(root, scope) {
|
|
|
22211
22253
|
const next = allow.filter((rule) => rule !== PERMISSION_RULE);
|
|
22212
22254
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
22213
22255
|
}
|
|
22256
|
+
function formatCopyDestination(target, writtenPath, root) {
|
|
22257
|
+
if (writtenPath === target.targetPath) return target.label;
|
|
22258
|
+
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
22259
|
+
}
|
|
22214
22260
|
function formatManagedPathLabel(targetPath, root) {
|
|
22215
22261
|
const home = homedir4();
|
|
22216
22262
|
if (targetPath === home || targetPath.startsWith(`${home}${path15.sep}`)) {
|
|
@@ -22357,10 +22403,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22357
22403
|
const managedTargets = getManagedContentTargets(adapters, root, scope);
|
|
22358
22404
|
for (const target of managedTargets.ruleTargets) {
|
|
22359
22405
|
try {
|
|
22360
|
-
|
|
22361
|
-
|
|
22362
|
-
|
|
22363
|
-
results.push(` Copied rules to ${target.targetPath}`);
|
|
22406
|
+
const written = copyDir(rulesDir, target.targetPath);
|
|
22407
|
+
if (written) {
|
|
22408
|
+
results.push(` Copied rules to ${formatCopyDestination(target, written, root)}`);
|
|
22364
22409
|
}
|
|
22365
22410
|
} catch (err) {
|
|
22366
22411
|
results.push(` Could not copy rules to ${target.targetPath}: ${err}`);
|
|
@@ -22368,10 +22413,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22368
22413
|
}
|
|
22369
22414
|
for (const target of managedTargets.agentTargets) {
|
|
22370
22415
|
try {
|
|
22371
|
-
|
|
22372
|
-
|
|
22373
|
-
|
|
22374
|
-
results.push(` Copied agents to ${target.targetPath}`);
|
|
22416
|
+
const written = copyDir(agentsDir, target.targetPath);
|
|
22417
|
+
if (written) {
|
|
22418
|
+
results.push(` Copied agents to ${formatCopyDestination(target, written, root)}`);
|
|
22375
22419
|
}
|
|
22376
22420
|
} catch (err) {
|
|
22377
22421
|
results.push(` Could not copy agents to ${target.targetPath}: ${err}`);
|
package/package.json
CHANGED