From 94ee076aad40b4009df672a8be9f17f03403f006 Mon Sep 17 00:00:00 2001 From: Austin Fulbright Date: Tue, 20 Aug 2024 06:46:33 -0400 Subject: [PATCH] fixed config for user configs --- .../mermaid/src/diagrams/git/gitGraphAst.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/mermaid/src/diagrams/git/gitGraphAst.ts b/packages/mermaid/src/diagrams/git/gitGraphAst.ts index 99d5340cd..4b61c3563 100644 --- a/packages/mermaid/src/diagrams/git/gitGraphAst.ts +++ b/packages/mermaid/src/diagrams/git/gitGraphAst.ts @@ -1,5 +1,6 @@ import { log } from '../../logger.js'; -import { random } from '../../utils.js'; +import { cleanAndMerge, random } from '../../utils.js'; +import { getConfig as commonGetConfig } from '../../config.js'; import common from '../common/common.js'; import { setAccTitle, @@ -37,12 +38,16 @@ interface GitGraphState { } const DEFAULT_GITGRAPH_CONFIG: Required = DEFAULT_CONFIG.gitGraph; - -const mainBranchName = DEFAULT_GITGRAPH_CONFIG.mainBranchName; -const mainBranchOrder = DEFAULT_GITGRAPH_CONFIG.mainBranchOrder; -const config: Required = structuredClone(DEFAULT_GITGRAPH_CONFIG); - -const getConfig = (): Required => structuredClone(config); +const getConfig = (): Required => { + const config = cleanAndMerge({ + ...DEFAULT_GITGRAPH_CONFIG, + ...commonGetConfig().gitGraph, + }); + return config; +}; +const config = getConfig(); +const mainBranchName = config.mainBranchName; +const mainBranchOrder = config.mainBranchOrder; const state = new ImperativeState(() => ({ commits: new Map(),