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/client-packages-react.md
+51-11Lines changed: 51 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,9 @@ Ensure the GitHub package registry is configured (see [Registry Setup](./client-
10
10
pnpm add @edufeed-org/oer-finder-plugin-react
11
11
```
12
12
13
-
This package depends on `@edufeed-org/oer-finder-plugin` internally — you do not need to install the base plugin separately.
13
+
The base plugin (`@edufeed-org/oer-finder-plugin`) is installed automatically as a dependency — you do not need to install it separately. All necessary imports (components, types, and adapter registration) are available directly from this React package.
14
+
15
+
> **Important:** Do not install `@edufeed-org/oer-finder-plugin` as a direct dependency alongside the React package. Doing so can result in two separate copies on disk, each with its own adapter registry. Adapters registered via one copy would be invisible to components from the other, causing searches to silently return zero results. Always import from `@edufeed-org/oer-finder-plugin-react` instead.
14
16
15
17
## Operating Modes
16
18
@@ -48,15 +50,14 @@ You **must register adapters** before the component renders. Call the registrati
48
50
49
51
```typescript
50
52
// Register all built-in adapters
51
-
import {registerAllBuiltInAdapters} from '@edufeed-org/oer-finder-plugin/adapters';
53
+
import {registerAllBuiltInAdapters} from '@edufeed-org/oer-finder-plugin-react/adapters';
52
54
registerAllBuiltInAdapters();
53
55
```
54
56
55
-
Or register only the adapters you need to reduce bundle size:
57
+
Or register only the adapters you need:
56
58
57
59
```typescript
58
-
import {registerOpenverseAdapter} from '@edufeed-org/oer-finder-plugin/adapter/openverse';
59
-
import {registerArasaacAdapter} from '@edufeed-org/oer-finder-plugin/adapter/arasaac';
60
+
import {registerOpenverseAdapter, registerArasaacAdapter} from '@edufeed-org/oer-finder-plugin-react/adapters';
60
61
registerOpenverseAdapter();
61
62
registerArasaacAdapter();
62
63
```
@@ -93,9 +94,11 @@ import {
93
94
94
95
// Configure available sources (checked: true sets the pre-selected sources)
95
96
const SOURCES: SourceConfig[] = [
96
-
{id: 'nostr', label: 'Nostr', checked: true},
97
+
{id: 'nostr-amb-relay', label: 'Nostr AMB Relay', checked: true},
97
98
{id: 'openverse', label: 'Openverse'},
98
99
{id: 'arasaac', label: 'ARASAAC'},
100
+
{id: 'rpi-virtuell', label: 'RPI-Virtuell'},
101
+
{id: 'wikimedia', label: 'Wikimedia Commons'},
99
102
];
100
103
101
104
function OerFinder() {
@@ -183,8 +186,7 @@ The component code is identical to the [server-proxy example above](#server-prox
183
186
**1. Register adapters once at your app entry point (e.g., `main.tsx`):**
184
187
185
188
```tsx
186
-
import {registerOpenverseAdapter} from '@edufeed-org/oer-finder-plugin/adapter/openverse';
187
-
import {registerArasaacAdapter} from '@edufeed-org/oer-finder-plugin/adapter/arasaac';
189
+
import {registerOpenverseAdapter, registerArasaacAdapter} from '@edufeed-org/oer-finder-plugin-react/adapters';
188
190
registerOpenverseAdapter();
189
191
registerArasaacAdapter();
190
192
```
@@ -289,6 +291,31 @@ If you render `OerLoadMore` outside of `OerSearch`, the event will not bubble to
289
291
|------|-------------------|-------------|
290
292
| `onLoadMore` | `(event: CustomEvent<void>) => void` | Fired when the "Load more" button is clicked. When slotted inside `OerSearch`, this event bubbles up automatically to trigger the next page fetch — no manual handler needed. |
291
293
294
+
## Available Adapters
295
+
296
+
The following built-in adapters are available for direct client mode:
// Add to the named exports block (this is how the React package picks it up automatically):
195
+
export { register<Name>Adapter };
196
+
197
+
// Add inside registerAllBuiltInAdapters():
194
198
register<Name>Adapter();
195
199
```
196
200
@@ -209,32 +213,36 @@ register<Name>Adapter();
209
213
210
214
**i)** Add to source configs in `packages/oer-finder-plugin-example/src/main.ts`.
211
215
216
+
**j)** Add to source configs in `packages/oer-finder-plugin-react-example/src/App.tsx`.
217
+
218
+
> **Note:** The React package (`oer-finder-plugin-react`) automatically re-exports all adapter registration functions from the base plugin via `export * from '@edufeed-org/oer-finder-plugin/adapters'`. No changes to the React package are needed — new adapters are picked up automatically once added to the base plugin's `built-in-registrations.ts`.
219
+
212
220
#### Docker
213
221
214
-
**j)** Add a COPY line in the `Dockerfile` (in the `production` stage):
222
+
**k)** Add a COPY line in the `Dockerfile` (in the `production` stage):
pnpm --filter @edufeed-org/oer-adapter-<name> run build
235
243
```
236
244
237
-
> **Warning:** Forgetting the release workflow step (m) will cause the release build to fail with `[commonjs--resolver] Failed to resolve entry for package`. The plugin bundles all adapters — if yours isn't built before the plugin build runs, Vite cannot resolve it.
245
+
> **Warning:** Forgetting the release workflow step (n) will cause the release build to fail with `[commonjs--resolver] Failed to resolve entry for package`. The plugin bundles all adapters — if yours isn't built before the plugin build runs, Vite cannot resolve it.
0 commit comments