#200 into release@5.0.0 🧊 replace to core#238
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| "supertest": "^7.1.0", | ||
| "tsc-alias": "^1.8.10", | ||
| "typescript": "^5.7.3" | ||
| "typescript": "^5.8.3" |
There was a problem hiding this comment.
уже вышли новые версии пакетов, можно обновить тут сразу
There was a problem hiding this comment.
Оказывается у нас engines.node не соответствовал нашим зависимостям — суть в том, что node.engines ставят нижнюю планку, а у нас сделано так, как будто верхнюю. Короче, надо node.engines поменять на
"engines": {
"node": ">=18"
}
в соотв. с esbuild и body-parser. Ну и то же самое сделать в swc
There was a problem hiding this comment.
В соотв. с этим еще попросил нейронку скрипт сделать, чтобы она автоматически чекала всю эту тему и выкидывала ошибку в случае, если engines.node неправильный. Можно на push условный вызывать
#!/usr/bin/env bash
set -euo pipefail
project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
package_json="$project_root/package.json"
swcrc="$project_root/.swcrc"
min_version() {
if [[ -z "${1:-}" ]]; then
echo "${2:-}"
return
fi
if [[ -z "${2:-}" ]]; then
echo "${1:-}"
return
fi
printf '%s\n' "$1" "$2" | sort -V | head -n1
}
max_version() {
if [[ -z "${1:-}" ]]; then
echo "${2:-}"
return
fi
if [[ -z "${2:-}" ]]; then
echo "${1:-}"
return
fi
printf '%s\n' "$1" "$2" | sort -V | tail -n1
}
range_min() {
local range="$1"
local range_min=""
local cleaned="${range//||/|}"
IFS='|' read -ra segments <<< "$cleaned"
for segment in "${segments[@]}"; do
segment="$(echo "$segment" | xargs)"
[[ -z "$segment" ]] && continue
local versions
versions=$(grep -Eo '[0-9]+(\.[0-9]+){0,2}' <<< "$segment" || true)
[[ -z "$versions" ]] && continue
local segment_min
segment_min=$(printf '%s\n' $versions | sort -V | head -n1)
range_min=$(min_version "$range_min" "$segment_min")
done
echo "$range_min"
}
deps=$(jq -r '.dependencies // {} | keys[]' "$package_json")
missing=()
dependency_min=""
for dep in $deps; do
dep_path="$project_root/node_modules/$dep/package.json"
if [[ ! -f "$dep_path" ]]; then
missing+=("$dep")
continue
fi
dep_range=$(jq -r '.engines.node // empty' "$dep_path")
if [[ -n "$dep_range" ]]; then
dep_min=$(range_min "$dep_range")
dependency_min=$(max_version "$dependency_min" "$dep_min")
fi
done
code_min=""
if command -v rg >/dev/null 2>&1; then
if rg -q "['\"]node:[^'\"]+['\"]" "$project_root/src" "$project_root/bin" "$project_root/index.ts"; then
code_min="12.20.0"
fi
elif grep -Rqs "['\"]node:[^'\"]+['\"]" "$project_root/src" "$project_root/bin" "$project_root/index.ts"; then
code_min="12.20.0"
fi
required_min=$(max_version "$dependency_min" "$code_min")
recommended=""
if [[ -n "$required_min" ]]; then
recommended=">=$required_min"
fi
errors=()
if [[ ${#missing[@]} -gt 0 ]]; then
errors+=("Missing dependency package.json files: ${missing[*]}. Run yarn install first.")
fi
package_range=$(jq -r '.engines.node // empty' "$package_json")
if [[ -z "$package_range" ]]; then
errors+=("package.json engines.node is missing.")
else
package_min=$(range_min "$package_range")
if [[ -n "$required_min" ]]; then
lowest=$(printf '%s\n' "$package_min" "$required_min" | sort -V | head -n1)
if [[ "$lowest" != "$required_min" ]]; then
errors+=("package.json engines.node ($package_range) allows versions below $required_min.")
fi
fi
fi
if [[ ! -f "$swcrc" ]]; then
errors+=(".swcrc file is missing.")
elif [[ -n "$required_min" ]]; then
swc_node=$(jq -r '.env.targets.node // empty' "$swcrc")
if [[ -z "$swc_node" ]]; then
errors+=(".swcrc env.targets.node is missing or invalid.")
else
lowest=$(printf '%s\n' "$swc_node" "$required_min" | sort -V | head -n1)
if [[ "$lowest" != "$required_min" ]]; then
errors+=(".swcrc env.targets.node ($swc_node) is below $required_min.")
fi
fi
fi
if [[ ${#errors[@]} -gt 0 ]]; then
echo "Engine check failed:" >&2
for err in "${errors[@]}"; do
echo "- $err" >&2
done
[[ -n "$recommended" ]] && echo "Recommended engines.node: $recommended" >&2
exit 1
fi
if [[ -n "$recommended" ]]; then
echo "Engine check passed. Recommended engines.node: $recommended"
else
echo "Engine check passed."
fi
No description provided.