diff --git a/app/components/Package/DownloadButton.vue b/app/components/Package/DownloadButton.vue new file mode 100644 index 0000000000..9ad1e47cd3 --- /dev/null +++ b/app/components/Package/DownloadButton.vue @@ -0,0 +1,68 @@ + + + diff --git a/app/components/Package/Skeleton.vue b/app/components/Package/Skeleton.vue index cf1ee8841b..0c2409fd64 100644 --- a/app/components/Package/Skeleton.vue +++ b/app/components/Package/Skeleton.vue @@ -132,8 +132,11 @@

{{ $t('package.get_started.title') }}

- - + +
+ + +
diff --git a/app/pages/package/[[org]]/[name].vue b/app/pages/package/[[org]]/[name].vue index a83a101243..309e16db74 100644 --- a/app/pages/package/[[org]]/[name].vue +++ b/app/pages/package/[[org]]/[name].vue @@ -771,8 +771,15 @@ const showSkeleton = shallowRef(false) {{ $t('package.get_started.title') }} - - + +
+ + +
{ }) }) + describe('PackageDownloadButton', () => { + it('should have no accessibility violations', async () => { + const component = await mountSuspended(PackageDownloadButton, { + props: { + packageName: 'vue', + version: { + version: '3.5.0', + dist: { tarball: 'https://registry.npmjs.org/vue/-/vue-3.5.0.tgz' }, + } as any, + dependencies: null, + }, + }) + const results = await runAxe(component) + expect(results.violations).toEqual([]) + }) + }) + // Diff components describe('DiffFileTree', () => { const mockFiles = [ diff --git a/test/unit/server/utils/dependency-analysis.spec.ts b/test/unit/server/utils/dependency-analysis.spec.ts index 7de70859f5..9fe2b17850 100644 --- a/test/unit/server/utils/dependency-analysis.spec.ts +++ b/test/unit/server/utils/dependency-analysis.spec.ts @@ -57,6 +57,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['test-pkg@1.0.0'], + tarballUrl: 'https://example.com/test-pkg-1.0.0.tgz', }, ], ]) @@ -90,6 +91,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['test-pkg@1.0.0'], + tarballUrl: 'https://example.com/test-pkg-1.0.0.tgz', }, ], [ @@ -101,6 +103,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'direct' as const, path: ['test-pkg@1.0.0', 'dep-a@2.0.0'], + tarballUrl: 'https://example.com/dep-a-2.0.0.tgz', }, ], ]) @@ -127,6 +130,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['vuln-pkg@1.0.0'], + tarballUrl: 'https://example.com/vuln-pkg-1.0.0.tgz', }, ], ]) @@ -181,6 +185,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['root@1.0.0'], + tarballUrl: 'https://example.com/root-1.0.0.tgz', }, ], [ @@ -192,6 +197,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'transitive' as const, path: ['root@1.0.0', 'middle@1.5.0', 'vuln-dep@2.0.0'], + tarballUrl: 'https://example.com/vuln-dep-2.0.0.tgz', }, ], ]) @@ -231,6 +237,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['root@1.0.0'], + tarballUrl: 'https://example.com/root-1.0.0.tgz', }, ], [ @@ -242,6 +249,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'direct' as const, path: ['root@1.0.0', 'direct-dep@1.0.0'], + tarballUrl: 'https://example.com/direct-dep-1.0.0.tgz', }, ], [ @@ -253,6 +261,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'transitive' as const, path: ['root@1.0.0', 'direct-dep@1.0.0', 'transitive-dep@1.0.0'], + tarballUrl: 'https://example.com/transitive-dep-1.0.0.tgz', }, ], ]) @@ -321,6 +330,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['pkg@1.0.0'], + tarballUrl: 'https://example.com/pkg-1.0.0.tgz', }, ], ]) @@ -362,6 +372,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['pkg@1.0.0'], + tarballUrl: 'https://example.com/pkg-1.0.0.tgz', }, ], ]) @@ -404,6 +415,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['pkg@1.0.0'], + tarballUrl: 'https://example.com/pkg-1.0.0.tgz', }, ], ]) @@ -445,6 +457,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['pkg@1.0.0'], + tarballUrl: 'https://example.com/pkg-1.0.0.tgz', }, ], ]) @@ -490,6 +503,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['root@1.0.0'], + tarballUrl: 'https://example.com/root-1.0.0.tgz', }, ], [ @@ -502,6 +516,7 @@ describe('dependency-analysis', () => { depth: 'direct' as const, path: ['root@1.0.0', 'deprecated-pkg@2.0.0'], deprecated: 'This package is deprecated. Use new-pkg instead.', + tarballUrl: 'https://example.com/deprecated-pkg-2.0.0.tgz', }, ], ]) @@ -531,6 +546,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['root@1.0.0'], + tarballUrl: 'https://example.com/root-1.0.0.tgz', }, ], ]) @@ -554,6 +570,7 @@ describe('dependency-analysis', () => { depth: 'root' as const, path: ['root@1.0.0'], deprecated: 'Root is deprecated', + tarballUrl: 'https://example.com/root-1.0.0.tgz', }, ], [ @@ -566,6 +583,7 @@ describe('dependency-analysis', () => { depth: 'transitive' as const, path: ['root@1.0.0', 'direct-dep@1.0.0', 'transitive-dep@1.0.0'], deprecated: 'Transitive is deprecated', + tarballUrl: 'https://example.com/transitive-dep-1.0.0.tgz', }, ], [ @@ -578,6 +596,7 @@ describe('dependency-analysis', () => { depth: 'direct' as const, path: ['root@1.0.0', 'direct-dep@1.0.0'], deprecated: 'Direct is deprecated', + tarballUrl: 'https://example.com/direct-dep-1.0.0.tgz', }, ], ]) @@ -606,6 +625,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['minimist@1.0.0'], + tarballUrl: 'https://example.com/minimist-1.0.0.tgz', }, ], ]) @@ -669,6 +689,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['next@16.0.0-beta.0'], + tarballUrl: 'https://example.com/next-16.0.0-beta.0.tgz', }, ], ]) @@ -732,6 +753,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['example@1.5.0'], + tarballUrl: 'https://example.com/example-1.5.0.tgz', }, ], ]) @@ -794,6 +816,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['example@3.4.6'], + tarballUrl: 'https://example.com/example-3.4.6.tgz', }, ], ]) @@ -862,6 +885,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['pkg@1.0.0'], + tarballUrl: 'https://example.com/pkg-1.0.0.tgz', }, ], ]) @@ -904,6 +928,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'root' as const, path: ['root@1.0.0'], + tarballUrl: 'https://example.com/root-1.0.0.tgz', }, ], [ @@ -915,6 +940,7 @@ describe('dependency-analysis', () => { optional: false, depth: 'direct' as const, path: ['root@1.0.0', 'vuln-pkg@1.0.0'], + tarballUrl: 'https://example.com/vuln-pkg-1.0.0.tgz', }, ], [ @@ -927,6 +953,7 @@ describe('dependency-analysis', () => { depth: 'direct' as const, path: ['root@1.0.0', 'deprecated-pkg@1.0.0'], deprecated: 'Use something else', + tarballUrl: 'https://example.com/deprecated-pkg-1.0.0.tgz', }, ], ]) diff --git a/test/unit/server/utils/dependency-resolver.spec.ts b/test/unit/server/utils/dependency-resolver.spec.ts index 9297baf1f4..f1beaaaf2d 100644 --- a/test/unit/server/utils/dependency-resolver.spec.ts +++ b/test/unit/server/utils/dependency-resolver.spec.ts @@ -199,7 +199,13 @@ describe('dependency-resolver', () => { expect(result.size).toBe(1) const pkg = result.get('root@1.0.0') - expect(pkg).toEqual({ name: 'root', version: '1.0.0', size: 5000, optional: false }) + expect(pkg).toEqual({ + name: 'root', + version: '1.0.0', + size: 5000, + tarballUrl: '', + optional: false, + }) }) it('resolves direct dependencies', async () => {