From 915fff4a86abc8a3c800eb489d90336f12498fe4 Mon Sep 17 00:00:00 2001 From: Jessie Wei Date: Mon, 16 Dec 2024 13:59:07 +1100 Subject: [PATCH] fix(build): Restructure the workspace examples dynamic import name --- 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},`;