Skip to content

fix: rename lib/rework.js to .cjs for ESM compat#846

Merged
bradygaster merged 1 commit intodevfrom
squad/fix-insider-esm-rework
Apr 5, 2026
Merged

fix: rename lib/rework.js to .cjs for ESM compat#846
bradygaster merged 1 commit intodevfrom
squad/fix-insider-esm-rework

Conversation

@bradygaster
Copy link
Copy Markdown
Owner

lib/rework.js uses module.exports (CJS) but Node treats .js as ESM due to type:module in root package.json. Same class of bug as #845. Renamed to .cjs and updated require() paths.

lib/rework.js uses module.exports (CJS) but Node treats .js as ESM
because root package.json has "type": "module". Rename to .cjs and
update require() paths in index.cjs and test/rework-rate.test.cjs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 5, 2026 08:48
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2026

🟡 Impact Analysis — PR #846

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 3
Files added 0
Files modified 3
Files deleted 0
Modules touched 2

🎯 Risk Factors

  • 3 files changed (≤5 → LOW)
  • 2 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (2 files)
  • index.cjs
  • lib/rework.cjs
tests (1 file)
  • test/rework-rate.test.cjs

This report is generated automatically for every PR. See #733 for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 5, 2026

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 6fdbf06

⚠️ 2 item(s) to address before review

Status Check Details
Single commit 1 commit — clean history
Not in draft Ready for review
Branch up to date Up to date with dev
Copilot review No Copilot review yet — it may still be processing
Changeset present No source files changed — changeset not required
Scope clean No .squad/ or docs/proposals/ files
No merge conflicts No merge conflicts
Copilot threads resolved No Copilot review threads
CI passing 16 check(s) still running

This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Renames the CommonJS rework helper module from lib/rework.js to lib/rework.cjs to avoid Node interpreting it as ESM under the repo’s root "type": "module", and updates all call sites accordingly.

Changes:

  • Added lib/rework.cjs (CommonJS) containing the rework calculation helpers.
  • Updated index.cjs to require('./lib/rework.cjs').
  • Updated test/rework-rate.test.cjs to import the helpers from lib/rework.cjs.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
test/rework-rate.test.cjs Updates test import path to the renamed CommonJS module.
lib/rework.cjs Provides the CommonJS rework calculation helpers under a .cjs extension for ESM compatibility.
index.cjs Updates the CLI entry to require the .cjs module explicitly.

@bradygaster bradygaster merged commit 029728a into dev Apr 5, 2026
22 checks passed
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.

2 participants