FIX: Cleanup node_modules when using non-default branch (#722)
authorDavid Taylor <david@taylorhq.com>
Tue, 4 Jul 2023 13:39:54 +0000 (14:39 +0100)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2023 13:39:54 +0000 (14:39 +0100)
Yarn seems to have issues 'downgrading' our set of packages from tests-passed (which are pre-installed in the base image) to the versions on the stable branch.

In the medium term we intend to switch to the pnpm package manager, which shouldn't have this issue. In the meantime, we can work around the problem by deleting the pre-installed node_modules and installing from scratch.

https://meta.discourse.org/t/270491

templates/web.template.yml

index 7d716cc2326c7daeb882e28996659912cc84bf07..12ba935650584bab2548260687ce14b978c06679 100644 (file)
@@ -171,6 +171,10 @@ run:
   - exec:
       cd: $home
       cmd:
+        - |-
+          if [ "$version" != "tests-passed" ]; then
+            rm -rf app/assets/javascripts/node_modules
+          fi
         - su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
 
   - exec: