Skip to content

fix(changelog): handle frozen commit objects from conventional-changelog-writer#1046

Merged
sarahdayan merged 2 commits intomainfrom
fix/changelog-immutable-object
Feb 5, 2026
Merged

fix(changelog): handle frozen commit objects from conventional-changelog-writer#1046
sarahdayan merged 2 commits intomainfrom
fix/changelog-immutable-object

Conversation

@sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Feb 5, 2026

Summary

  • Fix "Cannot modify immutable object" error during changelog generation

Problem

The conventional-changelog-writer library freezes commit objects, but presets like angular expect to mutate them in their transform function (e.g., commit.type = 'Bug Fixes'). This causes the error:

Error: Cannot modify immutable object.
    at Object.set (conventional-changelog-writer/dist/commit.js:15:19)
    at transform (conventional-changelog-angular/writerOpts.js:40:21)

Solution

Add a wrapTransform helper that deep clones commits before passing them to the original transform function, allowing mutation while preserving the original frozen objects.

The preset config objects may be frozen. Create shallow copies before
passing to conventional-changelog-core to avoid "Cannot modify
immutable object" error.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sarahdayan sarahdayan marked this pull request as draft February 5, 2026 12:38
@sarahdayan sarahdayan changed the title fix: spread parserOpts and writerOpts to avoid immutable object error fix(changelog): handle frozen commit objects from conventional-changelog-writer Feb 5, 2026
…log-writer

The conventional-changelog-writer library freezes commit objects, but
presets like angular expect to mutate them. This causes a "Cannot modify
immutable object" error when the transform function tries to change
commit.type.

Add a wrapTransform helper that deep clones commits before passing them
to the original transform function, allowing mutation while preserving
the original frozen objects.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sarahdayan sarahdayan force-pushed the fix/changelog-immutable-object branch from 868a7bc to 4a65f39 Compare February 5, 2026 12:44
@sarahdayan sarahdayan marked this pull request as ready for review February 5, 2026 12:47
@sarahdayan sarahdayan requested review from a team, aymeric-giraudet and shaejaz and removed request for a team February 5, 2026 12:47
@sarahdayan sarahdayan merged commit 5eb2487 into main Feb 5, 2026
7 checks passed
@sarahdayan sarahdayan deleted the fix/changelog-immutable-object branch February 5, 2026 12:53
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