Skip to content

Commit ba7281d

Browse files
committed
refactor: replace installSize prop with dependencies in DownloadButton
1 parent cef21bb commit ba7281d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

app/components/Package/DownloadButton.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<script setup lang="ts">
2-
import type { SlimPackumentVersion, InstallSizeResult } from '#shared/types'
2+
import type { SlimPackumentVersion, DependencySize } from '#shared/types'
33
import { onClickOutside, useEventListener, useMediaQuery } from '@vueuse/core'
44
55
const props = withDefaults(
66
defineProps<{
77
packageName: string
88
version: SlimPackumentVersion
9-
installSize: InstallSizeResult | null
9+
dependencies: DependencySize[] | null
1010
size?: 'small' | 'medium'
1111
}>(),
1212
{
@@ -23,7 +23,7 @@ const dropdownPosition = shallowRef<{ top: number; left: number } | null>(null)
2323
const menuId = 'download-menu'
2424
const menuItems = computed(() => {
2525
const items = [{ id: 'package', label: t('package.download.package'), icon: 'i-lucide:package' }]
26-
if (props.installSize) {
26+
if (props.dependencies?.length) {
2727
items.push({
2828
id: 'dependencies',
2929
label: t('package.download.dependencies'),
@@ -140,7 +140,7 @@ async function downloadPackage() {
140140
}
141141
142142
function downloadDependenciesScript() {
143-
if (!props.installSize) return
143+
if (!props.dependencies?.length) return
144144
145145
const lines = [
146146
'#!/bin/bash',
@@ -159,7 +159,7 @@ function downloadDependenciesScript() {
159159
}
160160
161161
// Add dependencies
162-
props.installSize.dependencies.forEach(dep => {
162+
props.dependencies.forEach(dep => {
163163
if (!dep.tarballUrl) return
164164
lines.push(`# ${dep.name}@${dep.version}`)
165165
lines.push(

app/pages/package/[[org]]/[name].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ const showSkeleton = shallowRef(false)
777777
v-if="displayVersion"
778778
:package-name="pkg.name"
779779
:version="displayVersion"
780-
:install-size="installSize ?? null"
780+
:dependencies="installSize?.dependencies ?? null"
781781
size="small"
782782
/>
783783
<PackageManagerSelect />

test/nuxt/a11y.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2947,7 +2947,7 @@ describe('component accessibility audits', () => {
29472947
version: '3.5.0',
29482948
dist: { tarball: 'https://registry.npmjs.org/vue/-/vue-3.5.0.tgz' },
29492949
} as any,
2950-
installSize: null,
2950+
dependencies: null,
29512951
},
29522952
})
29532953
const results = await runAxe(component)

0 commit comments

Comments
 (0)