Skip to content

Commit

Permalink
fix(build): Restructure the workspace examples dynamic import name (#153
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jessieweiyi authored Dec 16, 2024
1 parent 4d3c12b commit f853079
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/data/injectData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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},`;
Expand Down

0 comments on commit f853079

Please sign in to comment.