Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a header comment to devsite md files. #5865

Merged
merged 2 commits into from Jan 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions scripts/docgen/docgen.ts
Expand Up @@ -20,8 +20,21 @@ import { mapWorkspaceToPackages } from '../release/utils/workspace';
import { projectRoot } from '../utils';
import fs from 'fs';
import glob from 'glob';
import { join } from 'path';
import * as yargs from 'yargs';

/**
* Add to devsite files to alert anyone trying to make a documentation fix
* to the generated files.
*/
const GOOGLE3_HEADER = `{% comment %}
DO NOT EDIT THIS FILE!
This is generated by the JS SDK team, and any local changes will be
overwritten. Changes should be made in the source code at
https://github.com/firebase/firebase-js-sdk
{% endcomment %}
`;

const tmpDir = `${projectRoot}/temp`;

yargs
Expand Down Expand Up @@ -101,6 +114,15 @@ async function generateDocs(forDevsite: boolean = false) {
{ stdio: 'inherit' }
);

if (forDevsite) {
const mdFiles = fs.readdirSync(join(projectRoot, outputFolder));
for (const mdFile of mdFiles) {
const fullPath = join(projectRoot, outputFolder, mdFile);
const content = fs.readFileSync(fullPath, 'utf-8');
fs.writeFileSync(fullPath, GOOGLE3_HEADER + content);
}
}

moveRulesUnitTestingDocs(outputFolder, command);
}

Expand Down