mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Make sure wrappers are removed from shell configs when running setup-ci after setup
This commit is contained in:
parent
2c568bb2a2
commit
f54c9233e1
3 changed files with 69 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import chalk from "chalk";
|
||||
import { ui } from "../environment/userInteraction.js";
|
||||
import { getPackageManagerList, knownAikidoTools, getShimsDir } from "./helpers.js";
|
||||
import { detectShells } from "./shellDetection.js";
|
||||
import fs from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
|
|
@ -37,12 +38,33 @@ export async function setupCi() {
|
|||
fs.mkdirSync(shimsDir, { recursive: true });
|
||||
}
|
||||
|
||||
cleanupLegacyShellInit();
|
||||
createShims(shimsDir);
|
||||
ui.writeInformation(`Created shims in ${shimsDir}`);
|
||||
modifyPathForCi(shimsDir, binDir);
|
||||
ui.writeInformation(`Added shims directory to PATH for CI environments.`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes shell-based initialization from RC files when switching to --ci install mode.
|
||||
*/
|
||||
function cleanupLegacyShellInit() {
|
||||
let shells;
|
||||
try {
|
||||
shells = detectShells();
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const shell of shells) {
|
||||
try {
|
||||
shell.teardown(knownAikidoTools);
|
||||
} catch {
|
||||
// Best-effort cleanup — don't fail the install if teardown errors
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} shimsDir
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue