@shiftpane/widget-sdk
v0.5.0
Published
The widget contract: manifest schema, defineCollector and the collector context
Downloads
280
Readme
@shiftpane/widget-sdk
The format of a ShiftPane widget: the manifest.json,
view.json and sample.json schemas (zod, plus a JSON Schema for editors), the system sources a
widget can read, permissions in plain words, and defineCollector for typing a collector.
import { defineCollector } from '@shiftpane/widget-sdk'
export default defineCollector(async ({ config, secrets, sources, fetch }) => {
const answer = await fetch(`https://api.github.com/repos/${config.repo}`)
return { stars: (await answer.json()).stargazers_count }
})Start a widget with npm create shiftpane-widget, and check, run and pack it with
shiftpane-widget. Docs:
https://shiftpane.vercel.app/docs/making-widgets
