Skip to content

Commit 4c8b4f1

Browse files
authored
feat: add example apps (#33)
* fix: wrap getConfig in usePluginSlot * fix: convert frontend build and paragon to use @openedx scope * fix: update frontend-platform
1 parent d656ca9 commit 4c8b4f1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+40219
-7089
lines changed

.eslintrc.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
11
// eslint-disable-next-line import/no-extraneous-dependencies
2-
const { createConfig } = require('@edx/frontend-build');
2+
const { createConfig } = require('@openedx/frontend-build');
33

4-
module.exports = createConfig('eslint');
4+
const config = createConfig('eslint');
5+
6+
config.rules = {
7+
'import/no-unresolved': ['error', {
8+
ignore: ['@edx/frontend-plugin-framework/example*'],
9+
}],
10+
'import/no-extraneous-dependencies': ['error', {
11+
devDependencies: true,
12+
}],
13+
};
14+
15+
config.ignorePatterns = [
16+
'example*',
17+
];
18+
19+
module.exports = config;

README.rst

+17-1
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,27 @@ for a component that lives in another MFE (the 'Child MFE') to be plugged into a
2626

2727
Getting Started
2828
===============
29-
1. Add Library Dependency
29+
Add Library Dependency
3030
-------------------------
3131

3232
Add ``@edx/frontend-plugin-framework`` to the ``package.json`` of both Host and Child MFEs.
3333

34+
Using the Example Apps
35+
----------------------
36+
37+
1. Run ``npm install`` in the root directory.
38+
39+
2. In separate terminals, run ``npm install`` inside both example app directories (``/example`` and ``/example-plugin-app``).
40+
41+
3. Run ``npm run start`` in both directories.
42+
43+
Alternatively, once the packages are installed in both apps, you can run the apps from the root directory.
44+
45+
1. ``npm run start`` runs the host MFE (``example``)
46+
47+
2. ``npm run start:plugins`` runs the child MFE (``example-plugin-app``)
48+
49+
3450
Micro-frontend configuration document (JS)
3551
------------------------------------------
3652

example-plugin-app/.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

example-plugin-app/.eslintrc.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { getBaseConfig } = require('@openedx/frontend-build');
2+
const path = require('path');
3+
4+
const config = getBaseConfig('eslint');
5+
6+
config.rules = {
7+
'import/no-extraneous-dependencies': ['error', {
8+
packageDir: path.join(__dirname, '..'),
9+
}],
10+
'import/no-unresolved': ['error', {
11+
ignore: ['@edx/frontend-plugin-framework*'],
12+
}],
13+
};
14+
15+
module.exports = config;

example-plugin-app/env.config.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// eslint-disable-next-line no-unused-vars
2+
const config = {
3+
ACCESS_TOKEN_COOKIE_NAME: 'edx-jwt-cookie-header-payload',
4+
ACCOUNT_PROFILE_URL: 'http://localhost:1995',
5+
ACCOUNT_SETTINGS_URL: 'http://localhost:1997',
6+
BASE_URL: 'http://localhost:8081',
7+
CREDENTIALS_BASE_URL: 'http://localhost:18150',
8+
CSRF_TOKEN_API_PATH: '/csrf/api/v1/token',
9+
DISCOVERY_API_BASE_URL: 'http://localhost:18381',
10+
PUBLISHER_BASE_URL: 'http://localhost:18400',
11+
ECOMMERCE_BASE_URL: 'http://localhost:18130',
12+
LANGUAGE_PREFERENCE_COOKIE_NAME: 'openedx-language-preference',
13+
LEARNING_BASE_URL: 'http://localhost:2000',
14+
LMS_BASE_URL: 'http://localhost:18000',
15+
LOGIN_URL: 'http://localhost:18000/login',
16+
LOGOUT_URL: 'http://localhost:18000/logout',
17+
STUDIO_BASE_URL: 'http://localhost:18010',
18+
MARKETING_SITE_BASE_URL: 'http://localhost:18000',
19+
ORDER_HISTORY_URL: 'http://localhost:1996/orders',
20+
REFRESH_ACCESS_TOKEN_ENDPOINT: 'http://localhost:18000/login_refresh',
21+
SEGMENT_KEY: null,
22+
SITE_NAME: 'localhost',
23+
USER_INFO_COOKIE_NAME: 'edx-user-info',
24+
LOGO_URL: 'https://edx-cdn.org/v3/default/logo.svg',
25+
LOGO_TRADEMARK_URL: 'https://edx-cdn.org/v3/default/logo-trademark.svg',
26+
LOGO_WHITE_URL: 'https://edx-cdn.org/v3/default/logo-white.svg',
27+
FAVICON_URL: 'https://edx-cdn.org/v3/default/favicon.ico',
28+
MFE_CONFIG_API_URL: null,
29+
APP_ID: null,
30+
SUPPORT_URL: 'https://support.edx.org',
31+
PORT: 8081,
32+
};

0 commit comments

Comments
 (0)