Skip to content

Commit 87871bc

Browse files
Make compatible with pnpm (#854)
Switches behavior based on the presence of `yarn.lock` See discourse/discourse#28671
1 parent fe48fa2 commit 87871bc

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

image/base/release.Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ RUN cd /var/www/discourse &&\
1010
sudo -u discourse bundle config --local path ./vendor/bundle &&\
1111
sudo -u discourse bundle config --local without test development &&\
1212
sudo -u discourse bundle install --jobs $(($(nproc) - 1)) &&\
13-
sudo -u discourse yarn install --frozen-lockfile &&\
14-
sudo -u discourse yarn cache clean &&\
13+
sudo -u discourse /bin/bash -c 'if [ -f yarn.lock ]; then yarn install --frozen-lockfile && yarn cache clean; else pnpm install --frozen-lockfile; fi' &&\
1514
find /var/www/discourse/vendor/bundle -name cache -not -path '*/gems/*' -type d -exec rm -rf {} + &&\
1615
find /var/www/discourse/vendor/bundle -name tmp -type d -exec rm -rf {} +

image/discourse_dev/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ RUN --mount=type=bind,src=/repo,from=repo-fetcher,target=/tmp/discourse-clone,re
7373
# Warm global yarn cache
7474
RUN --mount=type=bind,src=/repo,from=repo-fetcher,target=/tmp/discourse-clone,readwrite \
7575
cd /tmp/discourse-clone \
76-
&& yarn install
76+
&& (if [ -f yarn.lock ]; then yarn install; else pnpm install; fi)
7777

7878
USER root

image/discourse_test/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ FROM with_browsers AS release
3030

3131
RUN cd /var/www/discourse &&\
3232
sudo -u discourse bundle install --jobs $(($(nproc) - 1)) &&\
33-
sudo -E -u discourse -H yarn install &&\
34-
sudo -u discourse yarn cache clean
33+
sudo -E -u discourse -H /bin/bash -c 'if [ -f yarn.lock ]; then (yarn install && yarn cache clean); else pnpm install; fi'
3534

3635
RUN cd /var/www/discourse && sudo -E -u discourse -H bundle exec rake plugin:install_all_official &&\
3736
LOAD_PLUGINS=1 sudo -E -u discourse -H bundle exec rake plugin:install_all_gems &&\

launcher_go/v2/test/templates/web.template.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ run:
184184
if [ "$version" != "tests-passed" ]; then
185185
rm -rf app/assets/javascripts/node_modules
186186
fi
187-
- su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
187+
- |-
188+
if [ -f yarn.lock ]; then
189+
su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
190+
else
191+
su discourse -c 'pnpm install --frozen-lockfile'
192+
fi
188193
189194
- exec:
190195
cd: $home

templates/web.template.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,12 @@ run:
185185
if [ "$version" != "tests-passed" ]; then
186186
rm -rf app/assets/javascripts/node_modules
187187
fi
188-
- su discourse -c 'yarn config set network-timeout 60000 -g'
189-
- su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
188+
- |-
189+
if [ -f yarn.lock ]; then
190+
su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
191+
else
192+
su discourse -c 'pnpm install --frozen-lockfile'
193+
fi
190194
191195
- exec:
192196
cd: $home

0 commit comments

Comments
 (0)