From fb5383a10880adea3372157b332126979f8df26a Mon Sep 17 00:00:00 2001 From: "Kyle D. McCormick" Date: Mon, 17 Jul 2023 16:57:49 -0400 Subject: [PATCH] build: ensure that non-Tutor systems handle copy-node-modules.sh Two fixes: * In the (in-repo, non-Tutor) Dockerfile, add copy-node-modules.sh before `npm install`, since it is needed by the new postinstall hook. * In paver/assets.py, run copy-node-modules.sh for backwards com- patibility, just for cases where `SKIP_NPM_INSTALL` is enabled (which would prevent our new postinstall hook from running automatically!). We will deprecate the paver asset commands all at once once the new non-paver stuff is 100% working. --- Dockerfile | 9 ++++++++- pavelib/assets.py | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e77dd47473a8..4cd817caeb5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -115,9 +115,16 @@ COPY requirements requirements RUN pip install -r requirements/pip.txt RUN pip install -r requirements/edx/base.txt -# Install node and node modules +# Install node and npm RUN nodeenv /edx/app/edxapp/nodeenv --node=16.14.0 --prebuilt RUN npm install -g npm@8.5.x + +# This script is used by an npm post-install hook. +# We copy it into the image now so that it will be available when we run `npm install` in the next step. +# The script itself will copy certain modules into some uber-legacy parts of edx-platform which still use RequireJS. +COPY scripts/copy-node-modules.sh scripts/copy-node-modules.sh + +# Install node modules COPY package.json package.json COPY package-lock.json package-lock.json RUN npm set progress=false && npm ci diff --git a/pavelib/assets.py b/pavelib/assets.py index 8b1b4e706546..566092a2666e 100644 --- a/pavelib/assets.py +++ b/pavelib/assets.py @@ -611,8 +611,7 @@ def process_npm_assets(): """ Process vendor libraries installed via NPM. """ - print("\t\tProcessing NPM assets is now done automatically in an npm post-install hook.") - print("\t\tThis function is now a no-op.") + sh('scripts/copy-node-modules.sh') @task