Merge pull request #195 from element-hq/t3chguy/no-link-modules
This commit is contained in:
@@ -6,6 +6,13 @@ WORKDIR /work
|
|||||||
# fonts-dejavu is needed for the same RTL rendering as on CI
|
# fonts-dejavu is needed for the same RTL rendering as on CI
|
||||||
RUN apt-get update && apt-get -y install docker.io fonts-dejavu
|
RUN apt-get update && apt-get -y install docker.io fonts-dejavu
|
||||||
|
|
||||||
|
# Set up corepack
|
||||||
|
RUN corepack enable
|
||||||
|
ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||||
|
|
||||||
|
# Add environment variable so consumers can skip developer-centric scripts
|
||||||
|
ENV PLAYWRIGHT_COMMON_DOCKER=1
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
|
||||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@element-hq/element-web-playwright-common",
|
"name": "@element-hq/element-web-playwright-common",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "2.2.6",
|
"version": "2.2.7",
|
||||||
"license": "SEE LICENSE IN README.md",
|
"license": "SEE LICENSE IN README.md",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -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,16 +93,17 @@ 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
|
||||||
TARGET=$(readlink -f "node_modules/$LINK") || true
|
for LINK in $SYMLINKS; do
|
||||||
if [ -d "$TARGET" ]; then
|
TARGET=$(readlink -f "node_modules/$LINK") || true
|
||||||
if [ -n "$docker_is_podman" ]; then
|
if [ -d "$TARGET" ]; then
|
||||||
echo -e "\033[31m" >&2
|
if [ -n "$docker_is_podman" ]; then
|
||||||
cat <<'EOF' >&2
|
echo -e "\033[31m" >&2
|
||||||
|
cat <<'EOF' >&2
|
||||||
WARNING: `node_modules` contains symlinks, and the support for this in
|
WARNING: `node_modules` contains symlinks, and the support for this in
|
||||||
`playwright-screenshots.sh` is broken under podman due to
|
`playwright-screenshots.sh` is broken under podman due to
|
||||||
https://github.com/containers/podman/issues/25947.
|
https://github.com/containers/podman/issues/25947.
|
||||||
@@ -104,12 +111,13 @@ https://github.com/containers/podman/issues/25947.
|
|||||||
If you get errors such as 'Error: crun: creating `<path>`', then retry this
|
If you get errors such as 'Error: crun: creating `<path>`', then retry this
|
||||||
having `yarn unlink`ed the relevant node modules.
|
having `yarn unlink`ed the relevant node modules.
|
||||||
EOF
|
EOF
|
||||||
echo -e "\033[0m" >&2
|
echo -e "\033[0m" >&2
|
||||||
|
fi
|
||||||
|
echo "mounting linked package ${LINK:2} in container"
|
||||||
|
RUN_ARGS+=( "-v" "$TARGET:/work/node_modules/${LINK:2}" )
|
||||||
fi
|
fi
|
||||||
echo "mounting linked package ${LINK:2} in container"
|
done
|
||||||
RUN_ARGS+=( "-v" "$TARGET:/work/node_modules/${LINK:2}" )
|
fi
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
Reference in New Issue
Block a user