Skip to content

Commit 2a7d132

Browse files
authored
Merge pull request #207 from overhangio/redwood
Upgrade to redwood
2 parents f7f21ed + 6e16f2f commit 2a7d132

File tree

11 files changed

+74
-103
lines changed

11 files changed

+74
-103
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ instructions, because git commits are used to generate release notes:
1919

2020
<!-- scriv-insert-here -->
2121

22+
<a id='changelog-18.0.0'></a>
23+
## v18.0.0 (2024-06-19)
24+
25+
- 💥[Feature] Upgrade to Redwood (by @hinakhadim)
26+
- [Feature] Enable `atlas pull` on all Micro-frontends. (by @omarithawi)
27+
- 💥[Feature] Use `ATLAS_OPTIONS` for `atlas pull`. This breaks the `i18n-merge.js` custom locale Tutor MFE feature in favor of [OEP-58](https://docs.openedx.org/en/latest/developers/concepts/oep58.html) `atlas pull` options. (by @omarithawi)
28+
2229
<a id='changelog-17.0.1'></a>
2330
## v17.0.1 (2024-03-26)
2431

README.rst

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ Adding new MFEs
130130

131131
- 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 below.
132132
- As of Tutor v17 (Quince release) you must make sure that the git URL of your MFE repository ends with ``.git``. Otherwise the plugin build will fail.
133+
- As of Tutor v18 (Redwood release) all MFEs must provide a ``make pull_translations`` command. Otherwise the plugin build will fail. Providing an empty command is enough to bypass this requirement. See the `Custom translations section <#mfe-custom-translations>`_ for more information.
133134

134135
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 or tag) and development port. For example:
135136

@@ -163,32 +164,26 @@ To disable an existing MFE, remove the corresponding entry from the ``MFE_APPS``
163164
mfes.pop("profile")
164165
return mfes
165166
166-
Adding custom translations to your MFEs
167-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
168-
169-
This plugin makes it possible to change existing and add new translation strings to MFEs. Here is how to do it:
170-
171-
1. Identify the ID of the string you would like to translate. For instance, the ID of the "Account Information" string in the account MFE is "account.settings.section.account.information" (see `source <https://github.com/edx/frontend-app-account/blob/1444831833cad4746b9ed14618a499b425ccc907/src/account-settings/AccountSettingsPage.messages.jsx#L34>`__).
172-
2. Create a folder and i18n file corresponding to your MFE app and language in the Tutor root. This location of this file should be ``/path/to/tutor/env/plugins/mfe/build/mfe/i18n/<app name>/<language code>.json``. For instance, to add French ("fr") translation strings to the account MFE, run::
173-
174-
cd "$(tutor config printroot)/env/plugins/mfe/build/mfe/i18n/"
175-
mkdir account
176-
touch account/fr.json
167+
Using custom translations to your MFEs
168+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
177169

178-
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:
170+
.. _mfe-custom-translations:
179171

180-
.. code-block::json
172+
During docker image build, this plugin runs ``make pull_translations`` for each Micro-frontend. This
173+
program is used in the ``Dockerfile`` to pull translations from the `openedx/openedx-translations repository <https://github.com/openedx/openedx-translations>`_ via `openedx-atlas <https://github.com/openedx/openedx-atlas>`_.
181174

182-
{
183-
"account.settings.section.account.information": "Information du compte"
184-
}
175+
The ``make pull_translations`` command passes the ``ATLAS_OPTIONS`` environment variable to the ``atlas pull`` command. This allows specifying a custom repository or branch to pull translations from.
185176

186-
4. Rebuild the MFE image and restart the MFE with::
177+
Translations in the MFE plugin as well as other Tutor plugins can be customized with the following configuration
178+
variables:
187179

188-
tutor images build mfe
189-
tutor local start -d
180+
- ``ATLAS_REVISION`` (default: ``"main"`` on nightly and ``"{{ OPENEDX_COMMON_VERSION }}"`` if a named release is used)
181+
- ``ATLAS_REPOSITORY`` (default: ``"openedx/openedx-translations"``).
182+
- ``ATLAS_OPTIONS`` (default: ``""``) Pass additional arguments to ``atlas pull``. Refer to the `atlas documentations <https://github.com/openedx/openedx-atlas>`_ for more information.
190183

191-
Your custom translation strings should now appear in your app.
184+
The
185+
`Getting and customizing Translations <https://docs.tutor.edly.io/configuration.html#getting-and-customizing-translations>`_
186+
section in the Tutor configuration documentation explains how to do this.
192187

