Skip to content

Conversation

kevinansfield
Copy link
Member

no issue

  • codifying our patches purpose and how to update patches as needed

no issue

- codifying our patches purpose and how to update patches as needed
Copy link
Contributor

coderabbitai bot commented Aug 12, 2025

Walkthrough

Adds patches/README.md documenting patch-package usage. Describes an existing esm+3.2.25.patch that replaces esm with esm-wallaby to support Node.js 22.10.0–22.16.x for the Admin’s Ember.js build. Provides step-by-step workflow to update the patch (remove old patch, fetch/extract esm-wallaby, copy esm.js/loader.js into node_modules/esm, run npx patch-package esm, cleanup). Explains automatic application via postinstall after yarn install. Outlines procedures to create new patches and to update existing ones, including testing guidance.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-patches-readme

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@kevinansfield kevinansfield enabled auto-merge (squash) August 12, 2025 17:05
@kevinansfield kevinansfield merged commit ff30f63 into main Aug 12, 2025
22 of 23 checks passed
@kevinansfield kevinansfield deleted the add-patches-readme branch August 12, 2025 17:05
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
patches/README.md (4)

7-12: Clarify/version-proof the Node.js compatibility statement.

Hard-coding “Node.js 22.10.0 to 22.16.x” will go stale. Prefer linking to an upstream issue/changelog, or soften to “Node.js 22.x (tested on 22.10–22.16)” so we don’t need to constantly update docs.


15-22: Make the update script safer and reproducible (pin version, handle missing files).

  • Use rm -f to avoid errors if the patch doesn’t exist.
  • Pin esm-wallaby version for reproducibility (avoid pulling a moving latest).
  • Ensure node_modules/esm exists before copying; nudge to run yarn install first.
  • Fail fast on errors.

Apply this diff to replace the script:

-```bash
-rm patches/esm+3.2.25.patch
-dest=esm-wallaby && mkdir -p "$dest" && curl -sL "$(npm view esm-wallaby dist.tarball)" | tar -xz -C "$dest" --strip-components=1
-cp "esm-wallaby/esm.js" "node_modules/esm/esm.js"
-cp "esm-wallaby/esm/loader.js" "node_modules/esm/esm/loader.js"
-npx patch-package esm
-rm -rf esm-wallaby
-```
+```bash
+set -euo pipefail
+
+# Ensure dependencies (including esm) are installed
+test -d node_modules/esm || { echo "node_modules/esm not found. Run: yarn install"; exit 1; }
+
+# Remove old patch if present
+rm -f patches/esm+3.2.25.patch
+
+# Pin esm-wallaby version for reproducibility (update as needed)
+WALLABY_VER="${WALLABY_VER:-3.2.25}"
+dest="esm-wallaby-${WALLABY_VER}"
+mkdir -p "$dest"
+curl -sL "$(npm view "esm-wallaby@${WALLABY_VER}" dist.tarball)" | tar -xz -C "$dest" --strip-components=1
+
+# Copy files into esm package
+install -m 0644 "${dest}/esm.js" "node_modules/esm/esm.js"
+install -m 0644 "${dest}/esm/loader.js" "node_modules/esm/esm/loader.js"
+
+# Generate patch
+npx patch-package esm
+
+# Cleanup
+rm -rf "$dest"
+```

34-45: Add a note to validate application and minimize diffs.

  • After generating a patch, run yarn install once to ensure the patch applies cleanly via postinstall.
  • Keep patch scope minimal (avoid committing build artifacts or unrelated changes within node_modules).

46-57: Call out filename/version changes and test across Node versions.

  • The generated patch filename will change with the dependency version (e.g., esm+X.Y.Z.patch); commit the new file and remove the old.
  • Explicitly test on the Node.js versions we support (including 22.x) to ensure the patch still resolves the original issue.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68e768d and 2b6bcca.

📒 Files selected for processing (1)
  • patches/README.md (1 hunks)

Comment on lines +26 to +33
Patches are automatically applied after `yarn install` runs via the `postinstall` script defined in `package.json`:

```json
"postinstall": "patch-package"
```

This ensures that any modified dependencies are consistently patched across all environments (development, CI, production).

Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Ensure patch-package runs in all environments that install dependencies.

If patches must apply in production builds/containers, patch-package should be available when postinstall runs. Verify:

  • package.json has "postinstall": "patch-package"
  • patch-package is installed where postinstall can find it (often as a non-dev dependency if production installs omit devDependencies)

Run the script to confirm:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Checking postinstall hook..."
fd -t f package.json -d 2 | while read -r f; do
  echo "File: $f"
  jq -r '.scripts.postinstall // empty' "$f" | sed 's/^/  postinstall: /'
done

echo
echo "Checking where patch-package is declared..."
fd -t f package.json -d 2 | while read -r f; do
  if jq -e '.dependencies["patch-package"]' "$f" >/dev/null; then
    echo "patch-package in dependencies of $f"
  elif jq -e '.devDependencies["patch-package"]' "$f" >/dev/null; then
    echo "patch-package in devDependencies of $f"
  fi
done

Length of output: 955


Ensure patch-package is available in all install environments

Patching is wired up via the postinstall hook, but in production builds where devDependencies are omitted, patch-package won’t be installed and your patches won’t apply. Please update:

• package.json (root)
– Move patch-package from devDependencies into dependencies so it’s present on production installs.
Example diff:

 "devDependencies": {
-    "patch-package": "^6.5.1",
+    // remove patch-package from here
 },
 // …
 "dependencies": {
+    "patch-package": "^6.5.1",
   // other runtime deps
 }

• e2e/package.json (if e2e runs its own yarn install)
– Add the same postinstall script and ensure patch-package is installed if you need patches applied in that context.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In patches/README.md around lines 26 to 33, the docs note patches run in
postinstall but don’t address that patch-package may be absent in production
installs; update the project manifests so patch-package is always present where
needed: move patch-package from root package.json devDependencies into
dependencies (so it’s installed in production builds), and if e2e runs its own
install, add the same postinstall script and add patch-package to
e2e/package.json dependencies (or ensure it’s installed in that install
environment) so patches are applied consistently.

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.

1 participant