Skip to content

Commit

Permalink
docs: language added to code blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithEmad committed Nov 27, 2023
1 parent d0af772 commit 586f2dc
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,9 @@ Adding new MFEs

.. warning:: As of Tutor v16 (Palm release) it is no longer possible to add new MFEs by creating ``*_MFE_APP`` settings. Instead, users must implement the approach described here.

Other MFE developers can take advantage of this plugin to deploy their own MFEs. To declare a new MFE, create a Tutor plugin and add your MFE configuration to the ``tutormfe.hooks.MFE_APPS`` filter. This configuration should include the name, git repository (and optionally: git branch) and development port. For example::
Other MFE developers can take advantage of this plugin to deploy their own MFEs. To declare a new MFE, create a Tutor plugin and add your MFE configuration to the ``tutormfe.hooks.MFE_APPS`` filter. This configuration should include the name, git repository (and optionally: git branch) and development port. For example:

.. code-block:: python
from tutormfe.hooks import MFE_APPS
@MFE_APPS.add()
Expand All @@ -143,8 +144,9 @@ Assets will be served at ``http(s)://{{ MFE_HOST }}/mymfe``. Developers are free
Disabling individual MFEs
~~~~~~~~~~~~~~~~~~~~~~~~~

To disable an existing MFE, remove the corresponding entry from the ``MFE_APPS`` filter. For instance, to disable some of the MFEs that ship with this plugin::
To disable an existing MFE, remove the corresponding entry from the ``MFE_APPS`` filter. For instance, to disable some of the MFEs that ship with this plugin:

.. code-block:: python
@MFE_APPS.add()
def _remove_some_my_mfe(mfes):
Expand All @@ -164,7 +166,9 @@ This plugin makes it possible to change existing and add new translation strings
mkdir account
touch account/fr.json

3. Add your entries to this file in JSON format, where the key is the string ID and the value is the actual string. For instance::
3. Add your entries to this file in JSON format, where the key is the string ID and the value is the actual string. For instance:

.. code-block:: JSON
{
"account.settings.section.account.information": "Information du compte"
Expand All @@ -181,7 +185,8 @@ Customising MFEs
~~~~~~~~~~~~~~~~

To change the MFEs logos from the default to your own logos, override the corresponding settings in the MFEs environment using patches `mfe-lms-production-settings` and `mfe-lms-development-settings`. For example, using the following plugin:
::

.. code-block:: python
from tutor import hooks
Expand Down Expand Up @@ -211,7 +216,8 @@ To change the MFEs logos from the default to your own logos, override the corres
If patches are the same in development and production, they can be replaced by a single `mfe-lms-common-settings` patch.

To install custom components for the MFEs, such as the `header <https://github.com/openedx/frontend-component-header>`_ and `footer <https://github.com/openedx/frontend-component-footer>`_, override the components by adding a patch to ``mfe-dockerfile-post-npm-install`` in your plugin:
::

.. code-block:: python
from tutor import hooks
Expand All @@ -228,7 +234,8 @@ To install custom components for the MFEs, such as the `header <https://github.c
)
The same applies to installing a custom `brand <https://github.com/openedx/brand-openedx>`_ package:
::

.. code-block:: python
hooks.Filters.ENV_PATCHES.add_item(
(
Expand All @@ -239,8 +246,9 @@ The same applies to installing a custom `brand <https://github.com/openedx/brand
)
)
In both cases above, the ``npm`` commands affect every MFE being built. If you want have different commands apply to different MFEs, you can add one or more patches to ``mfe-dockerfile-post-npm-install-*`` instead. For instance, you could install one particular version of the header to the Learning MFE by patching ``mfe-dockerfile-post-npm-install-learning``, and another one to the ORA Grading MFE by patching ``mfe-dockerfile-post-npm-install-ora-grading``::
In both cases above, the ``npm`` commands affect every MFE being built. If you want have different commands apply to different MFEs, you can add one or more patches to ``mfe-dockerfile-post-npm-install-*`` instead. For instance, you could install one particular version of the header to the Learning MFE by patching ``mfe-dockerfile-post-npm-install-learning``, and another one to the ORA Grading MFE by patching ``mfe-dockerfile-post-npm-install-ora-grading``:

.. code-block:: python
hooks.Filters.ENV_PATCHES.add_items(
[
(
Expand All @@ -259,7 +267,8 @@ In both cases above, the ``npm`` commands affect every MFE being built. If you
)
In case you need to run additional instructions just before the build step you can use the ``mfe-dockerfile-pre-npm-build`` or ``mfe-dockerfile-pre-npm-build-*`` patches. For example, you may want to override existing env variables or define new ones.
::

.. code-block:: python
from tutor import hooks
Expand Down Expand Up @@ -292,7 +301,8 @@ Installing from a private npm registry

In case you need to install components from a private NPM registry, you can append the ``--registry`` option to your install statement or add a ``npm config set`` command to the plugin.
In some cases, for example when using `GitLab's NPM package registry <https://docs.gitlab.com/ee/user/packages/npm_registry/>`_, you might also need to provide a token for your registry, which can be done with an additional ``npm config set`` command as well:
::

.. code-block:: python
from tutor import hooks
Expand Down

0 comments on commit 586f2dc

Please sign in to comment.