Skip to content

fix: preserve CRLF when rewriting the README size table - #108

Open
rajverrr wants to merge 1 commit into
adityareddy-dev:mainfrom
rajverrr:fix/preserve-crlf-size-table
Open

rajverrr wants to merge 1 commit into
adityareddy-dev:mainfrom
rajverrr:fix/preserve-crlf-size-table

Conversation

@rajverrr

Copy link
Copy Markdown

Resolves #99

Summary

replaceTable() in scripts/size-table.mjs joined the replacement table (formatted with LF by formatTable()) directly into the surrounding text, causing mixed line endings when README.md uses CRLF.

Changes

  • Updated replaceTable() to detect if the existing <!-- size:start --> ... <!-- size:end --> block uses CRLF and convert the replacement table to match, while keeping surrounding text byte-for-byte.
  • In packages/core/test/size.test.ts, covered both LF and CRLF replacements, verified surrounding text remains unchanged, and confirmed problems() accepts the rewritten table.

Verification

  • Verified with the issue reproduction snippet: prints false (no mixed LF).
  • node --import ./packages/core/test/ts-imports.ts --test packages/core/test/size.test.ts (4/4 passing)
  • npm run test:unit (674/674 passing)
  • npm run typecheck (passed with no errors)
  • git diff --check (clean)

This branch has not been deployed

No deployments
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.

preserve CRLF when rewriting the README size table

2 participants