mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 16:02:19 +00:00
fix: cli uses await for every push call
This commit is contained in:
+21
-7
@@ -671,6 +671,7 @@ async function push(
|
||||
log.info(
|
||||
`remote (${workspace.name}) <- local: ${changes.length} changes to apply`
|
||||
);
|
||||
|
||||
if (changes.length > 0) {
|
||||
prettyChanges(changes);
|
||||
if (
|
||||
@@ -706,7 +707,12 @@ async function push(
|
||||
}
|
||||
continue;
|
||||
} else if (
|
||||
await handleFile(change.path, workspace.workspaceId, alreadySynced, opts.message)
|
||||
await handleFile(
|
||||
change.path,
|
||||
workspace.workspaceId,
|
||||
alreadySynced,
|
||||
opts.message
|
||||
)
|
||||
) {
|
||||
if (!opts.raw && stateExists) {
|
||||
await Deno.writeTextFile(stateTarget, change.after);
|
||||
@@ -720,14 +726,14 @@ async function push(
|
||||
const oldObj = parseFromPath(change.path, change.before);
|
||||
const newObj = parseFromPath(change.path, change.after);
|
||||
|
||||
pushObj(
|
||||
await pushObj(
|
||||
workspace.workspaceId,
|
||||
change.path,
|
||||
oldObj,
|
||||
newObj,
|
||||
opts.plainSecrets ?? false,
|
||||
opts.raw,
|
||||
opts.message,
|
||||
opts.message
|
||||
);
|
||||
|
||||
if (!opts.raw && stateExists) {
|
||||
@@ -740,7 +746,12 @@ async function push(
|
||||
) {
|
||||
continue;
|
||||
} else if (
|
||||
await handleFile(change.path, workspace.workspaceId, alreadySynced, opts.message)
|
||||
await handleFile(
|
||||
change.path,
|
||||
workspace.workspaceId,
|
||||
alreadySynced,
|
||||
opts.message
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
@@ -749,14 +760,14 @@ async function push(
|
||||
log.info(`Adding ${getTypeStrFromPath(change.path)} ${change.path}`);
|
||||
}
|
||||
const obj = parseFromPath(change.path, change.content);
|
||||
pushObj(
|
||||
await pushObj(
|
||||
workspace.workspaceId,
|
||||
change.path,
|
||||
undefined,
|
||||
obj,
|
||||
opts.plainSecrets ?? false,
|
||||
opts.raw,
|
||||
opts.message,
|
||||
opts.message
|
||||
);
|
||||
|
||||
if (!opts.raw && stateExists) {
|
||||
@@ -884,7 +895,10 @@ const command = new Command()
|
||||
.option("--skip-secrets", "Skip syncing only secrets variables")
|
||||
.option("--skip-resources", "Skip syncing resources")
|
||||
.option("--include-schedules", "Include syncing schedules")
|
||||
.option("--message <message:string>", "Include a message that will be added to all scripts/flows/apps updated during this push")
|
||||
.option(
|
||||
"--message <message:string>",
|
||||
"Include a message that will be added to all scripts/flows/apps updated during this push"
|
||||
)
|
||||
// deno-lint-ignore no-explicit-any
|
||||
.action(push as any);
|
||||
|
||||
|
||||
+16
-9
@@ -93,32 +93,39 @@ export function showConflict(path: string, local: string, remote: string) {
|
||||
log.info("\n");
|
||||
}
|
||||
|
||||
export function pushObj(
|
||||
export async function pushObj(
|
||||
workspace: string,
|
||||
p: string,
|
||||
befObj: any,
|
||||
newObj: any,
|
||||
plainSecrets: boolean,
|
||||
checkForCreate: boolean,
|
||||
message?: string,
|
||||
message?: string
|
||||
) {
|
||||
const typeEnding = getTypeStrFromPath(p);
|
||||
|
||||
if (typeEnding === "app") {
|
||||
pushApp(workspace, p, befObj, newObj, checkForCreate, message);
|
||||
await pushApp(workspace, p, befObj, newObj, checkForCreate, message);
|
||||
} else if (typeEnding === "folder") {
|
||||
pushFolder(workspace, p, befObj, newObj, checkForCreate);
|
||||
await pushFolder(workspace, p, befObj, newObj, checkForCreate);
|
||||
} else if (typeEnding === "variable") {
|
||||
pushVariable(workspace, p, befObj, newObj, plainSecrets, checkForCreate);
|
||||
await pushVariable(
|
||||
workspace,
|
||||
p,
|
||||
befObj,
|
||||
newObj,
|
||||
plainSecrets,
|
||||
checkForCreate
|
||||
);
|
||||
} else if (typeEnding === "flow") {
|
||||
const flowName = p.split(".flow/")[0];
|
||||
pushFlow(workspace, flowName, flowName + ".flow", message);
|
||||
await pushFlow(workspace, flowName, flowName + ".flow", message);
|
||||
} else if (typeEnding === "resource") {
|
||||
pushResource(workspace, p, befObj, newObj, checkForCreate);
|
||||
await pushResource(workspace, p, befObj, newObj, checkForCreate);
|
||||
} else if (typeEnding === "resource-type") {
|
||||
pushResourceType(workspace, p, befObj, newObj, checkForCreate);
|
||||
await pushResourceType(workspace, p, befObj, newObj, checkForCreate);
|
||||
} else if (typeEnding === "schedule") {
|
||||
pushSchedule(workspace, p, befObj, newObj, checkForCreate);
|
||||
await pushSchedule(workspace, p, befObj, newObj, checkForCreate);
|
||||
} else {
|
||||
throw new Error("infer type unreachable");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user