refactor(compose): streamline command generation in deployCompose function

- Removed redundant command initialization and ensured proper command structure for deployment.
- Enhanced clarity by consolidating command building logic, improving maintainability of the deployCompose function.
This commit is contained in:
Mauricio Siu
2026-02-17 11:45:11 -06:00
parent 46e1bed5e9
commit 6350a8ddd3
2 changed files with 1 additions and 4 deletions
+1 -2
View File
@@ -248,7 +248,7 @@ export const deployCompose = async ({
} else { } else {
await execAsync(commandWithLog); await execAsync(commandWithLog);
} }
command = "set -e;";
if (compose.sourceType !== "raw") { if (compose.sourceType !== "raw") {
command += await generateApplyPatchesCommand({ command += await generateApplyPatchesCommand({
id: compose.composeId, id: compose.composeId,
@@ -257,7 +257,6 @@ export const deployCompose = async ({
}); });
} }
command = "set -e;";
command += await getBuildComposeCommand(entity); command += await getBuildComposeCommand(entity);
commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`; commandWithLog = `(${command}) >> ${deployment.logPath} 2>&1`;
if (compose.serverId) { if (compose.serverId) {
-2
View File
@@ -146,7 +146,6 @@ export const generateApplyPatchesCommand = async ({
const codePath = join(basePath, entity.appName, "code"); const codePath = join(basePath, entity.appName, "code");
const resultPatches = await findPatchesByEntityId(id, type); const resultPatches = await findPatchesByEntityId(id, type);
const patches = resultPatches.filter((p) => p.enabled); const patches = resultPatches.filter((p) => p.enabled);
let command = `echo "Applying ${patches.length} patch(es)...";`; let command = `echo "Applying ${patches.length} patch(es)...";`;
@@ -159,7 +158,6 @@ export const generateApplyPatchesCommand = async ({
rm -f "${filePath}"; rm -f "${filePath}";
`; `;
} else { } else {
// create and update: write file
command += ` command += `
file="${filePath}" file="${filePath}"
dir="$(dirname "$file")" dir="$(dirname "$file")"