Skip to content

#200 into release@5.0.0 🧊 replace to core#238

Open
debabin wants to merge 1 commit intorelease@5.0.0from
#200
Open

#200 into release@5.0.0 🧊 replace to core#238
debabin wants to merge 1 commit intorelease@5.0.0from
#200

Conversation

@debabin
Copy link
Copy Markdown
Member

@debabin debabin commented May 3, 2025

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@debabin debabin linked an issue May 3, 2025 that may be closed by this pull request
Comment thread package.json
"supertest": "^7.1.0",
"tsc-alias": "^1.8.10",
"typescript": "^5.7.3"
"typescript": "^5.8.3"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

уже вышли новые версии пакетов, можно обновить тут сразу

Comment thread package.json
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Оказывается у нас engines.node не соответствовал нашим зависимостям — суть в том, что node.engines ставят нижнюю планку, а у нас сделано так, как будто верхнюю. Короче, надо node.engines поменять на

"engines": {
    "node": ">=18"
  }

в соотв. с esbuild и body-parser. Ну и то же самое сделать в swc

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В соотв. с этим еще попросил нейронку скрипт сделать, чтобы она автоматически чекала всю эту тему и выкидывала ошибку в случае, если 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move intereceptors and logger logic in core

3 participants