Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Commit 9b87c83

Browse files
authored
Update README.md
1 parent bf1955a commit 9b87c83

File tree

1 file changed

+1
-124
lines changed

1 file changed

+1
-124
lines changed

README.md

Lines changed: 1 addition & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1 @@
1-
# Sanity Workflow Demo Plugin Example
2-
3-
With Sanity Studio you can [customize your content tools to support arbitrary workflows like assignment and content pipelines](https://www.sanity.io/docs/custom-workflows).
4-
5-
This plugin is distributed as an **example implementation** of customization APIs in the Sanity Studio V3 and is not considered to be a feature-complete implementation of what workflow management requires in production. It is meant as a starting point intended to be forked and customized to the needs of your organization and content creators, or simply as an illustration of what is possible in Sanity Studio V3.
6-
7-
An intentional design choice of this plugin is that it **does not influence or modify whether a document is in draft or published**. It only tracks the values of a separate "metadata" document. In this implementation, an "Approved" document could be a draft but will still need publishing. "Approving" the document deletes the "metadata" and so removes it from the "Workflow" process. You choose if Publishing the document happens in the Studio like normal, using the [Scheduled Publishing plugin](https://www.sanity.io/plugins/scheduled-publishing) or the [Scheduling API](https://www.sanity.io/docs/scheduling-api#fa3bb95f83ed).
8-
9-
This plugin is considered finished in its current form. Your feedback for workflow features you would like to see in Sanity Studio would be appreciated and can be [shared in our Slack community](https://slack.sanity.io/).
10-
11-
![Screenshot 2023-03-21 at 12 11 24](https://user-images.githubusercontent.com/9684022/226602179-5bd3d91a-9c27-431e-be18-3c70f06c6ccb.png)
12-
13-
## Features
14-
15-
This work demonstrates how a single plugin can define:
16-
17-
- A unique schema to handle workflow metadata
18-
- Document Actions to promote and demote documents through the workflow
19-
- Document Badges for visual feedback about the current state of a document
20-
- A custom Tool for drag-and-drop updating of a document's state
21-
22-
## Installation
23-
24-
```
25-
npm install --save sanity-plugin-workflow
26-
```
27-
28-
or
29-
30-
```
31-
yarn add sanity-plugin-workflow
32-
```
33-
34-
## Usage
35-
36-
Add it as a plugin in sanity.config.ts (or .js):
37-
38-
```js
39-
import {createConfig} from 'sanity'
40-
import {workflow} from 'sanity-plugin-workflow'
41-
42-
export const createConfig({
43-
// all other settings ...
44-
plugins: [
45-
workflow({
46-
// Required, list of document type names
47-
// schemaTypes: ['article', 'product'],
48-
schemaTypes: [],
49-
// Optional, see below
50-
// states: [],
51-
})
52-
]
53-
})
54-
```
55-
56-
## Configuring "States"
57-
58-
The plugin comes with a default set of "States". These are tracked by the plugin creating a separate "metadata" document for each document that has begun the Workflow.
59-
60-
Documents can be promoted and demoted in the Workflow with the provided Document Actions as well as a drag-and-drop custom Tool. The settings below are not enforced by the API, custom access control rules could be used to do so.
61-
62-
```ts
63-
{
64-
// Required configuration
65-
id: 'inReview',
66-
title: 'In Review',
67-
// Optional settings:
68-
// Used for the color of the Document Badge
69-
color: 'success',
70-
// Will limit document actions and drag-and-drop for only users with these Role
71-
roles: ['publisher', 'administrator'],
72-
// Requires the user to be "assigned" in order to update to this State
73-
requireAssignment: true,
74-
// Requires the document to be valid before being promoted out of this State
75-
// Warning: With many documents in the Kanban view this can negatively impact performance
76-
requireValidation: true,
77-
// Defines which States a document can be moved to from this one
78-
transitions: ['changesRequested', 'approved']
79-
}
80-
```
81-
82-
### Intended content operations with this plugin
83-
84-
A content creator composes a new document of one of the configured Schema types. The document is a "Draft", but not automatically added to the Workflow.
85-
86-
The creator clicks the "Begin Workflow" Document Action to create a new "metadata" document and add the document to the first State in the Workflow. Using the default States, the document is now "In Review".
87-
88-
The document is now visible in the Workflow Tool. The creator can drag and drop the document to the next State in the Workflow, "Changes Requested". Other users may be "assigned" to the document. In the default State configuration, only an assigned user can move the document into the final "Approved" state.
89-
90-
An administrator can move the document into Changes Requested or Approved.
91-
92-
With the document now Approved, a user may also return to the document and Publish it, by whatever means that make sense to your use case. Such as scheduled publishing or migrating it to a new dataset.
93-
94-
Once the Workflow is complete, the metadata can be removed by using the "Complete Workflow" document action.
95-
96-
### Differences from the Sanity Studio v2 Workflow Demo
97-
98-
This plugin is largely based on the original Workflow Demo built into a Sanity Studio v2 project. The major differences are:
99-
100-
- This plugin is not concerned with nor will modify whether a document is in draft or published.
101-
- This plugin can be more easily installed and configured.
102-
- Documents must "opt-in" to and be removed from the Workflow. In the previous version, all documents were in the workflow which would fill up the interface and negatively affect performance.
103-
- Document validation status can be used as a way to prevent movement through the workflow.
104-
- User Roles and Assignments can affect the Workflow. Set rules to enforce which States documents can move between and if being assigned to a document is required to move it to a new State. These are only enforced in the Studio and not the API.
105-
- This plugin can filter Schema types and assigned Users.
106-
107-
## License
108-
109-
[MIT](LICENSE) © Sanity.io
110-
111-
## Develop & test
112-
113-
This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
114-
with default configuration for build & watch scripts.
115-
116-
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
117-
on how to run this plugin with hot reload in the studio.
118-
119-
### Release new version
120-
121-
Run ["CI & Release" workflow](https://github.com/sanity-io/sanity-plugin-workflow/actions/workflows/main.yml).
122-
Make sure to select the main branch and check "Release new version".
123-
124-
Semantic release will only release on configured branches, so it is safe to run the release on any branch.
1+
# This plugin has moved to https://github.com/sanity-io/plugins/tree/main/plugins/sanity-plugin-workflow

0 commit comments

Comments
 (0)