mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-05-18 11:56:26 +02:00
fix/docs: release tags don't work for newly-created/updated icons (#1589)
As per 3391b5b717, the format of new GitHub release tags is just the version number without the `v` prefix. As we can see on https://github.com/lucide-icons/lucide/releases?page=2, versions older than 0.266.0 use a `v` prefix. The current docs assume that all versions contain the `v` prefix; this PR fixes it so that the format of versions both from before and after this change are accounted for.
This commit is contained in:
@@ -10,7 +10,7 @@ import { data } from './HomeHeroBefore.data'
|
||||
:href="`https://github.com/lucide-icons/lucide/releases/tag/${data.version}`"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>{{ data.version }}</Badge>
|
||||
>v{{ data.version }}</Badge>
|
||||
</HomeContainer>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useRouter } from 'vitepress';
|
||||
import IconInfo from './IconInfo.vue';
|
||||
import Badge from '../base/Badge.vue';
|
||||
import { computedAsync } from '@vueuse/core';
|
||||
import { satisfies } from 'semver';
|
||||
|
||||
const props = defineProps<{
|
||||
iconName: string
|
||||
@@ -25,6 +26,12 @@ const icon = computedAsync<IconEntity | null>(async () => {
|
||||
const emit = defineEmits(['close'])
|
||||
const isOpen = computed(() => !!icon.value)
|
||||
|
||||
function releaseTagLink(version) {
|
||||
const shouldAddV = satisfies(version, `<0.266.0`)
|
||||
|
||||
return `https://github.com/lucide-icons/lucide/releases/tag/${shouldAddV ? 'v' : ''}${version}`
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
emit('close')
|
||||
}
|
||||
@@ -43,7 +50,7 @@ const Expand = createLucideIcon('Expand', expand)
|
||||
<Badge
|
||||
v-if="icon.createdRelease"
|
||||
class="version"
|
||||
:href="`https://github.com/lucide-icons/lucide/releases/tag/v${icon.createdRelease.version}`"
|
||||
:href="releaseTagLink(icon.createdRelease.version)"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>v{{ icon.createdRelease.version }}</Badge>
|
||||
|
||||
@@ -21,6 +21,7 @@ import Label from '../.vitepress/theme/components/base/Label.vue'
|
||||
import VPButton from 'vitepress/dist/client/theme-default/components/VPButton.vue';
|
||||
import { data } from './codeExamples.data'
|
||||
import { camelCase, startCase } from 'lodash-es'
|
||||
import { satisfies } from 'semver'
|
||||
|
||||
const { params } = useData()
|
||||
|
||||
@@ -35,6 +36,12 @@ const codeExample = computed(() => data.codeExamples?.map(
|
||||
}
|
||||
).join('') ?? []
|
||||
)
|
||||
|
||||
function releaseTagLink(version) {
|
||||
const shouldAddV = satisfies(version, `<0.266.0`)
|
||||
|
||||
return `https://github.com/lucide-icons/lucide/releases/tag/${shouldAddV ? 'v' : ''}${version}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<div :class="$style.layout">
|
||||
@@ -61,7 +68,7 @@ const codeExample = computed(() => data.codeExamples?.map(
|
||||
>
|
||||
<Label>Created:</Label>
|
||||
<Badge
|
||||
:href="`https://github.com/lucide-icons/lucide/releases/tag/v${params.createdRelease.version}`"
|
||||
:href="releaseTagLink(params.createdRelease.version)"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
@@ -74,7 +81,7 @@ const codeExample = computed(() => data.codeExamples?.map(
|
||||
>
|
||||
<Label>Last changed:</Label>
|
||||
<Badge
|
||||
:href="`https://github.com/lucide-icons/lucide/releases/tag/v${params.changedRelease.version}`"
|
||||
:href="releaseTagLink(params.changedRelease.version)"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-replace": "^5.0.2",
|
||||
"@types/semver": "^7.5.3",
|
||||
"h3": "^1.8.0",
|
||||
"nitropack": "npm:nitropack-edge@latest",
|
||||
"node-fetch": "2",
|
||||
|
||||
16
pnpm-lock.yaml
generated
16
pnpm-lock.yaml
generated
@@ -137,6 +137,9 @@ importers:
|
||||
'@rollup/plugin-replace':
|
||||
specifier: ^5.0.2
|
||||
version: 5.0.2(rollup@3.27.0)
|
||||
'@types/semver':
|
||||
specifier: ^7.5.3
|
||||
version: 7.5.3
|
||||
h3:
|
||||
specifier: ^1.8.0
|
||||
version: 1.8.0
|
||||
@@ -6342,6 +6345,7 @@ packages:
|
||||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
micromatch: 4.0.5
|
||||
napi-wasm: 1.1.0
|
||||
dev: true
|
||||
bundledDependencies:
|
||||
- napi-wasm
|
||||
@@ -7678,6 +7682,10 @@ packages:
|
||||
resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==}
|
||||
dev: true
|
||||
|
||||
/@types/semver@7.5.3:
|
||||
resolution: {integrity: sha512-OxepLK9EuNEIPxWNME+C6WwbRAOOI2o2BaQEGzz5Lu2e4Z5eDnEo+/aVEDMIXywoJitJ7xWd641wrGLZdtwRyw==}
|
||||
dev: true
|
||||
|
||||
/@types/send@0.17.1:
|
||||
resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==}
|
||||
dependencies:
|
||||
@@ -16082,6 +16090,10 @@ packages:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
/napi-wasm@1.1.0:
|
||||
resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==}
|
||||
dev: true
|
||||
|
||||
/natural-compare-lite@1.4.0:
|
||||
resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==}
|
||||
dev: true
|
||||
@@ -20919,6 +20931,10 @@ packages:
|
||||
resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==}
|
||||
dev: true
|
||||
|
||||
/ufo@1.3.1:
|
||||
resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==}
|
||||
dev: true
|
||||
|
||||
/uglify-es@3.3.9:
|
||||
resolution: {integrity: sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==}
|
||||
engines: {node: '>=0.8.0'}
|
||||
|
||||
Reference in New Issue
Block a user