Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changeset/add-socket-badge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@ehildt/depbadge": minor
---

Add Socket badge support for npm packages

- Added Socket badge type with package and version fields
- Uses Socket's native badge service at badge.socket.dev
- Links to npm package page by default
- Supports scoped packages like @babel/core
- Removed unused metric field from Socket badge type
- Created dedicated status-badges documentation for all badge types:
- github-badges.md
- codecov-badges.md
- docker-badges.md
- tile-badges.md
- socket-badges.md
2 changes: 1 addition & 1 deletion .github/workflows/non-release.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
- name: Test
run: |
pnpm test
pnpm test:cov
pnpm test:cov
18 changes: 9 additions & 9 deletions .github/workflows/release.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,32 +144,32 @@ jobs:
if: github.event_name == 'push'
needs: [repo-update, wiki]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # ensure we can see the latest commits
fetch-depth: 0 # ensure we can see the latest commits

- uses: pnpm/action-setup@v4
with:
version: 10

- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org

- run: pnpm install --frozen-lockfile

- name: Version bump & publish
run: |
# Apply changeset version bump locally
pnpm changeset version

# Reinstall to update lockfile after version bump
pnpm install --frozen-lockfile

# Publish to npm directly using the bumped version
pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46 changes: 24 additions & 22 deletions .wiki/depbadgerc-full-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target: README.md
manifest: package.json
# Dependency source file; usually package.json for Node.js projects

output: ['json', 'markdown']
output: ["json", "markdown"]
# 'json' → machine-readable preview for debugging
# 'markdown' → badge-ready preview for verification

Expand All @@ -28,11 +28,11 @@ output: ['json', 'markdown']
# =========================

dependenciesLayout: &DEP_LAYOUT
position: center # Alignment of badges: left, center, right
showHeader: true # Render a section header
position: center # Alignment of badges: left, center, right
showHeader: true # Render a section header

devDependenciesLayout: &DEV_LAYOUT
<<: *DEP_LAYOUT # Inherit defaults from DEP_LAYOUT
<<: *DEP_LAYOUT # Inherit defaults from DEP_LAYOUT
position: left
showHeader: false
header: Development
Expand All @@ -50,12 +50,12 @@ statusBadgesLayout: &STATUS_LAYOUT
# ==============================

baseStyle: &BASE_STYLE
labelColor: '#333' # Left segment color
isError: false # Force error style
logoSvg: '' # Optional custom SVG logo
logoWidth: 40 # Width of logo in pixels
labelColor: "#333" # Left segment color
isError: false # Force error style
logoSvg: "" # Optional custom SVG logo
logoWidth: 40 # Width of logo in pixels
style: for-the-badge # Shields style: flat, flat-square, for-the-badge
cacheSeconds: 3600 # CDN cache duration
cacheSeconds: 3600 # CDN cache duration

# ====================
# Dependencies Section
Expand All @@ -71,11 +71,11 @@ dependencies:
- name: chalk
# Uses section-level badgeStyle (npm logo, for-the-badge)
- name: colord
labelColor: '#ff4500' # Override label color per item
labelColor: "#ff4500" # Override label color per item
- name: js-yaml
style: flat-square # Override style per item
style: flat-square # Override style per item
- name: "@iarna/toml"
namedLogo: toml # Use a different logo per item
namedLogo: toml # Use a different logo per item

# =======================
# DevDependencies Section
Expand All @@ -90,11 +90,11 @@ devDependencies:
style: flat-square
items:
- name: jest
namedLogo: jest # Override logo for this package
namedLogo: jest # Override logo for this package
- name: typescript
link: https://www.typescriptlang.org/ # Override link
link: https://www.typescriptlang.org/ # Override link
- name: eslint
style: for-the-badge # Override style
style: for-the-badge # Override style

# =========================
# Peer Dependencies Section
Expand All @@ -108,7 +108,7 @@ peerDependencies:
style: flat
items:
- name: react
namedLogo: react # Per-item logo
namedLogo: react # Per-item logo

# ===================================
# Status Badges Section (Independent)
Expand All @@ -123,25 +123,27 @@ statusBadges:
namedLogo: github
items:
- name: github
metric: release # Badge shows latest release
metric: release # Badge shows latest release
user: ehildt
repo: depbadge
branch: main
# Uses section-level badgeStyle
- name: github
metric: stars # Badge shows stars count
metric: stars # Badge shows stars count
user: ehildt
repo: depbadge
branch: main
labelColor: '#ffcc00' # Override label color
labelColor: "#ffcc00" # Override label color
- name: codecov
user: ehildt
repo: depbadge
branch: main
flag: c
style: flat-square # Override style for this badge
style: flat-square # Override style for this badge
- name: tile
label: 'I Love'
label: "I Love"
message: COOKIES
- name: socket
package: express
version: "4.18.2"
```

15 changes: 8 additions & 7 deletions .wiki/depbadgerc-layouts.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ dependenciesLayout: &DEPENDENCIES_LAYOUT
# header: 'My Dependencies'
```


| Property | Type | Description |
| :--- | :--- | :--- |
| **position** | string | Alignment in the document (left, center, right) |
| **showHeader** | boolean | Whether a Markdown header is rendered above the section |
| **header** | string | Optional custom header title (falls back to section name) |
| Property | Type | Description |
| :------------- | :------ | :-------------------------------------------------------- |
| **position** | string | Alignment in the document (left, center, right) |
| **showHeader** | boolean | Whether a Markdown header is rendered above the section |
| **header** | string | Optional custom header title (falls back to section name) |

### Reusing Layouts via YAML Anchors

Expand All @@ -29,7 +28,9 @@ devDependenciesLayout: &DEV_DEPENDENCIES_LAYOUT
showHeader: true
header: Development Dependencies
```

YAML merge (<<) allows:

- DRY configuration
- Targeted overrides
- Consistent styling across sections
Expand All @@ -42,4 +43,4 @@ dependencies:
<<: *DEPENDENCIES_LAYOUT
```

If no layout is provided, Depbadge will fall back to its internal defaults.
If no layout is provided, Depbadge will fall back to its internal defaults.
8 changes: 3 additions & 5 deletions .wiki/depbadgerc-root.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
integrity: 838e9da83c5b73c2de43b87b950428403a090d7dc926145640c1576d7c313820
target: README.md
manifest: package.json
output: ['json', 'markdown']
output: ["json", "markdown"]
```

`# yaml-language-server`
Expand Down Expand Up @@ -36,8 +36,6 @@ Depbadge reads dependency sections from this file:

Defines which output artifacts Depbadge generates (primarily for previewing and debugging).

* `json` → Generates machine-readable files for each badge under `.depbadge/<section>/<name>.json` (e.g. `.depbadge/dependencies/react.json`). Useful for inspecting resolved configuration and computed badge data.

* `markdown` → Generates rendered badge previews as Markdown under `.depbadge/`. This allows you to verify layout and styling before writing to the target file.

- `json` → Generates machine-readable files for each badge under `.depbadge/<section>/<name>.json` (e.g. `.depbadge/dependencies/react.json`). Useful for inspecting resolved configuration and computed badge data.

- `markdown` → Generates rendered badge previews as Markdown under `.depbadge/`. This allows you to verify layout and styling before writing to the target file.
21 changes: 9 additions & 12 deletions .wiki/depbadgerc-sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Dependency sections are tied to the manifest file (e.g., package.json).

Supported sections:

