From f8530799006583100428cbaf124f44f7e1ab8671 Mon Sep 17 00:00:00 2001 From: Jessie Wei Date: Mon, 16 Dec 2024 14:21:49 +1100 Subject: [PATCH] fix(build): Restructure the workspace examples dynamic import name (#153) --- scripts/data/injectData.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/data/injectData.ts b/scripts/data/injectData.ts index 5882a8f..3d20a25 100644 --- a/scripts/data/injectData.ts +++ b/scripts/data/injectData.ts @@ -37,6 +37,8 @@ const WORKSPACE_EXAMPLE_FILE = path.join( "workspaceExamples.ts" ); +const WORKSPACE_EXPORT_PREFIX = "ThreatComposer_Workspace_"; + type DataType = "ThreatPack" | "MitigationPack" | "WorkspaceExample"; const CONFIG_DATA_FOLDER = { @@ -90,7 +92,11 @@ const injectDataEntry = ( `${fileNames .map((fn) => { if (dataType === "WorkspaceExample") { - return `{ name: '${fn}', value: ${fn}, },`; + const name = fn + .replace(WORKSPACE_EXPORT_PREFIX, "") + .replace(/[_]+/gm, " "); + + return `{ name: '${name}', value: ${fn}, },`; } return `${fn},`;