Add --no-link-modules to playwright-screenshots.sh script

This commit is contained in:
Michael Telatynski
2026-02-12 14:54:33 +00:00
parent aadeb01f97
commit 82f185700e
@@ -56,6 +56,7 @@ RUN_ARGS=(
) )
DEFAULT_ARGS=(--grep @screenshot) DEFAULT_ARGS=(--grep @screenshot)
LINK_MODULES=true
# Some arguments to customise behaviour so the same script / image can be # Some arguments to customise behaviour so the same script / image can be
# re-used for other screenshot generation. # re-used for other screenshot generation.
@@ -72,6 +73,11 @@ while [[ $# -gt 0 ]]; do
RUN_ARGS+=(--mount "${mount_param}" -e YARN_INSTALL=true) RUN_ARGS+=(--mount "${mount_param}" -e YARN_INSTALL=true)
shift shift
;; ;;
# Disables the automatic detection & linking of node_modules which can clash with developer tooling e.g. pnpm-link
--no-link-modules)
LINK_MODULES=false
shift
;;
# Sets a different entrypoint (in which case the default arguments to the script will be ignored) # Sets a different entrypoint (in which case the default arguments to the script will be ignored)
--entrypoint) --entrypoint)
shift shift
@@ -87,11 +93,12 @@ done
build_image build_image
# Ensure we pass all symlinked node_modules to the container if [[ $LINK_MODULES == true ]]; then
pushd node_modules > /dev/null # Ensure we pass all symlinked node_modules to the container
SYMLINKS=$(find . -maxdepth 2 -type l -not -path "./.bin/*") pushd node_modules > /dev/null
popd > /dev/null SYMLINKS=$(find . -maxdepth 2 -type l -not -path "./.bin/*")
for LINK in $SYMLINKS; do popd > /dev/null
for LINK in $SYMLINKS; do
TARGET=$(readlink -f "node_modules/$LINK") || true TARGET=$(readlink -f "node_modules/$LINK") || true
if [ -d "$TARGET" ]; then if [ -d "$TARGET" ]; then
if [ -n "$docker_is_podman" ]; then if [ -n "$docker_is_podman" ]; then
@@ -109,7 +116,8 @@ EOF
echo "mounting linked package ${LINK:2} in container" echo "mounting linked package ${LINK:2} in container"
RUN_ARGS+=( "-v" "$TARGET:/work/node_modules/${LINK:2}" ) RUN_ARGS+=( "-v" "$TARGET:/work/node_modules/${LINK:2}" )
fi fi
done done
fi
# Our Playwright fixtures use Testcontainers [1], which uses a docker image # Our Playwright fixtures use Testcontainers [1], which uses a docker image
# called Ryuk [2], which will clean up any dangling containers/networks/etc # called Ryuk [2], which will clean up any dangling containers/networks/etc