diff --git a/backend/ee-repo-ref.txt b/backend/ee-repo-ref.txt index 2c3170d5f3..79d825bcf3 100644 --- a/backend/ee-repo-ref.txt +++ b/backend/ee-repo-ref.txt @@ -1 +1 @@ -0eccae6a9a9ecde09816cd4d88ca9ab305659e4c +0eccae6a9a9ecde09816cd4d88ca9ab305659e4c \ No newline at end of file diff --git a/cli/src/commands/sync/sync.ts b/cli/src/commands/sync/sync.ts index b7ceb86f75..b1b6142ce5 100644 --- a/cli/src/commands/sync/sync.ts +++ b/cli/src/commands/sync/sync.ts @@ -88,6 +88,7 @@ import { isAppPath, isRawAppPath, extractFolderPath, + extractResourceName, isFlowMetadataFile, isAppMetadataFile, isRawAppMetadataFile, @@ -2730,18 +2731,40 @@ export async function push( path: removeSuffix(target, getDeleteSuffix("raw_app", "json")), }); } else { - // For individual file deletions within a raw app, - // re-push the entire raw app so the backend gets the updated file list - // (the deleted file won't be included in the push) - await pushObj( - workspaceId, - target, - undefined, - undefined, - opts.plainSecrets ?? false, - alreadySynced, - opts.message, - ); + const rawAppFolder = extractFolderPath(target, "raw_app"); + let folderExists = false; + if (rawAppFolder) { + try { + await Deno.stat(rawAppFolder); + folderExists = true; + } catch { + // folder doesn't exist + } + } + if (folderExists) { + // For individual file deletions within a raw app, + // re-push the entire raw app so the backend gets the updated file list + // (the deleted file won't be included in the push) + await pushObj( + workspaceId, + target, + undefined, + undefined, + opts.plainSecrets ?? false, + alreadySynced, + opts.message, + ); + } else { + // The entire raw app folder was deleted locally, + // delete the raw app on the server + const remotePath = extractResourceName(target, "raw_app"); + if (remotePath) { + await wmill.deleteApp({ + workspace: workspaceId, + path: remotePath, + }); + } + } } break; case "schedule":