Skip to content

Commit

Permalink
build: ensure that non-Tutor systems handle copy-node-modules.sh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kdmccormick committed Jul 20, 2023
1 parent a6f04d8 commit fb5383a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]

# 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
Expand Down
3 changes: 1 addition & 2 deletions pavelib/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fb5383a

Please sign in to comment.