Skip to content

chore: add NPM aliases installation to deployment process #230

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

Merged

Conversation

ttak-apphelix
Copy link
Member

@ttak-apphelix ttak-apphelix commented Aug 1, 2025

Description

This PR replaces brand-edx.org with openedx theme and adds it to the package file indirectly via aliasing.

Supporting information

Issue Link: edx/edx-arch-experiments#943

private JIRA link:
https://2u-internal.atlassian.net/browse/BOMS-101

Related PR:
openedx/edx-platform#37105

@ttak-apphelix ttak-apphelix marked this pull request as ready for review August 5, 2025 09:51
@Copilot Copilot AI review requested due to automatic review settings August 5, 2025 09:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds NPM aliases installation to the deployment process for the edxapp role. It allows for installing NPM packages with specific aliasing to support package name mapping during deployment.

  • Adds a new Ansible task to install NPM aliases using a configurable dictionary
  • Introduces default configuration for NPM aliases with an example mapping for @edx/brand

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
playbooks/roles/edxapp/tasks/deploy.yml Adds new task to install NPM aliases from configurable dictionary
playbooks/roles/edxapp/defaults/main.yml Defines default NPM_ALIASES configuration with @edx/brand example
Comments suppressed due to low confidence (2)

playbooks/roles/edxapp/defaults/main.yml:1138

  • The variable name NPM_ALIASES uses inconsistent naming convention. It should follow the pattern of other variables in this file and be named 'EDXAPP_NPM_ALIASES' to maintain consistency with the module prefix.
NPM_ALIASES:

playbooks/roles/edxapp/tasks/deploy.yml:324

  • The variable reference NPM_ALIASES should be updated to match the consistent naming convention. If the variable is renamed to EDXAPP_NPM_ALIASES, this reference should be updated accordingly.
  with_dict: "{{ NPM_ALIASES }}"

Comment on lines +318 to +321
shell: >
npm install {{ item.key }}@{{ item.value }} --no-save
args:
chdir: "{{ edxapp_code_dir }}"
Copy link
Preview

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the 'shell' module for npm commands is discouraged. Consider using the 'npm' module instead, which provides better error handling and idempotency: 'npm: name={{ item.key }}@{{ item.value }} path={{ edxapp_code_dir }} state=present'

Suggested change
shell: >
npm install {{ item.key }}@{{ item.value }} --no-save
args:
chdir: "{{ edxapp_code_dir }}"
npm:
name: "{{ item.key }}@{{ item.value }}"
path: "{{ edxapp_code_dir }}"
state: present

Copilot uses AI. Check for mistakes.

@ttak-apphelix ttak-apphelix requested a review from robrap August 5, 2025 10:13
@robrap
Copy link
Contributor

robrap commented Aug 15, 2025

@ttak-apphelix:

  1. There is no PR description, or related ticket. Can you provide more context?
  2. This doesn't seem to have gone through internal review first.
  3. When it is ready for external review, it may make sense for @dianakhuang to review. She is working on something similar, if this is for deployment of a private NPM dependency, but I'm not clear on the context.

@@ -314,6 +314,18 @@
- install
- install:app-requirements

- name: Install NPM aliases
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can be a minor comment just above the whole task here for explaining why this task is needed.

Something along the lines of

This task is added as part of changes done for PR_LINK

@chintanjoshi-apphelix-2u chintanjoshi-apphelix-2u merged commit 5ff5012 into master Aug 19, 2025
3 checks passed
@chintanjoshi-apphelix-2u chintanjoshi-apphelix-2u deleted the ttak-apphelix/add-npm-aliases-for-edxapp branch August 19, 2025 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants