Skip to content

Commit

Permalink
Issue #14: Conditionally execute npm install if npx is being used. (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
deviantintegral authored Jul 26, 2024
2 parents fd3b8d5 + c0f5453 commit 78dde07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion commands/web/playwright
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ cd test/playwright || exit 1
if [ -f yarn.lock ]; then
yarn && yarn playwright "$@"
else
npx playwright "$@"
npm ci && npx playwright "$@"
fi
14 changes: 9 additions & 5 deletions web-build/disabled.Dockerfile.playwright
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,15 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
&& chown -R $username:$username /dot-cache \
&& sudo -u $username ln -s /dot-cache /home/$username/.cache \
&& cd /var/www/html/test/playwright \
&& ([ -f yarn.lock ] && export JS_PKG_MANAGER=yarn || export JS_PKG_MANAGER=npx \
&& sudo -u $username $JS_PKG_MANAGER \
&& sudo -u $username $JS_PKG_MANAGER playwright install-deps \
&& sudo -u $username $JS_PKG_MANAGER playwright install \
) \
&& if [ -f yarn.lock ]; then \
export JS_PKG_MANAGER=yarn; \
sudo -u $username $JS_PKG_MANAGER; \
else \
export JS_PKG_MANAGER=npx; \
sudo -u $username npm install; \
fi \
&& sudo -u $username $JS_PKG_MANAGER playwright install-deps \
&& sudo -u $username $JS_PKG_MANAGER playwright install \
&& rm -rf /var/www/html/test/playwright \
&& rm /home/$username/.cache \
&& sudo -u $username mkdir -p /home/$username/.cache \
Expand Down

0 comments on commit 78dde07

Please sign in to comment.