Skip to content

Commit c271d16

Browse files
authored
Add a header comment to devsite md files. (#5865)
* Add a header comment to devsite md files. * formatting
1 parent e0f23d6 commit c271d16

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

scripts/docgen/docgen.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,21 @@ import { mapWorkspaceToPackages } from '../release/utils/workspace';
2020
import { projectRoot } from '../utils';
2121
import fs from 'fs';
2222
import glob from 'glob';
23+
import { join } from 'path';
2324
import * as yargs from 'yargs';
2425

26+
/**
27+
* Add to devsite files to alert anyone trying to make a documentation fix
28+
* to the generated files.
29+
*/
30+
const GOOGLE3_HEADER = `{% comment %}
31+
DO NOT EDIT THIS FILE!
32+
This is generated by the JS SDK team, and any local changes will be
33+
overwritten. Changes should be made in the source code at
34+
https://github.com/firebase/firebase-js-sdk
35+
{% endcomment %}
36+
`;
37+
2538
const tmpDir = `${projectRoot}/temp`;
2639

2740
yargs
@@ -101,6 +114,15 @@ async function generateDocs(forDevsite: boolean = false) {
101114
{ stdio: 'inherit' }
102115
);
103116

117+
if (forDevsite) {
118+
const mdFiles = fs.readdirSync(join(projectRoot, outputFolder));
119+
for (const mdFile of mdFiles) {
120+
const fullPath = join(projectRoot, outputFolder, mdFile);
121+
const content = fs.readFileSync(fullPath, 'utf-8');
122+
fs.writeFileSync(fullPath, GOOGLE3_HEADER + content);
123+
}
124+
}
125+
104126
moveRulesUnitTestingDocs(outputFolder, command);
105127
}
106128

0 commit comments

Comments
 (0)