Skip to content

Commit

Permalink
Merge 31bc1ec into 4ddf556
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubox76 committed Jan 11, 2022
2 parents 4ddf556 + 31bc1ec commit 7a3fc06
Showing 1 changed file with 22 additions and 0 deletions.
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

0 comments on commit 7a3fc06

Please sign in to comment.