Skip to content

Commit

Permalink
feat: update packages to make publish smaller (#49)
Browse files Browse the repository at this point in the history
* chore: replace @edx/frontend-plugin-framework with @openedx/frontend-plugin-framework in example apps

* chore: update dev and peer dependency
  • Loading branch information
leangseu-edx authored Mar 29, 2024
1 parent bf2f1bf commit 9be2cd4
Show file tree
Hide file tree
Showing 19 changed files with 180 additions and 247 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const config = createConfig('eslint');

config.rules = {
'import/no-unresolved': ['error', {
ignore: ['@edx/frontend-plugin-framework/example*'],
ignore: ['@openedx/frontend-plugin-framework/example*'],
}],
'import/no-extraneous-dependencies': ['error', {
devDependencies: true,
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ precommit:

requirements:
npm ci
cd example && npm ci && cd ..
cd example-plugin-app && npm ci && cd ..

i18n.extract:
# Pulling display strings from .jsx files into .json files...
Expand Down
14 changes: 5 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@ Getting Started
Using the Example Apps
----------------------

1. Run ``npm install`` in the root directory.
1. Run ``make requirements`` in the root directory.

2. In separate terminals, run ``npm install`` inside both example app directories (``/example`` and ``/example-plugin-app``).
2. Run ``npm run start`` in the root directory.

3. Run ``npm run start`` in both directories.
3. Open another terminal and run ``npm run start:example`` to start the example app. You can visit http://localhost:8080 to see the example app.

Alternatively, once the packages are installed in both apps, you can run the apps from the root directory.

1. ``npm run start`` runs the host MFE (``example``)

2. ``npm run start:plugins`` runs the child MFE (``example-plugin-app``)
4. Make change to the existing code, everything should be hot reloaded.

Add Library Dependency
----------------------
Expand Down Expand Up @@ -103,7 +99,7 @@ file as well to define its plugin slots.
// env.config.js
import { DIRECT_PLUGIN, IFRAME_PLUGIN, PLUGIN_OPERATIONS } from '@edx/frontend-plugin-framework';
import { DIRECT_PLUGIN, IFRAME_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
// import any additional dependencies or functions to be used for each plugin operation
import Sidebar from './widgets/social/Sidebar';
Expand Down
2 changes: 1 addition & 1 deletion example-plugin-app/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ config.rules = {
packageDir: path.join(__dirname, '..'),
}],
'import/no-unresolved': ['error', {
ignore: ['@edx/frontend-plugin-framework*'],
ignore: ['@openedx/frontend-plugin-framework*'],
}],
};

Expand Down
42 changes: 42 additions & 0 deletions example-plugin-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion example-plugin-app/src/DefaultIframe.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint react/prop-types: off */

import React from 'react';
import { Plugin } from '@edx/frontend-plugin-framework';
import { Plugin } from '@openedx/frontend-plugin-framework';

function DefaultComponent() {
return (
Expand Down
2 changes: 1 addition & 1 deletion example-plugin-app/src/PluginIframe.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Plugin } from '@edx/frontend-plugin-framework';
import { Plugin } from '@openedx/frontend-plugin-framework';

export default function PluginIframe() {
return (
Expand Down
2 changes: 1 addition & 1 deletion example-plugin-app/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = createConfig('webpack-dev', {
// applications. Because this example app is using code from the parent frontend-plugin-framework
// library, it runs into the same issues our applications do when loading libraries from
// local source, rather than from their node_modules directory.
'@edx/frontend-plugin-framework': path.resolve(__dirname, '..', 'src/plugins'),
'@openedx/frontend-plugin-framework': path.resolve(__dirname, '..', 'dist'),
react: path.resolve(__dirname, 'node_modules', 'react'),
'react-dom': path.resolve(__dirname, 'node_modules', 'react-dom'),
'react-router-dom': path.resolve(__dirname, 'node_modules', 'react-router-dom'),
Expand Down
2 changes: 1 addition & 1 deletion example/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ config.rules = {
packageDir: path.join(__dirname, '..'),
}],
'import/no-unresolved': ['error', {
ignore: ['@edx/frontend-plugin-framework*'],
ignore: ['@openedx/frontend-plugin-framework*'],
}],
};

Expand Down
2 changes: 1 addition & 1 deletion example/env.config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
DIRECT_PLUGIN,
IFRAME_PLUGIN,
PLUGIN_OPERATIONS,
} from '@edx/frontend-plugin-framework';
} from '@openedx/frontend-plugin-framework';
import DefaultDirectWidget from './src/components/DefaultDirectWidget';
import PluginDirect from './src/components/PluginDirect';
import ModularComponent from './src/components/ModularComponent';
Expand Down
69 changes: 56 additions & 13 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"prop-types": "^15.8.1",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-router-dom": "^6.22.1",
"react-router": "^6.22.3",
"react-router-dom": "^6.22.3",
"regenerator-runtime": "^0.14.1"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion example/src/pluginSlots/PluginSlotWithInsert.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { PluginSlot } from '@edx/frontend-plugin-framework';
import { PluginSlot } from '@openedx/frontend-plugin-framework';

function PluginSlotWithInsert() {
return (
Expand Down
2 changes: 1 addition & 1 deletion example/src/pluginSlots/PluginSlotWithModifyWrapHide.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { PluginSlot } from '@edx/frontend-plugin-framework';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import ModularComponent from '../components/ModularComponent';


Expand Down
2 changes: 1 addition & 1 deletion example/src/pluginSlots/PluginSlotWithModularPlugins.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { PluginSlot } from '@edx/frontend-plugin-framework';
import { PluginSlot } from '@openedx/frontend-plugin-framework';
import ModularComponent from '../components/ModularComponent';

function PluginSlotWithModularPlugins() {
Expand Down
2 changes: 1 addition & 1 deletion example/src/pluginSlots/PluginSlotWithoutDefault.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { PluginSlot } from '@edx/frontend-plugin-framework';
import { PluginSlot } from '@openedx/frontend-plugin-framework';

function PluginSlotWithoutDefault() {
return (
Expand Down
2 changes: 1 addition & 1 deletion example/webpack.dev.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = createConfig('webpack-dev', {
// applications. Because this example app is using code from the parent frontend-plugin-framework
// library, it runs into the same issues our applications do when loading libraries from
// local source, rather than from their node_modules directory.
'@edx/frontend-plugin-framework': path.resolve(__dirname, '..', 'src/plugins'),
'@openedx/frontend-plugin-framework': path.resolve(__dirname, '..', 'dist'),
react: path.resolve(__dirname, 'node_modules', 'react'),
'react-dom': path.resolve(__dirname, 'node_modules', 'react-dom'),
'react-router-dom': path.resolve(__dirname, 'node_modules', 'react-router-dom'),
Expand Down
Loading

0 comments on commit 9be2cd4

Please sign in to comment.