Skip to content

Commit 6516563

Browse files
committed
Payload 2.0 update, moved to pnpm as package manager
1 parent 1d474c2 commit 6516563

File tree

20 files changed

+4619
-6088
lines changed

20 files changed

+4619
-6088
lines changed

README.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,30 @@
11
# Payload workflow plugin
2+
23
> **Note**
34
> This plugin is currently under active development and still in an early stage.
45
> Check the [roadmap](#roadmap) below in this readme for more details / upcoming features.
56
6-
![Preview Image](./preview.png)
7+
<picture>
8+
<source media="(prefers-color-scheme: dark)" src="./preview-dark.png" />
9+
<source media="(prefers-color-scheme: light)" src="./preview-light.png" />
10+
<img alt="Shows an image illustrating the payload-workflow plugin" src="./preview-dark.png">
11+
</picture>
712

813
## Installation
14+
The most recent version of payload-workflow currently only supports Payload 2.0 and up.
15+
For older payload versions, please use `[email protected]`
16+
917
```shell
1018
$ yarn add payload-workflow
1119
```
1220

1321
## Basic usage
22+
1423
```typescript
1524
import { payloadWorkflow } from 'payload-workflow';
1625

1726
const config = buildConfig({
18-
collections: [...],
27+
collections: [ ... ],
1928
plugins: [
2029
payloadWorkflow({
2130
'my-collection-slug': {
@@ -34,19 +43,24 @@ const config = buildConfig({
3443
```
3544

3645
## Differences with the draft/publish system of Payload.
37-
The workflow plugin introduces a new field called `workflowStatus`. This field does not interact with the draft/publish system of Payload whatsoever.
3846

39-
You can "integrate" the workflow status with the draft/publish system of Payload yourself by using [Payloads hooks](https://payloadcms.com/docs/hooks/overview).
47+
The workflow plugin introduces a new field called `workflowStatus`. This field does not interact with the draft/publish
48+
system of Payload.
49+
50+
You can "integrate" the workflow status with the draft/publish system of Payload yourself by
51+
using [Payloads hooks](https://payloadcms.com/docs/hooks/overview).
4052

4153
For example: Automatically publish the document when the `workflowStatus` has been changed to `published`.
4254

43-
<h2 id="roadmap">Roadmap</h3>
55+
<h2 id="roadmap">Roadmap</h2>
4456
Upcoming Features / Ideas. Have a suggestion for the plugin? Feel free to open an issue or contribute!
4557

58+
- [X] Payload 2.0 support
4659
- [ ] Customize card properties (currently displays `title` and `createdAt`)
4760
- [ ] Edit relationships directly from the card (e.g., assigning users to a document)
48-
- [X] Toggleable column for posts without a workflow status (Currently, documents lacking `workflowStatus` aren't visible on the board)
61+
- [X] Toggleable column for posts without a workflow status (Currently, documents lacking `workflowStatus` aren't
62+
visible on the board)
4963
- [ ] Lazy loading of column contents when scrolling (Currently, board only shows `defaultLimit` amount of cards)
5064
- [ ] Permissions for changing statuses
5165
- [ ] Allowed transitions between statuses
52-
- [ ] Integration with the draft/publish system of Payload (?)
66+
- [ ] Integration with the draft/publish system of Payload (?)

dev/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@
1616
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
1717
},
1818
"dependencies": {
19+
"@payloadcms/bundler-webpack": "^1.0.2",
20+
"@payloadcms/db-mongodb": "^1.0.2",
21+
"@payloadcms/richtext-slate": "^1.0.1",
1922
"dotenv": "^16.3.1",
20-
"express": "^4.18.2"
23+
"express": "^4.18.2",
24+
"payload": "^2.0.0"
2125
},
2226
"devDependencies": {
2327
"@types/express": "^4.17.17",
2428
"copyfiles": "^2.4.1",
2529
"cross-env": "^7.0.3",
30+
"inspectpack": "^4.7.1",
2631
"nodemon": "^2.0.22",
2732
"ts-node": "^10.9.1",
2833
"typescript": "^5.1.6"

dev/src/payload.config.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,41 @@ import Posts from './collections/Posts';
55
import Tags from './collections/Tags';
66
import Users from './collections/Users';
77
import Media from './collections/Media';
8+
import { mongooseAdapter } from "@payloadcms/db-mongodb";
9+
import { slateEditor } from "@payloadcms/richtext-slate";
10+
import { webpackBundler } from "@payloadcms/bundler-webpack";
11+
812
import { payloadWorkflow } from "../../src/index";
913

1014
export default buildConfig({
1115
serverURL: 'http://localhost:3000',
16+
17+
editor: slateEditor({}),
18+
db: mongooseAdapter({
19+
url: `${ process.env.MONGODB_URI }`,
20+
}),
1221
admin: {
1322
user: Users.slug,
14-
webpack: config => ({
15-
...config,
16-
resolve: {
23+
bundler: webpackBundler(),
24+
webpack: (config) => {
25+
config.plugins = [
26+
...config.plugins as [],
27+
];
28+
config.resolve = {
1729
...config.resolve,
1830
alias: {
1931
...config.resolve?.alias,
20-
"react": path.join(__dirname, "../../node_modules/react"),
21-
"react-dom": path.join(__dirname, "../../node_modules/react-dom"),
22-
"payload": path.join(__dirname, "../../node_modules/payload"),
23-
"react-i18next": path.join(__dirname, "../../node_modules/react-i18next"),
24-
},
25-
},
26-
}),
32+
react: path.join(__dirname, '../node_modules/react'),
33+
'react-dom': path.join(__dirname, '../node_modules/react-dom'),
34+
'react-router': path.join(__dirname, '../node_modules/react-router'),
35+
'react-router-dom': path.join(__dirname, '../node_modules/react-router-dom'),
36+
'react-i18next': path.join(__dirname, '../node_modules/react-i18next'),
37+
payload: path.join(__dirname, '../node_modules/payload'),
38+
}
39+
};
40+
41+
return config
42+
}
2743
},
2844
collections: [
2945
Categories,

dev/src/server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const start = async () => {
1414
// Initialize Payload
1515
await payload.init({
1616
secret: process.env.PAYLOAD_SECRET ?? '',
17-
mongoURL: process.env.MONGODB_URI ?? '',
1817
express: app,
1918
onInit: async () => {
2019
payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`)

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "payload-workflow",
3+
"description": "A workflow plugin for Payload CMS",
34
"version": "0.2.0",
45
"keywords": [
56
"payload",
@@ -22,13 +23,19 @@
2223
"build:tsc": "tsc"
2324
},
2425
"peerDependencies": {
25-
"payload": "^1.10.5"
26+
"payload": "^2.0.0",
27+
"react": "^16.8.5 || ^17.0.0 || ^18.0.0",
28+
"react-dom": "^16.8.5 || ^17.0.0 || ^18.0.0",
29+
"react-router-dom": "^5.0.0",
30+
"react-router": "^5.0.0",
31+
"react-i18next": "^11.18.0",
32+
"i18next": "^22.5.0"
2633
},
2734
"devDependencies": {
2835
"@types/react-beautiful-dnd": "^13.1.4",
2936
"@types/react-router-dom": "^5.3.3",
3037
"copyfiles": "^2.4.1",
31-
"payload": "^1.10.5",
38+
"payload": "^2.0.0",
3239
"typescript": "^4.9.5"
3340
},
3441
"dependencies": {

0 commit comments

Comments
 (0)