You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/designing-studies/plugin-libraries.md
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,46 @@ For example, here we add a new `instruction` to the `mini-vlat` library's `treem
81
81
82
82
## Creating your Own Plugins
83
83
84
-
Beyond the libraries we provide, you can also define your own plugins in your study. See [LibraryConfig](https://revisit.dev/docs/typedoc/interfaces/LibraryConfig/) for the details of how to define plugin libraries.
84
+
Beyond the libraries we provide, you can also define your own plugins in your study.
85
+
86
+
A natural starting point for creating libraries is if you find yourself creating components that could be re-used across your own studies, or be shared with the broader community. Let's say you have two custom created components, `A.tsx` and `B.tsx`, and you want to turn them into a plugin library.
87
+
88
+
Here is an overview of the folders you will be creating:
89
+
90
+
```
91
+
study/
92
+
|- public/
93
+
| |- basic-questionnaire-study/
94
+
| |- ...
95
+
| |- libraries/
96
+
| |- adaptive-vlat/
97
+
| |- ...
98
+
| |- my-plugin/ <- NEW FOLDER (STEP 2)
99
+
| |- ...
100
+
| |- library-adaptive-vlat/
101
+
| |- ...
102
+
| |- library-my-plugin/ <- NEW FOLDER (STEP 3)
103
+
|- src/
104
+
| |- analysis/
105
+
| |- ...
106
+
| |- public/
107
+
| |- demo-click-accuracy-test/
108
+
| |- ...
109
+
| |- libraries/
110
+
| |- mini-vlat/
111
+
| |- ...
112
+
| |- my-plugin/assets/ <- NEW FOLDER (STEP 1)
113
+
```
114
+
115
+
Suppose you create a new plugin library called `my-plugin`.
116
+
117
+
1.**STEP 1**. Create a folder: `src/public/libraries/my-plugin/assets`.
118
+
- The components that will make up of your library, e.g., `A.tsx`, `B.tsx` as well as any image or video files that go into these components, will sit in this folder.
119
+
2.**STEP 2**. Create a folder: `public/libraries/my-plugin`.
120
+
- Initialize a `config.json` file within this newly created folder. This `config.json` should follow [LibraryConfig](https://revisit.dev/docs/typedoc/interfaces/LibraryConfig/).
121
+
3.**STEP 3**. Create a folder: `public/library-my-plugin`.
122
+
- Initialize a `config.json` file within this newly created folder. This config file should follow how a study configuration is typically defined (see [StudyConfig](https://revisit.dev/docs/typedoc/interfaces/StudyConfig/)) for more details.
123
+
- A typical practice is to include some introductory information before showcasing the full library. To achieve this, create an `introduction.md` file and place it in `public/library/my-plugin/assets/`.
85
124
86
125
We are happy to **accept community contributions for libraries!** If you have a library that you think would be useful for others, please reach out to us and we will help you merge it into our repository.
0 commit comments