All files / apps/developer-portal/layers/projects/app/components/changelog Notes.vue

100% Statements 4/4
100% Branches 8/8
100% Functions 3/3
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 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43                                                                      8x 8x 7x 3x        
<template>
    <UAlert
        v-if="unreleased"
        color="warning"
        variant="subtle"
        icon="i-lucide-package-open"
        :title="$t('changelogNotes.unreleased.title')"
        :description="$t('changelogNotes.unreleased.description', { projects: unreleased })"
    />
 
    <!-- Changelogs and versions both come from commit subjects, so one commitlint would reject never ships. -->
    <UAlert
        v-if="conventional !== null"
        :color="conventional === 100 ? 'neutral' : 'warning'"
        variant="subtle"
        icon="i-lucide-git-commit-horizontal"
        :title="$t('changelogNotes.conventional.title')"
        :description="$t('changelogNotes.conventional.description', { percent: conventional })"
        :ui="{ description: 'text-xs' }"
    />
</template>
 
<script setup lang="ts">
import { projectDisplayName } from "#layers/projects/app/utils/changelogs.ts";
import type { ProjectMetrics } from "#layers/snapshot/shared/types/ProjectMetrics.ts";
 
interface Props {
    projects: ProjectMetrics[];
    /** The share of recent commit subjects that parse, or null when it wasn't collected. */
    conventional: number | null;
}
 
const { projects, conventional } = defineProps<Props>();
 
// Projects with shipped commits and no CHANGELOG.md, the gap this page is for.
const unreleased = computed(() =>
    projects
        .filter((project) => !project.hasChangelog && (project.unreleasedCommits ?? 0) > 0)
        .map((project) => projectDisplayName(project.root))
        .join(", "),
);
</script>