Skip to content

Commit dda8d69

Browse files
authored
Merge branch 'main' into fix-compare-deps
2 parents 4ec6eed + 146963a commit dda8d69

File tree

4 files changed

+58
-78
lines changed

4 files changed

+58
-78
lines changed

docs/content/2.guide/1.features.md

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -93,38 +93,42 @@ Quick access to online development environments detected from package READMEs:
9393
### Custom badges
9494

9595
You can add custom npmx badges to your markdown files using the following syntax:
96-
`[![Open on npmx.dev](https://npmx.dev/api/registry/badge/TYPE/YOUR_PACKAGE)](https://npmx.dev/package/YOUR_PACKAGE)`
9796

98-
> [!IMPORTANT]
99-
> Make sure to replace `TYPE` with one of the options listed below and `YOUR_PACKAGE` with the actual package name (e.g., `vue`, `lodash`, or `@nuxt/kit`).
97+
```md
98+
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/TYPE/YOUR_PACKAGE)](https://npmx.dev/package/YOUR_PACKAGE)
99+
```
100+
101+
::tip
102+
Make sure to replace `TYPE` with one of the options listed below and `YOUR_PACKAGE` with the actual package name (e.g., `vue`, `lodash`, or `@nuxt/kit`).
103+
::
100104

101105
#### Available Badge Types
102106

