publishcore
v0.0.1
Published
Draft validation and publishing state transitions for generic content.
Maintainers
Readme
Publish Core
Draft validation and publishing state transitions for generic content.
Generic, immutable draft lifecycle primitives. A draft can be edited, validated, marked ready, moved into publishing, and completed or failed. The package owns state and validation boundaries only; it does not upload files, call a network, or deploy anything.
import { createDraft, validateDraft, publishDraft } from "publishcore";
let draft = createDraft({ title: "A release" });
draft = validateDraft(draft, [
(value) => value.title ? [] : [{ message: "Title is required", path: "title" }],
]);
draft = publishDraft(draft);
draft.status; // "published"Use beginPublishing, completePublishing, and failPublishing separately
when an external publisher needs to report its result.
Development
npm run build