Skip to content

Commit fb58f43

Browse files
committed
docs: Add more info to the readme.
With these instructions, a developer should be able to have the sample plugin running locally for development.
1 parent fcce64a commit fb58f43

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

README.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,65 @@ the tutor-mfe plugin.
2424
```
2525
# Example using the `learner-dashboard` MFE
2626
# Tell tutor to start this MFE in dev mode
27+
tutor mounts add ~/src/openedx/frontend-app-learner-dashboard
2728
tutor dev start learner-dashbard
2829
tutor dev launch
2930
30-
# Go to the `profile` MFE folder locally.
31-
# TODO Edits needed to load our plugin locally.
31+
# Go to the `learner-dashboard` MFE folder locally.
32+
npm install /path/to/sample-plugin/frontend
33+
34+
# Add an env.config.jsx
35+
# This file is not checked in and imports and injects your plugin for local
36+
# development.
37+
```
38+
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
39+
import { CourseList } from '@feanil/sample-plugin';
40+
41+
const config = {
42+
pluginSlots: {
43+
course_list_slot: {
44+
// Hide the default CourseList component
45+
keepDefault: false,
46+
plugins: [
47+
{
48+
op: PLUGIN_OPERATIONS.Insert,
49+
widget: {
50+
id: 'custom_course_list',
51+
type: DIRECT_PLUGIN,
52+
priority: 60,
53+
// The CourseList component recieves `courseListData` because that is what
54+
// the `custom_course_list` slot provides as a plugin prop.
55+
// https://github.com/openedx/frontend-app-learner-dashboard/tree/master/src/plugin-slots/CourseListSlot#plugin-props
56+
RenderWidget: CourseList
57+
},
58+
},
59+
],
60+
},
61+
},
62+
}
63+
```
64+
export default config;
65+
66+
# Add a module.config.js
67+
# This file tells webpack to use your local repo for the code of the module
68+
# rather than the `npm install` version of your package.
69+
```
70+
module.exports = {
71+
/*
72+
Modules you want to use from local source code. Adding a module here means that when this app
73+
runs its build, it'll resolve the source from peer directories of this app.
74+
75+
moduleName: the name you use to import code from the module.
76+
dir: The relative path to the module's source code.
77+
dist: The sub-directory of the source code where it puts its build artifact. Often "dist".
78+
*/
79+
80+
localModules: [
81+
{ moduleName: '@feanil/sample-plugin', dir: '/path/to/sample-plugin/frontend'},
82+
],
83+
84+
};
85+
```
3286
3387
# Start up the service
3488
npm ci

0 commit comments

Comments
 (0)