Skip to content

release: v2.5.0 - rewriteDeclarationCopies restamps tsc-copied… - #204

Merged
cldmv-bot[bot] merged 7 commits into
masterfrom
next
Nov 25, 2026
Merged

cldmv-bot[bot] merged 7 commits into
masterfrom
next

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

@cldmv/fix-headers v2.5.0 Changelog

Release Date: November 2026
Release Type: Minor
Branch: release/2.5.0


Overview

Generated TypeScript declarations get a header of their own. tsc copies a source file's header into the .d.ts / .d.mts / .d.cts it emits, so the declaration an IDE shows named the source file. fix-headers now restamps such a declaration for the path and package it ships in, keeping the source's dates and author. This is the setup for packages that build types/ in CI or prepack instead of committing it.


✨ Features

Generated declarations are restamped for where they ship (#202)

A declaration whose header names its own source (types/src/x.d.mts with @Filename: src/x.mts) gets @Filename: types/src/x.d.mts and its package's @Project. @Date, @Author, @Last modified by and @Last modified time stay as the source's header has them, since a generated file has no git history of its own. A staged package folder with its own package.json is its own project root, so dist-packages/x-types/lib/x.d.mts gets @Filename: lib/x.d.mts and that package's name. Run fix-headers after tsc, for example fix-headers --input types in prepack or CI.

A later run leaves a restamped declaration as it is when git doesn't track it: a declaration with a header that git doesn't track is treated as generated, so it keeps the editor and dates it carries instead of taking the runner and the current time.

rewriteDeclarationCopies: false (CLI --no-rewrite-declaration-copies) keeps the 2.4.0 behaviour of skipping these declarations, for repos that still commit types/.

Fixes #201.

📚 Documentation

  • NEW: docs/changelog/v2/v2.5.0.md: this changelog.
  • README: the rewriteDeclarationCopies option and --rewrite-declaration-copies / --no-rewrite-declaration-copies flags, and the generated-declaration rule (#202).
  • README What's New promoted to v2.5.0.

🔧 Dependencies

No dependency updates.


Upgrade notes

  • Repos that commit generated types/: set "rewriteDeclarationCopies": false in the fix-headers config. Otherwise fix-headers and tsc rewrite each other's @Filename on every build, as before 2.4.0. The better fix is to gitignore types/ and build it in CI and prepack.
  • Repos that don't run fix-headers on declaration files see no change.
👥 Contributors

coverage

Metric Coverage
Statements 99.9%
Branches 98.9%
Functions 100.0%
Lines 99.9%

Avg: 99.6% · 9f69cbb · Node lts/*

Co-authored-by: Shinrai [email protected]

Shinrai and others added 6 commits November 25, 2026 13:54
For packages that build types/ in CI or prepack instead of committing it.
With rewriteDeclarationCopies (--rewrite-declaration-copies), a .d.ts /
.d.mts / .d.cts carrying tsc's copy of its own source's header is
restamped instead of skipped: @filename and @project follow the path and
package it ships in (a staged package folder with its own package.json is
its own project root), and @Date, @author, @last modified by and
@last modified time stay as the source's header has them. Skipping stays
the default.

Resolves #201
Generated declarations are what an IDE shows, so they get a header for the
path and package they ship in by default. rewriteDeclarationCopies: false
(--no-rewrite-declaration-copies) skips them, for repos that still commit
types/; this repo sets it until its types/ moves out of git.

Resolves #201
A gitignored declaration counted as edited on every run, so a second run
restamped it with the runner and the current time. A declaration git does
not track that already has a header is now treated as generated and keeps
the editor and dates it carries.
Generated declarations are what an IDE shows, so a
`.d.ts`/`.d.mts`/`.d.cts` carrying `tsc`'s copy of its source's header
now gets a header for where it ships: `@Filename: types/src/x.d.mts` and
that package's `@Project`. A staged package folder with its own
`package.json` is its own root, so `dist-packages/x-types/lib/x.d.mts`
gets `@Filename: lib/x.d.mts`. `@Date`, `@Author`, `@Last modified by`
and `@Last modified time` are kept from the source's header, and a later
run leaves a restamped declaration that git doesn't track as it is,
since the generated file has no git history.

`rewriteDeclarationCopies: false` (`--no-rewrite-declaration-copies`)
keeps the 2.4.0 skip for repos that still commit `types/`. This repo
sets it until its own `types/` moves out of git.

Resolves #201
@cldmv-bot cldmv-bot Bot added ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: minor This release adds new functionality in a backwards-compatible way type: bug Something is broken or not behaving as expected type: feature Implements new functionality — a PR or issue that adds a feature labels Nov 25, 2026
@cldmv-bot

cldmv-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

🔒 Dependency Review

  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses
  • ✅ 0 denied package(s)
  • ✅ 0 package(s) with OpenSSF Scorecard score < 3

Full job summary

@cldmv-bot cldmv-bot Bot added area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 25, 2026
@cldmv-bot

cldmv-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Bundle size increased

File Raw Δ Raw Gzipped Δ Gzipped
bin/fix-headers.mjs 62.9 kB +739 B (+1.2%) ⚠️ 21.7 kB +243 B
dist/index.cjs 1.8 kB — 1012 B —
dist/index.mjs 52.4 kB +259 B (+0.5%) 18.4 kB +125 B
Total 117.1 kB +998 B 41.1 kB +368 B

📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.

Release notes for v2.5.0: `docs/changelog/v2/v2.5.0.md` covering #202,
and README What's New promoted to v2.5.0 (v2.4.0 moves into Recent
Releases, v2.2.5 drops off).
@cldmv-bot
cldmv-bot Bot merged commit 254be05 into master Nov 25, 2026
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: minor This release adds new functionality in a backwards-compatible way type: bug Something is broken or not behaving as expected type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments type: feature Implements new functionality — a PR or issue that adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to rewrite headers on generated declarations for the layout they ship in

1 participant