From 8ddbf645bf82f918c6a7616093e182132ffa0205 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 21 Jun 2024 15:27:16 +0200 Subject: [PATCH] fix(cli): fix push flow support for windows --- cli/apps.ts | 8 ++++---- cli/flow.ts | 1 + cli/types.ts | 10 +++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cli/apps.ts b/cli/apps.ts index 38b724b994..73912bf981 100644 --- a/cli/apps.ts +++ b/cli/apps.ts @@ -32,13 +32,13 @@ export async function pushApp( return; } alreadySynced.push(localPath); - + remotePath.replaceAll(SEP, "/"); let app: any = undefined; // deleting old app if it exists in raw mode try { app = await AppService.getAppByPath({ workspace, - path: remotePath.replaceAll(SEP, "/"), + path: remotePath, }); } catch { //ignore @@ -84,7 +84,7 @@ export async function pushApp( log.info(colors.bold.yellow(`Updating app ${remotePath}...`)); await AppService.updateApp({ workspace, - path: remotePath.replaceAll(SEP, "/"), + path: remotePath, requestBody: { deployment_message: message, ...localApp, @@ -96,7 +96,7 @@ export async function pushApp( await AppService.createApp({ workspace, requestBody: { - path: remotePath.replaceAll(SEP, "/"), + path: remotePath, deployment_message: message, ...localApp, }, diff --git a/cli/flow.ts b/cli/flow.ts index 587654bdeb..cb11133206 100644 --- a/cli/flow.ts +++ b/cli/flow.ts @@ -79,6 +79,7 @@ export async function pushFlow( return; } alreadySynced.push(localPath); + remotePath = remotePath.replaceAll(SEP, "/"); let flow: Flow | undefined = undefined; try { flow = await FlowService.getFlowByPath({ diff --git a/cli/types.ts b/cli/types.ts index 9501d0a9a7..d94bba6cac 100644 --- a/cli/types.ts +++ b/cli/types.ts @@ -1,6 +1,6 @@ // deno-lint-ignore-file no-explicit-any -import { colors, log, path, yamlParse, yamlStringify } from "./deps.ts"; +import { SEP, colors, log, path, yamlParse, yamlStringify } from "./deps.ts"; import { pushApp } from "./apps.ts"; import { pushFolder } from "./folder.ts"; import { pushFlow } from "./flow.ts"; @@ -111,14 +111,14 @@ export async function pushObj( const typeEnding = getTypeStrFromPath(p); if (typeEnding === "app") { - const appName = p.split(".app" + path.sep)[0]; + const appName = p.split(".app" + SEP)[0]; await pushApp(workspace, appName, appName + ".app", message); } else if (typeEnding === "folder") { await pushFolder(workspace, p, befObj, newObj); } else if (typeEnding === "variable") { await pushVariable(workspace, p, befObj, newObj, plainSecrets); } else if (typeEnding === "flow") { - const flowName = p.split(".flow" + path.sep)[0]; + const flowName = p.split(".flow" + SEP)[0]; await pushFlow(workspace, flowName, flowName + ".flow", message); } else if (typeEnding === "resource") { await pushResource(workspace, p, befObj, newObj); @@ -169,10 +169,10 @@ export function getTypeStrFromPath( | "user" | "group" | "settings" { - if (p.includes(".flow" + path.sep)) { + if (p.includes(".flow" + SEP)) { return "flow"; } - if (p.includes(".app" + path.sep)) { + if (p.includes(".app" + SEP)) { return "app"; } const parsed = path.parse(p);