Skip to content

fix(apply-release-plan): avoid using String.prototype.replace#1725

Merged
Andarist merged 7 commits intochangesets:mainfrom
colinaaa:main
Sep 9, 2025
Merged

fix(apply-release-plan): avoid using String.prototype.replace#1725
Andarist merged 7 commits intochangesets:mainfrom
colinaaa:main

Conversation

@colinaaa
Copy link
Contributor

@colinaaa colinaaa commented Sep 8, 2025

close: #1724

@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2025

🦋 Changeset detected

Latest commit: f31a4f4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@changesets/apply-release-plan Patch
@changesets/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov
Copy link

codecov bot commented Sep 8, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@ca0be26). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
packages/apply-release-plan/src/index.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1725   +/-   ##
=======================================
  Coverage        ?   80.69%           
=======================================
  Files           ?       54           
  Lines           ?     2264           
  Branches        ?      680           
=======================================
  Hits            ?     1827           
  Misses          ?      432           
  Partials        ?        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return;
}
const newChangelog = fileData.replace("\n", data);
const [header, ...oldChangelogLines] = fileData.split("\n");
Copy link
Member

Choose a reason for hiding this comment

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

Let's use indexOf('\n') + .slice(...) + data + .slice(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've changed the implementation. PTAL~

@colinaaa colinaaa requested a review from Andarist September 9, 2025 06:18
Comment on lines 335 to 336
fileData.slice(0, firstNewlineIdx) +
"\n" +
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this end up adding an extra newline that wasn't in the original newChangelog?

@Andarist Andarist merged commit 957f24e into changesets:main Sep 9, 2025
3 checks passed
@github-actions github-actions bot mentioned this pull request Sep 9, 2025
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.

Generating wrong changelog when there are special replacement patterns

3 participants