193188
Customising MFEs
194189
~~~~~~~~~~~~~~~~

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def load_about():
4040
packages=find_packages(exclude=["tests*"]),
4141
include_package_data=True,
4242
python_requires=">=3.8",
43-
install_requires=["tutor>=17.0.0,<18.0.0"],
44-
extras_require={"dev": ["tutor[dev]>=17.0.0,<18.0.0"]},
43+
install_requires=["tutor>=18.0.0,<19.0.0"],
44+
extras_require={"dev": ["tutor[dev]>=18.0.0,<19.0.0"]},
4545
entry_points={"tutor.plugin.v1": ["mfe = tutormfe.plugin"]},
4646
classifiers=[
4747
"Development Status :: 5 - Production/Stable",

tutormfe/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "17.0.1"
1+
__version__ = "18.0.0"

tutormfe/hooks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
the tutor-mfe hooks would be created in the context of some other plugin that imports
44
them.
55
"""
6+
67
from __future__ import annotations
78

89
import typing as t

tutormfe/patches/openedx-lms-development-settings

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ MFE_CONFIG["ACCOUNT_SETTINGS_URL"] = ACCOUNT_MICROFRONTEND_URL
3636
{% endif %}
3737

3838
{% if get_mfe("course-authoring") %}
39-
MFE_CONFIG["ENABLE_NEW_EDITOR_PAGES"] = True
40-
MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = True
4139
MFE_CONFIG["COURSE_AUTHORING_MICROFRONTEND_URL"] = "http://{{ MFE_HOST }}:{{ get_mfe("course-authoring")["port"] }}/course-authoring"
40+
MFE_CONFIG["ENABLE_ASSETS_PAGE"] = "true"
41+
MFE_CONFIG["ENABLE_HOME_PAGE_COURSE_API_V2"] = "true"
42+
MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = "true"
43+
MFE_CONFIG["ENABLE_TAGGING_TAXONOMY_PAGES"] = "true"
4244
{% endif %}
4345

4446
{% if get_mfe("discussions") %}

tutormfe/patches/openedx-lms-production-settings

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ MFE_CONFIG["ACCOUNT_SETTINGS_URL"] = ACCOUNT_MICROFRONTEND_URL
3737
{% endif %}
3838

3939
{% if get_mfe("course-authoring") %}
40-
MFE_CONFIG["ENABLE_NEW_EDITOR_PAGES"] = True
41-
MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = True
4240
MFE_CONFIG["COURSE_AUTHORING_MICROFRONTEND_URL"] = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}/course-authoring"
41+
MFE_CONFIG["ENABLE_ASSETS_PAGE"] = "true"
42+
MFE_CONFIG["ENABLE_HOME_PAGE_COURSE_API_V2"] = "true"
43+
MFE_CONFIG["ENABLE_PROGRESS_GRAPH_SETTINGS"] = "true"
44+
MFE_CONFIG["ENABLE_TAGGING_TAXONOMY_PAGES"] = "true"
4345
{% endif %}
4446

4547
{% if get_mfe("discussions") %}

tutormfe/templates/mfe/apps/mfe/webpack.dev-tutor.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const fs = require('fs');
44
const baseDevConfig = (
55
fs.existsSync('./webpack.dev.config.js')
66
? require('./webpack.dev.config.js')
7-
: require('@edx/frontend-build/config/webpack.dev.config.js')
7+
: require('@openedx/frontend-build/config/webpack.dev.config.js')
88
);
99

1010
module.exports = merge(baseDevConfig, {

tutormfe/templates/mfe/build/mfe/Dockerfile

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ RUN mkdir -p /openedx/app /openedx/env
2020
WORKDIR /openedx/app
2121
ENV PATH /openedx/app/node_modules/.bin:${PATH}
2222

23-
######## i18n strings
24-
FROM base AS i18n
25-
COPY ./i18n /openedx/i18n
26-
RUN chmod a+x /openedx/i18n/*.js
27-
RUN echo "copying i18n data" \
28-
{%- for app_name, app in iter_mfes() %}
29-
&& mkdir -p /openedx/i18n/{{ app_name }} \
30-
{%- endfor %}
31-
echo "done."
32-
3323
{% for app_name, app in iter_mfes() %}
3424
####################### {{ app_name }} MFE
3525
######## {{ app_name }} (git)
@@ -42,14 +32,6 @@ ADD --keep-git-dir=true {{ app["repository"] }}#{{ app.get("version", MFE_COMMON
4232
FROM scratch as {{ app_name }}-src
4333
COPY --from={{ app_name }}-git /openedx/app /
4434

45-
######## {{ app_name }} (i18n)
46-
FROM base AS {{ app_name }}-i18n
47-
COPY --from={{ app_name }}-src / /openedx/app
48-
COPY --from=i18n /openedx/i18n/{{ app_name }} /openedx/i18n/{{ app_name }}
49-
COPY --from=i18n /openedx/i18n/i18n-merge.js /openedx/i18n/i18n-merge.js
50-
RUN stat /openedx/app/src/i18n/messages 2> /dev/null || (echo "missing messages folder" && mkdir -p /openedx/app/src/i18n/messages)
51-
RUN /openedx/i18n/i18n-merge.js /openedx/app/src/i18n/messages /openedx/i18n/{{ app_name }} /openedx/app/src/i18n/messages
52-
5335
######## {{ app_name }} (common)
5436
FROM base AS {{ app_name }}-common
5537
COPY --from={{ app_name }}-src /package.json /openedx/app/package.json
@@ -65,13 +47,8 @@ RUN --mount=type=cache,target=/root/.npm,sharing=shared npm clean-install --no-a
6547
{{ patch("mfe-dockerfile-post-npm-install") }}
6648
{{ patch("mfe-dockerfile-post-npm-install-{}".format(app_name)) }}
6749
COPY --from={{ app_name }}-src / /openedx/app
68-
COPY --from={{ app_name }}-i18n /openedx/app/src/i18n/messages /openedx/app/src/i18n/messages
6950

70-
# Whenever a new MFE supports Atlas, it should be added to this list.
71-
# When all MFEs support Atlas, this if-statement should be removed.
72-
{% if app_name in ["communications"] %}
73-
RUN make OPENEDX_ATLAS_PULL=true pull_translations
74-
{% endif %}
51+
RUN make OPENEDX_ATLAS_PULL=true ATLAS_OPTIONS="--repository={{ ATLAS_REPOSITORY }} --revision={{ ATLAS_REVISION }} {{ ATLAS_OPTIONS }}" pull_translations
7552

7653
EXPOSE {{ app['port'] }}
7754

tutormfe/templates/mfe/build/mfe/i18n/i18n-merge.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)