Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit 38d6bdf

Browse files
authored
adding the ability to include a custom header (banner) on generated files (#334)
1 parent ac6924e commit 38d6bdf

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ higher in your `tsconfig.json`. Note that the `eagerESModules` option from
7676
`relay-compiler` has no effect on the generated code if `module` is ES2015 or
7777
higher.*
7878

79+
#### Custom Headers
80+
81+
If you need to add a custom header to generated files, perhaps for a custom linter
82+
or to get boilerplate license code in, that can be passed in also in compilerOptions
83+
as `banner`:
84+
85+
```json
86+
{
87+
"compilerOptions": {
88+
"banner": "/* © 2021 Example.org - @generated code */"
89+
}
90+
}
91+
```
92+
7993
## Problems
8094

8195
### React Hot Loader

src/formatGeneratedModule.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ ${nodeStatement}
9090
export default node;
9191
`;
9292

93-
const content = `/* tslint:disable */
93+
const banner = compilerOptions.banner ? compilerOptions.banner + "\n" : "";
94+
const content = `${banner}/* tslint:disable */
9495
/* eslint-disable */
9596
// @ts-nocheck
9697
${hash ? `/* ${hash} */\n` : ""}

0 commit comments

Comments
 (0)