Skip to content

Commit 750072c

Browse files
committed
fixing some (minor) things caught by coderabbitai
1 parent 746464f commit 750072c

File tree

8 files changed

+26
-21
lines changed

8 files changed

+26
-21
lines changed

app/components/Changelog/Card.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const formattedDate = useDateFormat(() => release.publishedAt, 'YYYY-MM-DD', {})
99
1010
const cardId = computed(() => (release.publishedAt ? `date-${formattedDate.value}` : undefined))
1111
12-
const navId = computed(() => `releaae-${encodeURIComponent(release.title)}`)
12+
const navId = computed(() => `release-${encodeURIComponent(release.title)}`)
1313
1414
function navigateToTitle() {
1515
navigateTo(`#${navId.value}`)
@@ -28,10 +28,10 @@ function navigateToTitle() {
2828
{{ release.title }}
2929
</a>
3030
</h2>
31-
<TagStatic v-if="release.prerelease" variant="default" :tabindex="0" class="h-unset">
31+
<TagStatic v-if="release.prerelease" variant="default" class="h-unset">
3232
{{ $t('changelog.pre_release') }}
3333
</TagStatic>
34-
<TagStatic v-if="release.draft" variant="default" :tabindex="0" class="h-unset">
34+
<TagStatic v-if="release.draft" variant="default" class="h-unset">
3535
{{ $t('changelog.draft') }}
3636
</TagStatic>
3737
<div class="flex-1" aria-hidden="true"></div>

app/components/Changelog/Markdown.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ const { info, tpTarget } = defineProps<{
77
const { data } = useLazyFetch(() => `/api/changelog/md/${info.provider}/${info.repo}/${info.path}`)
88
</script>
99
<template>
10-
<Teleport
11-
v-if="data?.toc && data.toc.length > 1 && !!tpTarget"
12-
:to="tpTarget"
13-
class="flex justify-end mt-3"
14-
>
10+
<Teleport v-if="data?.toc && data.toc.length > 1 && !!tpTarget" :to="tpTarget">
1511
<ReadmeTocDropdown :toc="data.toc" class="justify-self-end" />
1612
</Teleport>
1713
<Readme v-if="data?.html" :html="data.html"></Readme>

app/composables/useProviderIcon.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import type { ProviderId } from '#imports'
12
import type { IconClass } from '~/types/icon'
3+
import { computed, toValue } from 'vue'
24

3-
const PROVIDER_ICONS: Record<string, IconClass> = {
5+
const PROVIDER_ICONS: Record<ProviderId, IconClass> = {
46
github: 'i-simple-icons:github',
57
gitlab: 'i-simple-icons:gitlab',
68
bitbucket: 'i-simple-icons:bitbucket',

app/pages/package-changes/[...path].vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ const tptoc = useTemplateRef('tptoc')
108108
</div>
109109
</header>
110110

111-
<section class="container w-full" v-if="changelog">
112-
<LazyChangelogReleases v-if="changelog.type == 'release'" :info="changelog" />
111+
<section class="container w-full" v-if="!pending">
112+
<LazyChangelogReleases v-if="changelog?.type == 'release'" :info="changelog" />
113113
<LazyChangelogMarkdown
114-
v-else-if="changelog.type == 'md'"
114+
v-else-if="changelog?.type == 'md'"
115115
:info="changelog"
116116
:tpTarget="tptoc"
117117
/>
118-
<p v-else-if="!pending" class="mt-5">{{ $t('changelog.no_logs') }}</p>
118+
<p class="mt-5">{{ $t('changelog.no_logs') }}</p>
119119
</section>
120120
</main>
121121
</template>

i18n/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,6 @@
12001200
"changelog": {
12011201
"pre_release": "Pre-release",
12021202
"draft": "Draft",
1203-
"no_logs": "Sorry, this package doesn't track any changelogs or their method of trackings changes isn't supported"
1203+
"no_logs": "Sorry, this package does not publish changelogs, or its changelog format is not supported."
12041204
}
12051205
}

lunaria/files/en-GB.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,6 @@
11651165
"changelog": {
11661166
"pre_release": "Pre-release",
11671167
"draft": "Draft",
1168-
"no_logs": "Sorry, this package doesn't track any changelogs or their method of trackings changes isn't supported"
1168+
"no_logs": "Sorry, this package does not publish changelogs, or its changelog format is not supported."
11691169
}
11701170
}

lunaria/files/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,6 @@
11651165
"changelog": {
11661166
"pre_release": "Pre-release",
11671167
"draft": "Draft",
1168-
"no_logs": "Sorry, this package doesn't track any changelogs or their method of trackings changes isn't supported"
1168+
"no_logs": "Sorry, this package does not publish changelogs, or its changelog format is not supported."
11691169
}
11701170
}

server/utils/changelog/markdown.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function changelogRenderer(mdRepoInfo: MarkdownRepoInfo) {
2525
const titleAttr = title ? ` title="${title}"` : ''
2626
const plainText = text.replace(/<[^>]*>/g, '').trim()
2727

28-
if (href.startsWith('mailto:') && !EMAIL_REGEX.test(text)) {
28+
if (href.startsWith('mailto:') && !EMAIL_REGEX.test(plainText)) {
2929
return text
3030
}
3131

@@ -260,15 +260,22 @@ function resolveUrl(url: string, repoInfo: MarkdownRepoInfo) {
260260
// Check if this is a markdown file link
261261
const isMarkdownFile = /\.md$/i.test(url.split('?')[0]?.split('#')[0] ?? '')
262262

263+
// if (url.startsWith('./') || url.startsWith('../')) {
264+
// // url constructor handles relative paths
265+
// return checkResolvedUrl(new URL(url, `${baseUrl}/${repoInfo.path ?? ''}`).href, baseUrl)
266+
// }
267+
263268
const baseUrl = isMarkdownFile ? repoInfo.blobBaseUrl : repoInfo.rawBaseUrl
264-
if (url.startsWith('./') || url.startsWith('../')) {
265-
// url constructor handles relative paths
266-
return checkResolvedUrl(new URL(url, `${baseUrl}/${repoInfo.path ?? ''}`).href, baseUrl)
267-
}
269+
268270
if (url.startsWith('/')) {
269271
return checkResolvedUrl(new URL(`${baseUrl}${url}`).href, baseUrl)
270272
}
271273

274+
if (!hasProtocol(url)) {
275+
// the '/' ensure bare relative links stay after "....../HEAD"
276+
return checkResolvedUrl(new URL(url, `${baseUrl}/${repoInfo.path ?? '/'}`).href, baseUrl)
277+
}
278+
272279
return url
273280
}
274281

0 commit comments

Comments
 (0)