fix: backward-compat for ESM etherpad#81
Conversation
- Migrate log4js to ep_plugin_helpers/logger Backward-compatible with current CJS etherpad release; also compatible with the upcoming ESM etherpad branch which has stricter exports map resolution.
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Review Summary by QodoMigrate to ep_plugin_helpers logger for ESM compatibility
WalkthroughsDescription• Migrate logging from direct log4js require to ep_plugin_helpers/logger • Ensures ESM etherpad compatibility with stricter exports resolution • Maintains backward compatibility with current CJS etherpad release • Add ep_plugin_helpers dependency and bump version to 1.0.50 Diagramflowchart LR
A["Direct log4js require"] -->|"Replace with"| B["ep_plugin_helpers/logger"]
B -->|"Supports"| C["ESM etherpad"]
B -->|"Supports"| D["CJS etherpad"]
File Changes1. index.js
|
Code Review by Qodo
1. No regression test for logger
|
| const {createLogger} = require('ep_plugin_helpers/logger'); | ||
|
|
||
| const logger = log4js.getLogger('ep_disable_imports'); | ||
| const logger = createLogger('ep_disable_imports'); |
There was a problem hiding this comment.
1. No regression test for logger 📘 Rule violation ☼ Reliability
This PR changes the logging import to restore compatibility with upcoming ESM Etherpad, but it does not add/update any regression test to verify the fix. Without a test, this compatibility behavior can silently regress in future changes.
Agent Prompt
## Issue description
A bug-fix/compatibility change was made (switching from `log4js` to `ep_plugin_helpers/logger`) without adding a regression test in the same commit.
## Issue Context
The project currently has no test script, so the fix is not automatically verifiable and could regress undetected.
## Fix Focus Areas
- index.js[4-6]
- package.json[6-9]
- test/logger-compat.test.js[1-120]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| }, | ||
| "dependencies": { | ||
| "ep_plugin_helpers": "^0.6.7" | ||
| } |
There was a problem hiding this comment.
2. Lockfile not updated 🐞 Bug ☼ Reliability
package.json adds the ep_plugin_helpers runtime dependency but pnpm-lock.yaml still has no corresponding dependency entry, so pnpm i --frozen-lockfile will fail. This can block the automated release workflow (and any other frozen-lockfile installs).
Agent Prompt
## Issue description
`package.json` now declares a new runtime dependency (`ep_plugin_helpers`), but `pnpm-lock.yaml` was not regenerated. Any CI/release step that runs `pnpm i --frozen-lockfile` will error due to the lockfile being out of sync with `package.json`.
## Issue Context
The release workflow explicitly installs with a frozen lockfile, which requires the lockfile to exactly match `package.json`.
## Fix Focus Areas
- package.json[33-39]
- pnpm-lock.yaml[7-20]
- .github/workflows/npmpublish.yml[54-73]
## What to change
1. Run `pnpm install` in the repo root to regenerate `pnpm-lock.yaml`.
2. Commit the resulting `pnpm-lock.yaml` changes (it should include `ep_plugin_helpers@^0.6.7` under the root importer dependencies and in the `packages:` section).
3. Re-run CI/release checks to confirm `pnpm i --frozen-lockfile` succeeds.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This PR makes the plugin backward-compatible with the upcoming ESM etherpad branch (ether/etherpad#7605).
Change: Migrate log4js from
require("ep_etherpad-lite/node_modules/log4js")toep_plugin_helpers/loggerThis change is backward-compatible with the current CJS etherpad release.