From 3384f2c71c19c8d551ff3151221afed5f530562d Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 9 Sep 2024 11:13:18 +0100 Subject: [PATCH] Improve node_modules cleanup logic for stable branch (#869) - makes decision based on current state of directory, instead of `$version` - cleans up the correct directories - only cleans up the contents. This is important if node_modules directores are mounted volumes (e.g. in devcontainer) --- templates/web.template.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/web.template.yml b/templates/web.template.yml index d2f67d2..81472f2 100644 --- a/templates/web.template.yml +++ b/templates/web.template.yml @@ -181,12 +181,12 @@ run: cd: $home hook: yarn cmd: - - |- - if [ "$version" != "tests-passed" ]; then - rm -rf app/assets/javascripts/node_modules - fi - |- if [ -f yarn.lock ]; then + if [ -d node_modules/.pnpm ]; then + echo "This version of Discourse uses yarn, but pnpm node_modules are preset. Cleaning up..." + find ./node_modules ./app/assets/javascripts/*/node_modules -mindepth 1 -maxdepth 1 -exec rm -rf {} + + fi su discourse -c 'yarn install --frozen-lockfile && yarn cache clean' else su discourse -c 'CI=1 pnpm install --frozen-lockfile' -- 2.25.1