Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build): Restructure the workspace examples dynamic import name #153

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading