@openedx/plugin-sample 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -306,29 +306,34 @@ if (response.data && Array.isArray(response.data)) {
|
|
|
306
306
|
|
|
307
307
|
### Prerequisites
|
|
308
308
|
|
|
309
|
-
1. **MFE Setup**:
|
|
309
|
+
1. **Tutor & Tutor-MFE Setup**: Tutor is installed and launched in `dev` mode.
|
|
310
310
|
2. **Backend Plugin**: Install the backend plugin (see [`../backend-plugin-sample/README.md`](../backend-plugin-sample/README.md))
|
|
311
311
|
3. **Node.js**: Version 16+ with npm or yarn
|
|
312
312
|
|
|
313
313
|
### Local Development Setup
|
|
314
314
|
|
|
315
|
-
#### Step
|
|
315
|
+
#### Step 1: Create module.config.js
|
|
316
316
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
```
|
|
317
|
+
Create `module.config.js` in your MFE root, not committed to the repo.
|
|
318
|
+
This tells the MFE to load/use the `@openedx/sample-plugin` package
|
|
319
|
+
as a source (non-built) distribution .
|
|
321
320
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
```javascript
|
|
322
|
+
module.exports = {
|
|
323
|
+
localModules: [
|
|
324
|
+
{
|
|
325
|
+
moduleName: '@openedx/plugin-sample',
|
|
326
|
+
dir: '/path/to/sample-plugin/frontend-plugin-sample',
|
|
327
|
+
dist: 'src'
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
};
|
|
327
331
|
```
|
|
328
332
|
|
|
329
333
|
#### Step 2: Create env.config.jsx
|
|
330
334
|
|
|
331
|
-
Create `env.config.jsx` in your MFE root
|
|
335
|
+
Create `env.config.jsx` in your MFE root, not committed to the repo.
|
|
336
|
+
This plugs the sample widget into the course list slot.
|
|
332
337
|
|
|
333
338
|
```javascript
|
|
334
339
|
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
|
@@ -355,29 +360,22 @@ const config = {
|
|
|
355
360
|
|
|
356
361
|
export default config;
|
|
357
362
|
```
|
|
358
|
-
|
|
359
|
-
#### Step 3: Create module.config.js
|
|
360
|
-
|
|
361
|
-
Create `module.config.js` for local development:
|
|
362
|
-
|
|
363
|
-
```javascript
|
|
364
|
-
module.exports = {
|
|
365
|
-
localModules: [
|
|
366
|
-
{
|
|
367
|
-
moduleName: '@openedx/plugin-sample',
|
|
368
|
-
dir: '/path/to/sample-plugin/frontend-plugin-sample'
|
|
369
|
-
},
|
|
370
|
-
],
|
|
371
|
-
};
|
|
372
|
-
```
|
|
373
|
-
|
|
374
363
|
**Purpose**: Webpack uses your local plugin code instead of the installed package.
|
|
375
364
|
|
|
376
|
-
#### Step
|
|
365
|
+
#### Step 3: Start Development
|
|
366
|
+
|
|
367
|
+
Now, from the MFE repository root, install requirements and run the dev server.
|
|
377
368
|
|
|
378
369
|
```bash
|
|
379
|
-
#
|
|
370
|
+
# Install requirements
|
|
380
371
|
npm ci
|
|
372
|
+
|
|
373
|
+
# If running Tutor:
|
|
374
|
+
tutor mounts add . # Instruct tutor-mfe to redict requests to this local MFE devserver
|
|
375
|
+
tutor dev reboot -d mfe
|
|
376
|
+
npm run dev
|
|
377
|
+
|
|
378
|
+
# If not running Tutor:
|
|
381
379
|
npm start
|
|
382
380
|
```
|
|
383
381
|
|