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

Commit 1336cf9

Browse files
committed
docs: adds development documentation
1 parent a7b79d5 commit 1336cf9

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,61 @@ import {
186186
} from "@payloadcms/plugin-nested-docs/dist/types";
187187
```
188188
189+
## Development
190+
191+
To actively develop or debug this plugin you can either work directly within the demo directory of this repo, or link your own project.
192+
193+
1. #### Internal Demo
194+
195+
This repo includes a fully working, self-seeding instance of Payload that installs the plugin directly from the source code. This is the easiest way to get started. To spin up this demo, follow these steps:
196+
197+
1. First clone the repo
198+
1. Then, `cd PLUGIN_REPO && yarn && cd demo && yarn && yarn dev`
199+
1. Now open `http://localhost:3000/admin` in your browser
200+
1. Enter username `dev@payloadcms.com` and password `test`
201+
202+
That's it! Changes made in `./src` will be reflected in your demo. Keep in mind that the demo database is automatically seeded on every startup, any changes you make to the data get destroyed each time you reboot the app.
203+
204+
1. #### Linked Project
205+
206+
You can alternatively link your own project to the source code:
207+
208+
1. First clone the repo
209+
1. Then, `cd YOUR_PLUGIN_REPO && yarn && yarn build && yarn link`
210+
1. Now `cd` back into your own project and run, `yarn link @payloadcms/plugin-nested-docs`
211+
1. If this plugin using React in any way, continue to the next step. Otherwise skip to step 7.
212+
1. From your own project, `cd node_modules/react && yarn link && cd ../react-dom && yarn link && cd ../../`
213+
1. Then, `cd YOUR_PLUGIN_REPO && yarn link react react-dom`
214+
215+
All set! You can now boot up your own project as normal, and your local copy of the plugin source code will be used. Keep in mind that changes to the source code require a rebuild, `yarn build`.
216+
217+
You might also need to alias these modules in your Webpack config. To do this, open your project's Payload config and add the following:
218+
219+
```js
220+
import { buildConfig } from "payload/config";
221+
222+
export default buildConfig({
223+
admin: {
224+
webpack: (config) => ({
225+
...config,
226+
resolve: {
227+
...config.resolve,
228+
alias: {
229+
...config.resolve.alias,
230+
react: path.join(__dirname, "../node_modules/react"),
231+
"react-dom": path.join(__dirname, "../node_modules/react-dom"),
232+
payload: path.join(__dirname, "../node_modules/payload"),
233+
"@payloadcms/plugin-nested-docs": path.join(
234+
__dirname,
235+
"../../payload/plugin-nested-docs/src"
236+
),
237+
},
238+
},
239+
}),
240+
},
241+
});
242+
```
243+
189244
## Screenshots
190245

191246
<!-- ![screenshot 1](https://github.com/@payloadcms/plugin-nested-docs/blob/main/images/screenshot-1.jpg?raw=true) -->

0 commit comments

Comments
 (0)