Skip to content

Commit 143ad3f

Browse files
committed
fix: resolve type errors and i18n schema for dependents page
1 parent 22cb7f5 commit 143ad3f

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ const resolvedVersion = computed(() => {
1919
return latest
2020
})
2121
22-
const displayVersion = computed(() => {
23-
if (!pkg.value || !resolvedVersion.value) return null
24-
return pkg.value.versions[resolvedVersion.value] ?? null
25-
})
22+
const displayVersion = computed(() => pkg.value?.requestedVersion ?? null)
2623
27-
const latestVersion = computed(() => displayVersion.value ?? null)
24+
const latestVersion = computed(() => {
25+
if (!pkg.value) return null
26+
const latestTag = pkg.value['dist-tags']?.latest
27+
if (!latestTag) return null
28+
return pkg.value.versions[latestTag] ?? null
29+
})
2830
2931
const versionUrlPattern = computed(() => {
3032
const split = packageName.value.split('/')

i18n/schema.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,12 @@
625625
"scroll_to_top": {
626626
"type": "string"
627627
},
628+
"previous": {
629+
"type": "string"
630+
},
631+
"next": {
632+
"type": "string"
633+
},
628634
"cancel": {
629635
"type": "string"
630636
},
@@ -960,6 +966,9 @@
960966
},
961967
"compare_this_package": {
962968
"type": "string"
969+
},
970+
"dependents": {
971+
"type": "string"
963972
}
964973
},
965974
"additionalProperties": false
@@ -1402,6 +1411,27 @@
14021411
},
14031412
"additionalProperties": false
14041413
},
1414+
"dependents": {
1415+
"type": "object",
1416+
"properties": {
1417+
"title": {
1418+
"type": "string"
1419+
},
1420+
"subtitle": {
1421+
"type": "string"
1422+
},
1423+
"count": {
1424+
"type": "string"
1425+
},
1426+
"error": {
1427+
"type": "string"
1428+
},
1429+
"none": {
1430+
"type": "string"
1431+
}
1432+
},
1433+
"additionalProperties": false
1434+
},
14051435
"maintainers": {
14061436
"type": "object",
14071437
"properties": {
@@ -2494,6 +2524,9 @@
24942524
"back_to_package": {
24952525
"type": "string"
24962526
},
2527+
"toggle_word_wrap": {
2528+
"type": "string"
2529+
},
24972530
"table": {
24982531
"type": "object",
24992532
"properties": {

server/api/registry/dependents/[...pkg].get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CACHE_MAX_AGE_FIVE_MINUTES, NPM_REGISTRY } from '#shared/utils/constants'
1+
import { CACHE_MAX_AGE_FIVE_MINUTES } from '#shared/utils/constants'
22

33
const NPM_SEARCH_BASE = 'https://registry.npmjs.org/-/v1/search'
44

0 commit comments

Comments
 (0)