-
Notifications
You must be signed in to change notification settings - Fork 12
Set edx.org theme as default for edx-platform and MFEs #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
b1cc743
b2d1484
d0948d4
e2e7a62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -707,6 +707,8 @@ services: | |||||
| service: microfrontend | ||||||
| working_dir: '/edx/app/frontend-app-account' | ||||||
| container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.frontend-app-account" | ||||||
| environment: | ||||||
| PARAGON_BRAND_PACKAGE: '@edx/brand-edx.org@@1.x' | ||||||
| networks: | ||||||
| default: | ||||||
| aliases: | ||||||
|
|
@@ -722,6 +724,8 @@ services: | |||||
| service: microfrontend | ||||||
| working_dir: '/edx/app/frontend-app-profile' | ||||||
| container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.frontend-app-profile" | ||||||
| environment: | ||||||
| PARAGON_BRAND_PACKAGE: '@edx/brand-edx.org' | ||||||
|
||||||
| PARAGON_BRAND_PACKAGE: '@edx/brand-edx.org' | |
| PARAGON_BRAND_PACKAGE: '@edx/brand-edx.org@~2.0.0' |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edx-internal shows this version as 2.x currently.
| PARAGON_BRAND_PACKAGE: '@edx/brand-edx.org@~2.0.0' | |
| PARAGON_BRAND_PACKAGE: '@edx/brand-edx.org@2.x' |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears this MFE does not install @edx/brand-edx.org in the standard way, instead manually installing it in the gocd pipeline itself (source).
That said, it currently installs 2.x, not latest.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: it doesn't appear frontend-app-gradebook uses @edx/brand-edx.org today. See production app in screenshot below; the button styles are from the default Paragon styles, not @edx/brand-edx.org.
Would we want to update the devstack MFE to use @edx/brand-edx.org when stage/prod does not? For this PR, I might recommend not adding @edx/brand-edx.org for MFEs that seemingly don't use it. You might consider coordinating with the owning teams to start using the @edx/brand-edx.org theme in stage/prod/devstack.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The version 2.x was incorrectly added to the working_dir; it should be on the PARAGON_BRAND_PACKAGE.
Related, edx-internal doesn't define an NPM_ALIAS for this MFE (source). However, it is running the @edx/brand-edx.org theme, as it's installed by default in the upstream MFE package.json (source), which is incorrect as @edx/brand-edx.org is 2U/edX.org specific and should not be in openedx repo.
Might be worth coordinating with the owning team to get @edx/brand-edx.org used within NPM_ALIAS in edx-internal instead, and keeping @edx/brand-openedx installed by default in the MFE, which is convention.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's another instance where @edx/brand-edx.org is actually installed via the GoCD pipeline file vs. the typical NPM_ALIASES config (source). That said, the version appears to be 2.x.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,18 @@ services: | |
| # | ||
| # Fail fast if package install fails to avoid mysterious | ||
| # errors later. | ||
| command: bash -c 'npm ci || exit 1; while true; do npm start; sleep 2; done' | ||
| command: | ||
| - bash | ||
| - -c | ||
| - | | ||
| npm ci || exit 1 | ||
| if [ -n "$(printenv PARAGON_BRAND_PACKAGE)" ]; then | ||
| npx paragon install-theme "$(printenv PARAGON_BRAND_PACKAGE)" || exit 1 | ||
|
Comment on lines
+24
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks great; seems to work well locally. |
||
| fi | ||
| while true; do | ||
| npm start | ||
| sleep 2 | ||
| done | ||
| stdin_open: true | ||
| tty: true | ||
| image: node:18 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # This script sets up the edX theme in LMS and CMS. | ||
|
|
||
| REPO_URL="https://github.com/edx/edx-themes" | ||
| THEME_DIR="/edx/src/edx-themes/edx-platform" | ||
| DEVSTACK_FILE="../edx-platform/lms/envs/devstack.py" | ||
|
|
||
| # Clone the edx-themes repository into the src directory | ||
| cd ../src | ||
| if [ ! -d "edx-themes" ]; then | ||
| git clone "$REPO_URL" | ||
| else | ||
| echo "Directory 'edx-themes' already exists. Skipping clone." | ||
| fi | ||
| cd ../devstack | ||
|
|
||
| # Uncomment relevant lines in the devstack.py file | ||
| sed -i '' "s|^# from .common import _make_mako_template_dirs|from .common import _make_mako_template_dirs|" "$DEVSTACK_FILE" | ||
| sed -i '' "s|^# ENABLE_COMPREHENSIVE_THEMING = True|ENABLE_COMPREHENSIVE_THEMING = True|" "$DEVSTACK_FILE" | ||
| sed -i '' "s|^# COMPREHENSIVE_THEME_DIRS = \[|COMPREHENSIVE_THEME_DIRS = \[|" "$DEVSTACK_FILE" | ||
| sed -i '' "s|^# \"/edx/app/edxapp/edx-platform/themes/\"| \"/edx/app/edxapp/edx-platform/themes/\",|" "$DEVSTACK_FILE" | ||
| sed -i '' "/COMPREHENSIVE_THEME_DIRS = \[/a\\ | ||
| \"$THEME_DIR\", | ||
| " "$DEVSTACK_FILE" | ||
| sed -i '' "s|^# \]|]|" "$DEVSTACK_FILE" | ||
| sed -i '' "s|^# TEMPLATES\[1\]\[\"DIRS\"\] = _make_mako_template_dirs|TEMPLATES[1][\"DIRS\"] = _make_mako_template_dirs|" "$DEVSTACK_FILE" | ||
| sed -i '' "s|^# derive_settings(__name__)|derive_settings(__name__)|" "$DEVSTACK_FILE" | ||
|
|
||
|
|
||
| # Add the theme directory to COMPREHENSIVE_THEME_DIRS if not already present | ||
| if ! grep -qF "$THEME_DIR" "$DEVSTACK_FILE"; then | ||
| sed -i '' "/COMPREHENSIVE_THEME_DIRS = \[/a\\ | ||
| \"$THEME_DIR\", | ||
| " "$DEVSTACK_FILE" | ||
| fi | ||
|
|
||
| # Set the theme site-wide | ||
| SERVICE_NAME="mysql80" | ||
| DATABASE="edxapp" | ||
| THEME_NAME="edx.org-next" | ||
| SITE_ID=1 | ||
|
|
||
| docker compose exec -T "$SERVICE_NAME" mysql -e " | ||
| USE $DATABASE; | ||
| INSERT INTO theming_sitetheme (theme_dir_name, site_id) VALUES ('$THEME_NAME', $SITE_ID); | ||
| " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.