Skip to content

Commit 3384f2c

Browse files
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)
1 parent 34f016a commit 3384f2c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

templates/web.template.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ run:
181181
cd: $home
182182
hook: yarn
183183
cmd:
184-
- |-
185-
if [ "$version" != "tests-passed" ]; then
186-
rm -rf app/assets/javascripts/node_modules
187-
fi
188184
- |-
189185
if [ -f yarn.lock ]; then
186+
if [ -d node_modules/.pnpm ]; then
187+
echo "This version of Discourse uses yarn, but pnpm node_modules are preset. Cleaning up..."
188+
find ./node_modules ./app/assets/javascripts/*/node_modules -mindepth 1 -maxdepth 1 -exec rm -rf {} +
189+
fi
190190
su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
191191
else
192192
su discourse -c 'CI=1 pnpm install --frozen-lockfile'

0 commit comments

Comments
 (0)