All files / apps/developer-portal/layers/projects/app/utils changelogs.ts

100% Statements 4/4
50% Branches 1/2
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10      3x 12x     3x 14x  
import { toTitleCase } from "#layers/docs/shared/docPages.ts";
 
/** `/packages/ui/changelog` → `packages/ui`, which is how metrics keys its projects. */
export const changelogRoot = (path: string): string =>
    path.replace(/^\//, "").replace(/\/changelog$/i, "");
 
/** `packages/i18n` → `I18n`: the project's own name, not the area it lives under. */
export const projectDisplayName = (root: string): string =>
    toTitleCase(root.split("/").at(-1) ?? root);