JSDoc banners
@ttsc/banner adds a fixed @packageDocumentation JSDoc banner to the top of every emitted file. Common case: a license / copyright line at the top of your published package.
Install
npm install -D @ttsc/bannerConfigure
Register the plugin in tsconfig.json:
// tsconfig.json
{
"compilerOptions": {
"plugins": [
{ "transform": "@ttsc/banner" }
]
}
}Drop a banner.config.ts next to tsconfig.json:
// banner.config.ts
import type { ITtscBannerConfig } from "@ttsc/banner";
export default {
text: "License MIT (c) 2026 Acme",
} satisfies ITtscBannerConfig;A banner.config.* file always exports an object with a text string.
Run ttsc. Every emitted .js and .d.ts gets:
/**
* License MIT (c) 2026 Acme
*
* @packageDocumentation
*/@ttsc/banner discovers its config by walking upward from the tsconfig directory, looking for banner.config.{ts,cts,mts,js,cjs,mjs,json}. To point at a specific file instead of relying on auto-discovery, set configFile on the tsconfig entry:
// tsconfig.json
{
"compilerOptions": {
"plugins": [
{ "transform": "@ttsc/banner", "configFile": "./config/banner.config.ts" }
]
}
}If no config file is found, the compile fails, banners are never silently skipped.
Common use cases
- License headers at the top of every file in a published library.
- Generated-file warnings:
"β οΈ Generated by codegen β do not edit by hand." - Build provenance:
"Built from commit @{COMMIT_SHA}"(interpolation is up to your build script; the banner plugin itself takes a fixed string).
See also
- @ttsc/paths: another emit-time plugin.
- @ttsc/strip: strip configured calls and
debuggerfrom the emit. - Plugin Development: write your own.
Last updated on