103-
- **version**: Shows the latest or specific version of the package. ![](https://img.shields.io/badge/%233b82f6-3b82f6)
104-
- **license**: Displays the package license (e.g., MIT, Apache-2.0). ![](https://img.shields.io/badge/%2322c55e-22c55e)
105-
- **size**: Shows the install size (via Bundlephobia) or unpacked size. ![](https://img.shields.io/badge/%23a855f7-a855f7)
106-
- **downloads**: Displays monthly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
107-
- **downloads-day**: Displays daily download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
108-
- **downloads-week**: Displays weekly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
109-
- **downloads-month**: Alias for monthly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
110-
- **downloads-year**: Displays yearly download statistics. ![](https://img.shields.io/badge/%23f97316-f97316)
111-
- **vulnerabilities**: Shows the number of vulnerabilities found via OSV. ![](https://img.shields.io/badge/%2322c55e-22c55e) / ![](https://img.shields.io/badge/%23ef4444-ef4444)
112-
- **dependencies**: Lists the total count of package dependencies. ![](https://img.shields.io/badge/%2306b6d4-06b6d4)
113-
- **created**: Displays the date the package was first published. ![](https://img.shields.io/badge/%2364748b-64748b)
114-
- **updated**: Displays the date of the most recent modification. ![](https://img.shields.io/badge/%2364748b-64748b)
115-
- **engines**: Shows the supported Node.js version range. ![](https://img.shields.io/badge/%23eab308-eab308)
116-
- **types**: Indicates if TypeScript types are included. ![](https://img.shields.io/badge/%233b82f6-3b82f6) / ![](https://img.shields.io/badge/%2364748b-64748b)
117-
- **maintainers**: Displays the total count of package maintainers. ![](https://img.shields.io/badge/%2306b6d4-06b6d4)
118-
- **deprecated**: Shows if the package is active or deprecated. ![](https://img.shields.io/badge/%2322c55e-22c55e) / ![](https://img.shields.io/badge/%23ef4444-ef4444)
119-
- **quality**: NPMS.io quality score based on linting and tests. ![](https://img.shields.io/badge/%23a855f7-a855f7)
120-
- **popularity**: NPMS.io popularity score based on downloads and stars. ![](https://img.shields.io/badge/%2306b6d4-06b6d4)
121-
- **maintenance**: NPMS.io maintenance score based on activity. ![](https://img.shields.io/badge/%23eab308-eab308)
122-
- **score**: The overall NPMS.io combined score. ![](https://img.shields.io/badge/%233b82f6-3b82f6)
123-
- **name**: Simple badge displaying the package name. ![](https://img.shields.io/badge/%2364748b-64748b)
107+
- **version**: Shows the latest or specific version of the package. :img{src="https://img.shields.io/badge/%233b82f6-3b82f6" class="inline align-middle h-5 w-14"}
108+
- **license**: Displays the package license (e.g., MIT, Apache-2.0). :img{src="https://img.shields.io/badge/%2322c55e-22c55e" class="inline align-middle h-5 w-14"}
109+
- **size**: Shows the install size (via Bundlephobia) or unpacked size. :img{src="https://img.shields.io/badge/%23a855f7-a855f7" class="inline align-middle h-5 w-14"}
110+
- **downloads**: Displays monthly download statistics. :img{src="https://img.shields.io/badge/%23f97316-f97316" class="inline align-middle h-5 w-14"}
111+
- **downloads-day**: Displays daily download statistics. :img{src="https://img.shields.io/badge/%23f97316-f97316" class="inline align-middle h-5 w-14"}
112+
- **downloads-week**: Displays weekly download statistics. :img{src="https://img.shields.io/badge/%23f97316-f97316" class="inline align-middle h-5 w-14"}
113+
- **downloads-month**: Alias for monthly download statistics. :img{src="https://img.shields.io/badge/%23f97316-f97316" class="inline align-middle h-5 w-14"}
114+
- **downloads-year**: Displays yearly download statistics. :img{src="https://img.shields.io/badge/%23f97316-f97316" class="inline align-middle h-5 w-14"}
115+
- **vulnerabilities**: Shows the number of vulnerabilities found via OSV. :img{src="https://img.shields.io/badge/%2322c55e-22c55e" class="inline align-middle h-5 w-14"} / :img{src="https://img.shields.io/badge/%23ef4444-ef4444" class="inline align-middle h-5 w-14"}
116+
- **dependencies**: Lists the total count of package dependencies. :img{src="https://img.shields.io/badge/%2306b6d4-06b6d4" class="inline align-middle h-5 w-14"}
117+
- **created**: Displays the date the package was first published. :img{src="https://img.shields.io/badge/%2364748b-64748b" class="inline align-middle h-5 w-14"}
118+
- **updated**: Displays the date of the most recent modification. :img{src="https://img.shields.io/badge/%2364748b-64748b" class="inline align-middle h-5 w-14"}
119+
- **engines**: Shows the supported Node.js version range. :img{src="https://img.shields.io/badge/%23eab308-eab308" class="inline align-middle h-5 w-14"}
120+
- **types**: Indicates if TypeScript types are included. :img{src="https://img.shields.io/badge/%233b82f6-3b82f6" class="inline align-middle h-5 w-14"} / :img{src="https://img.shields.io/badge/%2364748b-64748b" class="inline align-middle h-5 w-14"}
121+
- **maintainers**: Displays the total count of package maintainers. :img{src="https://img.shields.io/badge/%2306b6d4-06b6d4" class="inline align-middle h-5 w-14"}
122+
- **deprecated**: Shows if the package is active or deprecated. :img{src="https://img.shields.io/badge/%2322c55e-22c55e" class="inline align-middle h-5 w-14"} / :img{src="https://img.shields.io/badge/%23ef4444-ef4444" class="inline align-middle h-5 w-14"}
123+
- **quality**: NPMS.io quality score based on linting and tests. :img{src="https://img.shields.io/badge/%23a855f7-a855f7" class="inline align-middle h-5 w-14"}
124+
- **popularity**: NPMS.io popularity score based on downloads and stars. :img{src="https://img.shields.io/badge/%2306b6d4-06b6d4" class="inline align-middle h-5 w-14"}
125+
- **maintenance**: NPMS.io maintenance score based on activity. :img{src="https://img.shields.io/badge/%23eab308-eab308" class="inline align-middle h-5 w-14"}
126+
- **score**: The overall NPMS.io combined score. :img{src="https://img.shields.io/badge/%233b82f6-3b82f6" class="inline align-middle h-5 w-14"}
127+
- **name**: Simple badge displaying the package name. :img{src="https://img.shields.io/badge/%2364748b-64748b" class="inline align-middle h-5 w-14"}
124128

125129
#### Examples
126130

127-
```markdown
131+
```md
128132
# Version Badge
129133

130134
[![Open on npmx.dev](https://npmx.dev/api/registry/badge/version/nuxt)](https://npmx.dev/package/nuxt)

test/unit/app/utils/npm.spec.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
import { buildScopeTeam } from '../../../../../app/utils/npm/common'
4+
import { validateScopeTeam } from '../../../../../cli/src/npm-client'
5+
6+
describe('buildScopeTeam', () => {
7+
it('constructs scope:team with @ prefix', () => {
8+
expect(buildScopeTeam('netlify', 'developers')).toBe('@netlify:developers')
9+
expect(buildScopeTeam('nuxt', 'core')).toBe('@nuxt:core')
10+
})
11+
12+
it('strips existing @ prefix from orgName', () => {
13+
expect(buildScopeTeam('@netlify', 'developers')).toBe('@netlify:developers')
14+
expect(buildScopeTeam('@nuxt', 'core')).toBe('@nuxt:core')
15+
})
16+
17+
it('produces format accepted by validateScopeTeam', () => {
18+
expect(() => validateScopeTeam(buildScopeTeam('netlify', 'developers'))).not.toThrow()
19+
expect(() => validateScopeTeam(buildScopeTeam('nuxt', 'core'))).not.toThrow()
20+
expect(() => validateScopeTeam(buildScopeTeam('my-org', 'my-team'))).not.toThrow()
21+
})
22+
})

test/unit/shared/utils/spdx.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,25 @@ describe('spdx utilities', () => {
2525
})
2626

2727
describe('getSpdxLicenseUrl', () => {
28-
it('returns URL for valid SPDX licenses', () => {
28+
it('returns URL for valid license identifiers', () => {
2929
expect(getSpdxLicenseUrl('MIT')).toBe('https://spdx.org/licenses/MIT.html')
30+
expect(getSpdxLicenseUrl('ISC')).toBe('https://spdx.org/licenses/ISC.html')
3031
expect(getSpdxLicenseUrl('Apache-2.0')).toBe('https://spdx.org/licenses/Apache-2.0.html')
32+
expect(getSpdxLicenseUrl('GPL-3.0-only')).toBe('https://spdx.org/licenses/GPL-3.0-only.html')
33+
expect(getSpdxLicenseUrl('BSD-2-Clause')).toBe('https://spdx.org/licenses/BSD-2-Clause.html')
34+
expect(getSpdxLicenseUrl('GPL-3.0+')).toBe('https://spdx.org/licenses/GPL-3.0+.html')
3135
})
3236

3337
it('returns null for invalid licenses', () => {
3438
expect(getSpdxLicenseUrl('CustomLicense')).toBeNull()
3539
expect(getSpdxLicenseUrl('INVALID')).toBeNull()
40+
expect(getSpdxLicenseUrl('MIT OR Apache-2.0')).toBeNull()
3641
})
3742

3843
it('returns null for undefined or empty', () => {
3944
expect(getSpdxLicenseUrl(undefined)).toBeNull()
4045
expect(getSpdxLicenseUrl('')).toBeNull()
46+
expect(getSpdxLicenseUrl(' ')).toBeNull()
4147
})
4248

4349
it('trims whitespace', () => {

0 commit comments

Comments
 (0)