Skip to content

Commit b0bba28

Browse files
Merge pull request #188 from edx/michaelroytman/COSMO-683-private-npm-installs-edxapp-deploy
feat: add support for installing extra npm packages into edxapp
2 parents 6ac5bba + 3884b14 commit b0bba28

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

playbooks/roles/edxapp/defaults/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,11 @@ EDXAPP_PRIVATE_REQUIREMENTS:
580580
# Plugins
581581
- name: edx-arch-experiments==6.1.0
582582

583+
# List of additional npm packages that should be installed into the edxapp virtual environment.
584+
# For more help, see:
585+
# https://2u-internal.atlassian.net/wiki/spaces/AT/pages/396034066/How+to+add+private+requirements+to+edx-platform
586+
EDXAPP_PRIVATE_NPM_REQUIREMENTS: []
587+
583588
# List of custom middlewares that should be used in edxapp to process
584589
# incoming HTTP resquests. Should be a list of plain strings that fully
585590
# qualify Python classes or functions that can be used as Django middleware.

playbooks/roles/edxapp/tasks/deploy.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,20 @@
299299
- install
300300
- install:app-requirements
301301

302+
# --no-save is passed as a flag to npm install to avoid saving these dependencies to package.json. Otherwise,
303+
# running npm install without this flag causes modifications to the package.json and package-lock.json
304+
# files. In turn, these modified files cause issues with working with the edxapp repository.
305+
- name: Install private node dependencies
306+
shell: "easy_install --version && npm install --no-save {{ item.name }}"
307+
with_items: "{{ EDXAPP_PRIVATE_NPM_REQUIREMENTS }}"
308+
args:
309+
chdir: "{{ edxapp_code_dir }}"
310+
become_user: "{{ edxapp_user }}"
311+
when: "{{ EDXAPP_PRIVATE_NPM_REQUIREMENTS }} | length > 0"
312+
tags:
313+
- install
314+
- install:app-requirements
315+
302316
# The next few tasks set up the python code sandbox
303317

304318
# need to disable this profile, otherwise the pip inside the sandbox venv has no permissions

0 commit comments

Comments
 (0)