Documentation menuGetting started
Getting started
Build a feed and add the widget in five minutes.
-
Install the package:
pnpm add @sweberdev/derivativeWith npm:
npm i @sweberdev/derivative. -
Set it up in one step:
npx derivative initinitlooks at the project, writesderivative.config.json(source and output files) and putsderivative buildin front of yourbuildscript, so the feed is rebuilt with every deploy. It never overwrites an existing config; pass--no-scriptsto leavepackage.jsonalone. To do the same by hand, read on.Build the feed. With a
CHANGELOG.mdin the project root (for example from Changesets):npx derivative buildWithout a changelog file, Derivative reads your git history instead. It needs version tags (
v1.2.0) and conventional commits (feat:,fix:):npx derivative build --source gitBoth write
public/changelog.json. Add the build to yourbuildscript so the feed is always current:{ "scripts": { "build": "derivative build && vite build" } } -
Add the widget where the button should appear, for example in your header:
<derivative-widget src="/changelog.json" lang="de"></derivative-widget> <script type="module"> import "@sweberdev/derivative/widget"; </script>In React, use the React component instead.
-
Open the app. The button shows how many releases are new, and opening it marks them as seen.
Requirements
- Node.js 22 or newer for the CLI
- git on the
PATHfor--source gitand for release dates of Changesets changelogs - Any current browser for the widget (custom elements and shadow DOM)