Skip to content

Commit a2b8240

Browse files
authored
Merge branch 'main' into feat/org-search-url-operators
2 parents d672144 + 306d537 commit a2b8240

File tree

3 files changed

+60
-15
lines changed

3 files changed

+60
-15
lines changed

CONTRIBUTING.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,43 @@ We want to create 'a fast, modern browser for the npm registry.' This means, amo
1414
- Layout shift, flakiness, slowness is The Worst. We need to continually iterate to create the most performant, best DX possible.
1515
- We want to provide information in the best way. We don't want noise, cluttered display, or confusing UI. If in doubt: choose simplicity.
1616

17+
## Table of Contents
18+
19+
- [Getting started](#getting-started)
20+
- [Prerequisites](#prerequisites)
21+
- [Setup](#setup)
22+
- [Development workflow](#development-workflow)
23+
- [Available commands](#available-commands)
24+
- [Project structure](#project-structure)
25+
- [Local connector CLI](#local-connector-cli)
26+
- [Code style](#code-style)
27+
- [TypeScript](#typescript)
28+
- [Server API patterns](#server-api-patterns)
29+
- [Import order](#import-order)
30+
- [Naming conventions](#naming-conventions)
31+
- [Vue components](#vue-components)
32+
- [RTL Support](#rtl-support)
33+
- [Localization (i18n)](#localization-i18n)
34+
- [Approach](#approach)
35+
- [Adding a new locale](#adding-a-new-locale)
36+
- [Update translation](#update-translation)
37+
- [Adding translations](#adding-translations)
38+
- [Translation key conventions](#translation-key-conventions)
39+
- [Using i18n-ally (recommended)](#using-i18n-ally-recommended)
40+
- [Formatting numbers and dates](#formatting-numbers-and-dates)
41+
- [Testing](#testing)
42+
- [Unit tests](#unit-tests)
43+
- [Component accessibility tests](#component-accessibility-tests)
44+
- [End to end tests](#end-to-end-tests)
45+
- [Submitting changes](#submitting-changes)
46+
- [Before submitting](#before-submitting)
47+
- [Pull request process](#pull-request-process)
48+
- [Commit messages and PR titles](#commit-messages-and-pr-titles)
49+
- [Pre-commit hooks](#pre-commit-hooks)
50+
- [Using AI](#using-ai)
51+
- [Questions](#questions)
52+
- [License](#license)
53+
1754
## Getting started
1855

1956
### Prerequisites
@@ -111,7 +148,7 @@ To help with this, the project uses `oxfmt` to handle formatting via a pre-commi
111148

112149
If you want to get ahead of any formatting issues, you can also run `pnpm lint:fix` before committing to fix formatting across the whole project.
113150

114-
### Typescript
151+
### TypeScript
115152

116153
- We care about good types – never cast things to `any` 💪
117154
- Validate rather than just assert

app/components/BaseCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defineProps<{
1515
<!-- Glow effect for exact matches -->
1616
<div
1717
v-if="isExactMatch"
18-
class="absolute -inset-px rounded-lg bg-gradient-to-r from-accent/0 via-accent/20 to-accent/0 opacity-100 blur-sm -z-1 pointer-events-none motion-reduce:opacity-50"
18+
class="absolute -inset-px rounded-lg bg-gradient-to-r from-accent/0 via-accent/0 to-accent/10 opacity-100 blur-sm -z-1 pointer-events-none motion-reduce:opacity-50"
1919
aria-hidden="true"
2020
/>
2121
<slot />

app/composables/usePackageComparison.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import type { FacetValue, ComparisonFacet, ComparisonPackage, Packument } from '#shared/types'
1+
import type {
2+
FacetValue,
3+
ComparisonFacet,
4+
ComparisonPackage,
5+
Packument,
6+
VulnerabilityTreeResult,
7+
} from '#shared/types'
28
import { encodePackageName } from '#shared/utils/npm'
39
import type { PackageAnalysisResponse } from './usePackageAnalysis'
410
import { isBinaryOnlyPackage } from '#shared/utils/binary-detection'
@@ -17,7 +23,7 @@ export interface PackageComparisonData {
1723
analysis?: PackageAnalysisResponse
1824
vulnerabilities?: {
1925
count: number
20-
severity: { critical: number; high: number; medium: number; low: number }
26+
severity: { critical: number; high: number; moderate: number; low: number }
2127
}
2228
metadata?: {
2329
license?: string
@@ -98,9 +104,9 @@ export function usePackageComparison(packageNames: MaybeRefOrGetter<string[]>) {
98104
`https://api.npmjs.org/downloads/point/last-week/${encodePackageName(name)}`,
99105
).catch(() => null),
100106
$fetch<PackageAnalysisResponse>(`/api/registry/analysis/${name}`).catch(() => null),
101-
$fetch<{
102-
vulnerabilities: Array<{ severity: string }>
103-
}>(`/api/registry/vulnerabilities/${name}`).catch(() => null),
107+
$fetch<VulnerabilityTreeResult>(`/api/registry/vulnerabilities/${name}`).catch(
108+
() => null,
109+
),
104110
])
105111

106112
const versionData = pkgData.versions[latestVersion]
@@ -115,12 +121,14 @@ export function usePackageComparison(packageNames: MaybeRefOrGetter<string[]>) {
115121
exports: versionData?.exports,
116122
})
117123

118-
// Count vulnerabilities by severity
119-
const vulnCounts = { critical: 0, high: 0, medium: 0, low: 0 }
120-
const vulnList = vulns?.vulnerabilities ?? []
121-
for (const v of vulnList) {
122-
const sev = v.severity.toLowerCase() as keyof typeof vulnCounts
123-
if (sev in vulnCounts) vulnCounts[sev]++
124+
// Vulnerabilities
125+
let vulnsTotal: number = 0
126+
let vulnsSeverity = { critical: 0, high: 0, moderate: 0, low: 0 }
127+
128+
if (vulns) {
129+
const { total, ...severity } = vulns.totalCounts
130+
vulnsTotal = total
131+
vulnsSeverity = severity
124132
}
125133

126134
return {
@@ -134,8 +142,8 @@ export function usePackageComparison(packageNames: MaybeRefOrGetter<string[]>) {
134142
installSize: undefined, // Will be filled in second pass
135143
analysis: analysis ?? undefined,
136144
vulnerabilities: {
137-
count: vulnList.length,
138-
severity: vulnCounts,
145+
count: vulnsTotal,
146+
severity: vulnsSeverity,
139147
},
140148
metadata: {
141149
license: pkgData.license,

0 commit comments

Comments
 (0)