Skip to content

Commit 3d683ec

Browse files
authored
Fix gen-workflow-mermaid to be compatible with Node 22.18+ (#31250)
* Fix gen-workflow-mermaid to be compatible with Node 22.18+ Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent 81f1841 commit 3d683ec

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

scripts/gen-workflow-mermaid.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import path from "node:path";
55
import YAML from "yaml";
66
import parseArgs from "minimist";
77
import cronstrue from "cronstrue";
8-
import { partition } from "lodash";
8+
import _ from "lodash";
99

1010
const argv = parseArgs<{
1111
debug: boolean;
@@ -81,7 +81,7 @@ class Graph<T extends Node> {
8181
public removeNode(node: T): Edge<T>[] {
8282
if (!this.nodes.has(node.id)) return [];
8383
this.nodes.delete(node.id);
84-
const [removedEdges, keptEdges] = partition(
84+
const [removedEdges, keptEdges] = _.partition(
8585
this.edges,
8686
([source, destination]) => source === node || destination === node,
8787
);
@@ -384,6 +384,7 @@ class MermaidFlowchartPrinter {
384384
private static INDENT = 4;
385385
private currentIndent = 0;
386386
private text = "";
387+
private readonly markdown: boolean;
387388
public readonly idGenerator = new IdGenerator();
388389

389390
private print(text: string): void {
@@ -400,11 +401,8 @@ class MermaidFlowchartPrinter {
400401
this.currentIndent += delta * MermaidFlowchartPrinter.INDENT;
401402
}
402403

403-
public constructor(
404-
direction: "TD" | "TB" | "BT" | "RL" | "LR",
405-
title?: string,
406-
private readonly markdown = false,
407-
) {
404+
public constructor(direction: "TD" | "TB" | "BT" | "RL" | "LR", title?: string, markdown = false) {
405+
this.markdown = markdown;
408406
if (this.markdown) {
409407
this.print("```mermaid");
410408
}

0 commit comments

Comments
 (0)