Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion commands/host/1x-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,18 @@ jq_compat() {
echo "Error: jq not found and docker is not available. Please install jq or docker." >&2
return 1
fi
}
}

# Exit with an error if the token in ~/.npmrc can't pull @dxp or @1xinternet packages.
check_registry_auth() {
local token group
token=$(grep -im1 '^//git\.1xinternet\.de.*:_authToken=' ~/.npmrc 2>/dev/null | cut -d= -f2- | tr -d '[:space:]"')
# 392 = @dxp, 4 = @1xinternet
for group in 392 4; do
curl -fsS --max-time 5 -H "PRIVATE-TOKEN: $token" -o /dev/null \
"https://git.1xinternet.de/api/v4/groups/$group/packages?package_type=npm&per_page=1" \
&& continue
echo "Error: GitLab token can't pull @dxp or @1xinternet packages." >&2
exit 1
done
}
2 changes: 2 additions & 0 deletions commands/host/1x-playwright-install
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ if [ -z "$DXP_REGISTRY" ] || [ "$DXP_REGISTRY" = "undefined" ]; then
exit 1
fi

check_registry_auth

echo -e "${GREEN}Installing playwright (within DDEV):${NC}"

if [ ! -f "${DDEV_APPROOT}/.ddev/web-build/disabled.Dockerfile.playwright" ]; then
Expand Down
2 changes: 2 additions & 0 deletions commands/host/1x-token-setup
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@ ddev exec "cat \$HOME/.npmrc"
# Restart so everything is fully synced.
ddev restart

check_registry_auth

echo "Setup complete!"