mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 00:02:23 +00:00
fix(cli): cli flow sync improvements
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ export interface FlowFile {
|
||||
schema?: any;
|
||||
}
|
||||
|
||||
let alreadySynced: string[] = [];
|
||||
const alreadySynced: string[] = [];
|
||||
|
||||
export async function pushFlow(
|
||||
workspace: string,
|
||||
|
||||
+14
-6
@@ -70,15 +70,23 @@ async function FSFSElement(p: string): Promise<DynFSElement> {
|
||||
}
|
||||
|
||||
function prioritizeName(name: string): string {
|
||||
if (name == "summary") return "aa";
|
||||
if (name == "name") return "aaaa";
|
||||
if (name == "display_name") return "aaa";
|
||||
if (name == "description") return "ab";
|
||||
if (name == "value") return "ac";
|
||||
if (name == "id") return "a";
|
||||
if (name == "type") return "b";
|
||||
if (name == "summary") return "d";
|
||||
if (name == "name") return "e";
|
||||
if (name == "display_name") return "f";
|
||||
if (name == "description") return "g";
|
||||
if (name == "value") return "h";
|
||||
if (name == "content") return "i";
|
||||
if (name == "modules") return "j";
|
||||
if (name == "failure_modules") return "k";
|
||||
if (name == "input_transforms") return "l";
|
||||
if (name == "lock") return "z";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
const yamlOptions = {
|
||||
export const yamlOptions = {
|
||||
sortKeys: (a: any, b: any) => {
|
||||
return prioritizeName(a).localeCompare(prioritizeName(b));
|
||||
},
|
||||
|
||||
+6
-2
@@ -14,6 +14,7 @@ import { pushResource } from "./resource.ts";
|
||||
import { pushResourceType } from "./resource-type.ts";
|
||||
import { pushVariable } from "./variable.ts";
|
||||
import * as Diff from "npm:diff";
|
||||
import { yamlOptions } from "./sync.ts";
|
||||
|
||||
export interface DifferenceCreate {
|
||||
type: "CREATE";
|
||||
@@ -54,7 +55,10 @@ export function isSuperset(
|
||||
console.log(`Key ${key} not found in remote`);
|
||||
} else {
|
||||
console.log(`Found diff for ${key}:`);
|
||||
showDiff(yamlStringify(sub), yamlStringify(supers));
|
||||
showDiff(
|
||||
yamlStringify(sub, yamlOptions),
|
||||
yamlStringify(supers, yamlOptions)
|
||||
);
|
||||
}
|
||||
}
|
||||
return eq;
|
||||
@@ -79,7 +83,7 @@ export function showDiff(local: string, remote: string) {
|
||||
lines = lines.concat(part.value.split("\n").slice(-2));
|
||||
}
|
||||
// print white if unchanged
|
||||
finalString += `\x1b[37m${part.value}\x1b[0m`;
|
||||
finalString += `\x1b[37m${lines.join("\n")}\x1b[0m`;
|
||||
}
|
||||
}
|
||||
console.log(finalString);
|
||||
|
||||
Reference in New Issue
Block a user