Skip to content

Commit 7abe2cd

Browse files
Merge branch 'main' into feat/brand-page
2 parents d63a73b + 32ba285 commit 7abe2cd

File tree

16 files changed

+1517
-134
lines changed

16 files changed

+1517
-134
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ jobs:
111111
run: pnpm vp test --project nuxt --coverage --reporter=default --reporter=junit --outputFile=test-report.junit.xml
112112

113113
- name: ⬆︎ Upload coverage reports to Codecov
114-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
114+
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
115115
with:
116116
report_type: test_results
117117
env:
118118
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
119119

120120
- name: ⬆︎ Upload coverage reports to Codecov
121-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
121+
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
122122
env:
123123
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
124124

app/components/Compare/FacetBarChart.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ function buildExportFilename(extension: string): string {
113113
const config = computed<VueUiHorizontalBarConfig>(() => {
114114
return {
115115
theme: isDarkMode.value ? 'dark' : '',
116+
a11y: {
117+
translations: {
118+
keyboardNavigation: $t('package.trends.chart_assistive_text.keyboard_navigation_vertical'),
119+
tableAvailable: $t('package.trends.chart_assistive_text.table_available'),
120+
tableCaption: $t('package.trends.chart_assistive_text.table_caption'),
121+
},
122+
},
116123
userOptions: {
117124
buttons: {
118125
tooltip: false,
@@ -272,6 +279,12 @@ const config = computed<VueUiHorizontalBarConfig>(() => {
272279
<div class="font-mono facet-bar">
273280
<ClientOnly v-if="dataset.length">
274281
<VueUiHorizontalBar :key="chartKey" :dataset :config class="[direction:ltr]">
282+
<template #hint="{ isVisible }">
283+
<p v-if="isVisible" class="text-accent text-xs pt-2" aria-hidden="true">
284+
{{ $t('compare.packages.bar_chart_nav_hint') }}
285+
</p>
286+
</template>
287+
275288
<template #pattern="{ patternId, seriesIndex }">
276289
<ChartPatternSlot
277290
v-if="seriesIndex != 0"
@@ -349,6 +362,19 @@ const config = computed<VueUiHorizontalBarConfig>(() => {
349362
</div>
350363
</template>
351364

365+
<style scoped>
366+
:deep(.vue-data-ui-component svg:focus-visible) {
367+
outline: 1px solid var(--accent-color) !important;
368+
border-radius: 0.1rem;
369+
outline-offset: 3px !important;
370+
}
371+
:deep(.vue-ui-user-options-button:focus-visible),
372+
:deep(.vue-ui-user-options :first-child:focus-visible) {
373+
outline: 0.1rem solid var(--accent-color) !important;
374+
border-radius: 0.25rem;
375+
}
376+
</style>
377+
352378
<style>
353379
.facet-bar .atom-subtitle {
354380
width: 80% !important;

app/components/Header/ConnectorModal.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const executeNpmxConnectorCommand = computed(() => {
4141
return getExecuteCommand({
4242
packageName: 'npmx-connector',
4343
packageManager: selectedPM.value,
44+
isBinaryOnly: true,
4445
})
4546
})
4647
</script>

app/components/Package/TrendsChart.vue

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,15 @@ watch(
13881388
const chartConfig = computed<VueUiXyConfig>(() => {
13891389
return {
13901390
theme: isDarkMode.value ? 'dark' : ('' as VueDataUiTheme),
1391+
a11y: {
1392+
translations: {
1393+
keyboardNavigation: $t(
1394+
'package.trends.chart_assistive_text.keyboard_navigation_horizontal',
1395+
),
1396+
tableAvailable: $t('package.trends.chart_assistive_text.table_available'),
1397+
tableCaption: $t('package.trends.chart_assistive_text.table_caption'),
1398+
},
1399+
},
13911400
chart: {
13921401
height: chartHeight.value,
13931402
backgroundColor: colors.value.bg,
@@ -1878,6 +1887,13 @@ watch(selectedMetric, value => {
18781887
@zoomEnd="setIsZoom"
18791888
@zoomReset="isZoomed = false"
18801889
>
1890+
<!-- Keyboard navigation hint -->
1891+
<template #hint="{ isVisible }">
1892+
<p v-if="isVisible" class="text-accent text-xs -mt-6 text-center" aria-hidden="true">
1893+
{{ $t('compare.packages.line_chart_nav_hint') }}
1894+
</p>
1895+
</template>
1896+
18811897
<!-- Injecting custom svg elements -->
18821898
<template #svg="{ svg }">
18831899
<!-- Estimation lines for monthly & yearly granularities when the end date induces a downwards trend -->
@@ -2130,6 +2146,19 @@ watch(selectedMetric, value => {
21302146
</div>
21312147
</template>
21322148

2149+
<style scoped>
2150+
:deep(.vue-data-ui-component svg:focus-visible) {
2151+
outline: 1px solid var(--accent-color) !important;
2152+
border-radius: 0.1rem;
2153+
outline-offset: 0;
2154+
}
2155+
:deep(.vue-ui-user-options-button:focus-visible),
2156+
:deep(.vue-ui-user-options :first-child:focus-visible) {
2157+
outline: 0.1rem solid var(--accent-color) !important;
2158+
border-radius: 0.25rem;
2159+
}
2160+
</style>
2161+
21332162
<style>
21342163
.vue-ui-pen-and-paper-actions {
21352164
background: var(--bg-elevated) !important;

app/components/Package/VersionDistribution.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ const hasMinimap = computed<boolean>(() => {
161161
const chartConfig = computed<VueUiXyConfig>(() => {
162162
return {
163163
theme: isDarkMode.value ? 'dark' : '',
164+
a11y: {
165+
translations: {
166+
keyboardNavigation: $t(
167+
'package.trends.chart_assistive_text.keyboard_navigation_horizontal',
168+
),
169+
tableAvailable: $t('package.trends.chart_assistive_text.table_available'),
170+
tableCaption: $t('package.trends.chart_assistive_text.table_caption'),
171+
},
172+
},
164173
chart: {
165174
title: {
166175
text: dateRangeLabel.value,
@@ -447,6 +456,13 @@ const chartConfig = computed<VueUiXyConfig>(() => {
447456
<ClientOnly v-if="xyDataset.length > 0 && !error">
448457
<div class="chart-container w-full" :key="groupingMode">
449458
<VueUiXy :dataset="xyDataset" :config="chartConfig" class="[direction:ltr]">
459+
<!-- Keyboard navigation hint -->
460+
<template #hint="{ isVisible }">
461+
<p v-if="isVisible" class="text-accent text-xs -mt-6 text-center" aria-hidden="true">
462+
{{ $t('compare.packages.line_chart_nav_hint') }}
463+
</p>
464+
</template>
465+
450466
<!-- Injecting custom svg elements -->
451467
<template #svg="{ svg }">
452468
<!-- Inject legend during SVG print only -->
@@ -664,6 +680,18 @@ const chartConfig = computed<VueUiXyConfig>(() => {
664680
:deep(.vue-ui-xy) svg rect {
665681
transition: none !important;
666682
}
683+
684+
:deep(.vue-data-ui-component svg:focus-visible) {
685+
outline: 1px solid var(--accent-color) !important;
686+
border-radius: 0.1rem;
687+
outline-offset: 0 !important;
688+
}
689+
690+
:deep(.vue-ui-user-options-button:focus-visible),
691+
:deep(.vue-ui-user-options :first-child:focus-visible) {
692+
outline: 0.1rem solid var(--accent-color) !important;
693+
border-radius: 0.25rem;
694+
}
667695
</style>
668696

669697
<style>

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,15 @@ function layEgg() {
313313
314314
const config = computed<VueUiSparklineConfig>(() => {
315315
return {
316+
a11y: {
317+
translations: {
318+
keyboardNavigation: $t(
319+
'package.trends.chart_assistive_text.keyboard_navigation_horizontal',
320+
),
321+
tableAvailable: $t('package.trends.chart_assistive_text.table_available'),
322+
tableCaption: $t('package.trends.chart_assistive_text.table_caption'),
323+
},
324+
},
316325
theme: 'dark',
317326
/**
318327
* The built-in skeleton loader kicks in when the component is mounted but the data is not yet ready.
@@ -416,6 +425,13 @@ const config = computed<VueUiSparklineConfig>(() => {
416425
<template v-if="isLoadingWeeklyDownloads || hasWeeklyDownloads">
417426
<ClientOnly>
418427
<VueUiSparkline class="w-full max-w-xs" :dataset :config>
428+
<!-- Keyboard navigation hint -->
429+
<template #hint="{ isVisible }">
430+
<p v-if="isVisible" class="text-accent text-xs text-center mt-2" aria-hidden="true">
431+
{{ $t('package.downloads.sparkline_nav_hint') }}
432+
</p>
433+
</template>
434+
419435
<template #skeleton>
420436
<!-- This empty div overrides the default built-in scanning animation on load -->
421437
<div />
@@ -493,6 +509,12 @@ const config = computed<VueUiSparklineConfig>(() => {
493509
.opacity-leave-from {
494510
opacity: 1;
495511
}
512+
513+
:deep(.vue-data-ui-component svg:focus-visible) {
514+
outline: 0.1rem solid var(--accent-color) !important;
515+
border-radius: 0.1rem;
516+
outline-offset: 3px;
517+
}
496518
</style>
497519

498520
<style>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ const showSkeleton = shallowRef(false)
11071107
'install sidebar'
11081108
'vulns sidebar'
11091109
'readme sidebar';
1110-
grid-template-rows: auto auto auto auto 1fr;
1110+
grid-template-rows: auto auto auto 1fr;
11111111
}
11121112
}
11131113
@@ -1120,6 +1120,7 @@ const showSkeleton = shallowRef(false)
11201120
'install sidebar'
11211121
'vulns sidebar'
11221122
'readme sidebar';
1123+
grid-template-rows: auto auto auto 1fr;
11231124
}
11241125
}
11251126

cli/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as p from '@clack/prompts'
66
import { defineCommand, runMain } from 'citty'
77
import { serve } from 'srvx'
88
import { createConnectorApp, generateToken, CONNECTOR_VERSION } from './server.ts'
9-
import { getNpmUser } from './npm-client.ts'
9+
import { getNpmUser, NPM_REGISTRY_URL } from './npm-client.ts'
1010
import { initLogger, showToken, logInfo, logWarning, logError } from './logger.ts'
1111

1212
const DEFAULT_PORT = 31415
@@ -15,7 +15,7 @@ const DEV_FRONTEND_URL = 'http://127.0.0.1:3000/'
1515

1616
async function runNpmLogin(): Promise<boolean> {
1717
return new Promise(resolve => {
18-
const child = spawn('npm', ['login'], {
18+
const child = spawn('npm', ['login', `--registry=${NPM_REGISTRY_URL}`], {
1919
stdio: 'inherit',
2020
shell: true,
2121
})

cli/src/npm-client.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ import { PackageNameSchema, UsernameSchema, OrgNameSchema, ScopeTeamSchema } fro
1010
import { logCommand, logSuccess, logError, logDebug } from './logger.ts'
1111

1212
const execFileAsync = promisify(execFile)
13+
export const NPM_REGISTRY_URL = 'https://registry.npmjs.org/'
14+
15+
function createNpmEnv(overrides: Record<string, string> = {}): Record<string, string> {
16+
return {
17+
...process.env,
18+
...overrides,
19+
FORCE_COLOR: '0',
20+
npm_config_registry: NPM_REGISTRY_URL,
21+
}
22+
}
1323

1424
/**
1525
* Validates an npm package name using the official npm validation package
@@ -191,10 +201,7 @@ async function execNpmInteractive(
191201
let authUrlTimeout: ReturnType<typeof setTimeout> | null = null
192202
let authUrlTimedOut = false
193203

194-
const env: Record<string, string> = {
195-
...(process.env as Record<string, string>),
196-
FORCE_COLOR: '0',
197-
}
204+
const env = createNpmEnv()
198205

199206
// When openUrls is false, tell npm not to open the browser.
200207
// npm still prints the auth URL and polls doneUrl
@@ -330,7 +337,7 @@ async function execNpm(args: string[], options: ExecNpmOptions = {}): Promise<Np
330337
// On Unix, we keep it false for better security and performance
331338
const { stdout, stderr } = await execFileAsync('npm', npmArgs, {
332339
timeout: 60000,
333-
env: { ...process.env, FORCE_COLOR: '0' },
340+
env: createNpmEnv(),
334341
shell: process.platform === 'win32',
335342
})
336343

@@ -606,7 +613,7 @@ export async function packageInit(
606613
const { stdout, stderr } = await execFileAsync('npm', npmArgs, {
607614
timeout: 60000,
608615
cwd: tempDir,
609-
env: { ...process.env, FORCE_COLOR: '0' },
616+
env: createNpmEnv(),
610617
shell: process.platform === 'win32',
611618
})
612619

i18n/locales/en.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,12 @@
483483
"maintainer_template": "{avatar} {char126}{name}"
484484
},
485485
"trends": {
486+
"chart_assistive_text": {
487+
"keyboard_navigation_horizontal": "Use the left and right arrow keys to cycle through data points.",
488+
"keyboard_navigation_vertical": "Use the up and down arrow keys to cycle through data points.",
489+
"table_available": "A data table for this chart is available below.",
490+
"table_caption": "Chart data table"
491+
},
486492
"granularity": "Granularity",
487493
"granularity_daily": "Daily",
488494
"granularity_weekly": "Weekly",
@@ -541,7 +547,8 @@
541547
"downloads": {
542548
"title": "Weekly Downloads",
543549
"community_distribution": "View community adoption distribution",
544-
"subtitle": "Across all versions"
550+
"subtitle": "Across all versions",
551+
"sparkline_nav_hint": "Use ← →"
545552
},
546553
"install_scripts": {
547554
"title": "Install Scripts",
@@ -1106,7 +1113,9 @@
11061113
"empty_title": "Select packages to compare",
11071114
"empty_description": "Search and add at least 2 packages above to see a side-by-side comparison of their metrics.",
11081115
"table_view": "Table",
1109-
"charts_view": "Charts"
1116+
"charts_view": "Charts",
1117+
"bar_chart_nav_hint": "Use ↑ ↓",
1118+
"line_chart_nav_hint": "Use ← →"
11101119
},
11111120
"selector": {
11121121
"search_label": "Search for packages",

0 commit comments

Comments
 (0)