- dependencies
- devDependencies
- peerDependencies
Expand All @@ -19,24 +20,21 @@ dependencies:
```

Behavior

- Only explicitly listed items are rendered.
- Other manifest dependencies are ignored.
- Items must exist in the manifest section.
- Each item may override any style property.

# Status Badges (Separate from Dependencies)
# Status Badges

Status badges are not connected to manifest files.
Status badges are documented in dedicated files:

They represent external metrics such as:
- GitHub releases
- GitHub stars
- License
- Code coverage
- Docker pulls (if enabled)
- Future providers

### Status Badge Section
- [GitHub Badges](./status-badges/github-badges.md)
- [Codecov Badges](./status-badges/codecov-badges.md)
- [Docker Badges](./status-badges/docker-badges.md)
- [Tile Badges](./status-badges/tile-badges.md)
- [Socket Badges](./status-badges/socket-badges.md)

```yaml
statusBadges:
Expand All @@ -49,4 +47,3 @@ statusBadges:
user: ehildt
repo: depbadge
```

9 changes: 4 additions & 5 deletions .wiki/depbadgerc-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ It controls visual appearance, logo handling, linking, and caching. Like layouts

```yaml
dependenciesStyle: &DEPENDENCIES_STYLE
labelColor: '#333'
labelColor: "#333"
isError: false
namedLogo: npm
logoSvg: ''
logoSvg: ""
logoWidth: 40
style: for-the-badge
cacheSeconds: 3600
Expand All @@ -28,7 +28,6 @@ dependenciesStyle: &DEPENDENCIES_STYLE
| `cacheSeconds` | number | CDN cache duration |
| `link` | string | Target URL when clicking badge |


### Applying a Style to a Section

```yaml
Expand All @@ -47,9 +46,9 @@ Every item may override any badgeStyle property:
dependencies:
items:
- name: vue
labelColor: '#42b883'
labelColor: "#42b883"
namedLogo: vue
link: https://vuejs.org/
```

Per-item configuration always takes precedence over section-level style.
Per-item configuration always takes precedence over section-level style.
29 changes: 15 additions & 14 deletions .wiki/extend-manifest-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ Adding a manifest to depbadge is straightforward. First, create a folder for you

### Read and Parse the Manifest

Define a manifest interface. Full type safety isn’t required; it just needs enough typing to enable linting for versions and dependencies. Save the interface in a file such as `manifest.type.ts`. Then create `manifest.read.ts`. This module is responsible for loading and parsing the manifest, returning the result typed according to the defined interface.
Define a manifest interface. Full type safety isn’t required; it just needs enough typing to enable linting for versions and dependencies. Save the interface in a file such as `manifest.type.ts`. Then create `manifest.read.ts`. This module is responsible for loading and parsing the manifest, returning the result typed according to the defined interface.

A working example is available in the following files:
- `src/manifest/package-json/manifest.type.ts`

- `src/manifest/package-json/manifest.type.ts`
- `src/manifest/package-json/manifest.read.ts`

### Manifest Context Store
### Manifest Context Store

Each manifest file has its own context store. Use the useCtxStore hook to create this context store. The context store must implement the manifest contract—an interface that defines two required functions:

Expand All @@ -22,16 +23,16 @@ getDependencies(): Record<ManifestContractSection, Record<string, string>>;
- `getVersion` - returns the version of the app

```ts
getVersion() // v1.0.9
getVersion(); // v1.0.9
```

- `getDependencies` - returns an object of sections and its key/value-pairs

```ts
getDependencies();

/**
* {
/**
* {
* dependencies: { react: "^19.2.0", vite: "v7.3.1"},
* devDependencies: {}, // empty object if unused
* peerDependencies: {}, // empty object if unused
Expand All @@ -41,20 +42,20 @@ getDependencies();

It doesn’t matter how your manifest files are structured; the only requirement is that they implement the manifest contract. A working example can be found in:

- `src/manifest/package-json/get-version.ts`.
- `src/manifest/package-json/get-dependencies.ts`
- `src/manifest/package-json/manifest.store.ts`
- `src/manifest/package-json/get-version.ts`.
- `src/manifest/package-json/get-dependencies.ts`
- `src/manifest/package-json/manifest.store.ts`

### Manifest Map

Each manifest context store must be registered in the manifest map located in `src/index.ts`. The map is a plain object where the key represents the manifest file name and the value references the corresponding manifest context store responsible for handling that manifest.

```ts
const manifestMap = {
"package.json": PackageJsonCtx,
"pyproject.toml": PyProjectCtx,
"Cargo.toml": CargoTomlCtx,
} as const;
const manifestMap = {
"package.json": PackageJsonCtx,
"pyproject.toml": PyProjectCtx,
"Cargo.toml": CargoTomlCtx,
} as const;
```

### DepbadgeRC Schema
Expand Down
Loading
Loading