@spillway-cms/sdk
v0.1.26
Published
Author Spillway CMS modules: defineModule, hook and block types, a scaffold command and a tiny Wasm assembler for sandboxed extensions
Readme
@spillway-cms/sdk
Types and helpers for writing Spillway CMS modules. MIT licensed.
import { defineModule } from '@spillway-cms/sdk';
export default defineModule({
setup(api) {
api.registerBlock({ name: 'Banner', fields: { text: { type: 'text' } }, html: ({ text }) => `<div>${text}</div>` });
api.on('entity.afterPublish', ({ entity }) => api.log.info(`published ${entity.title}`));
},
});defineModuleis an identity function with types; the host injectsapi, so nothing from this package is needed at runtime.@spillway-cms/sdk/wasmholds the sandboxed ABI constants and a tiny assembler for building.wasmextensions without a toolchain.npx spillway-module create <name> --tier trusted|sandboxedscaffolds a module.npx spillway-module create <name> --tier trusted --from-storybook <address|storybook-static folder>reads a Storybook'sindex.jsonand each component's args from its story files (without running them), and scaffolds one page builder block per component with its fields, defaults and an example per story, each drawing a placeholder inblocks.jsuntil you write its render.--stories-root <folder>says where the story files' import paths start. A starting point, not a live sync.npx spillway-module check [folder]checksmanifest.jsonthe way the server does at install (blocks, examples, settings) and lists every problem.checkManifest,checkBlockandmoduleExampleProblemsrun the same checks in code. A block'sexamples([{ key, label, props }], up to 8) show on Structure → Components; a trusted module gives the blocks it registers in code theirs in the manifest'sexamples, by block name.
Full documentation: docs/modules.md in the Spillway repository.
