function checkForMissingFilesAndFixFilenameCase() {
  // Get filenames from toc.yaml.
  const filenames = tocText
    .split('\n')
    .filter(line => line.includes('path:'))
    .map(line => line.split(devsitePath)[1]);
  // Logs warning to console if a file from TOC is not found.
  const fileCheckPromises = filenames.map(filename => {
    // Warns if file does not exist, fixes filename case if it does.
    // Preferred filename for devsite should be capitalized and taken from
    // toc.yaml.
    const tocFilePath = `${docPath}/${filename}.html`;
    // Generated filename from Typedoc will be lowercase.
    const generatedFilePath = `${docPath}/${filename.toLowerCase()}.html`;
    return fs.exists(generatedFilePath).then(exists => {
      if (exists) {
        // Store in a lookup table for link fixing.
        lowerToUpperLookup[
          `${filename.toLowerCase()}.html`
        ] = `${filename}.html`;
        return fs.rename(generatedFilePath, tocFilePath);
      } else {
        console.warn(
          `Missing file: ${filename}.html requested ` +
            `in toc.yaml but not found in ${docPath}`
        );
      }
    });
  });
  return Promise.all(fileCheckPromises).then(() => filenames);
}
function checkForMissingFilesAndFixFilenameCase() {
  // Get filenames from toc.yaml.
  const filenames = tocText
    .split('\n')
    .filter(line => line.includes('path:'))
    .map(line => line.split(devsitePath)[1]);
  // Logs warning to console if a file from TOC is not found.
  const fileCheckPromises = filenames.map(filename => {
    // Warns if file does not exist, fixes filename case if it does.
    // Preferred filename for devsite should be capitalized and taken from
    // toc.yaml.
    const tocFilePath = `${docPath}/${filename}.html`;
    // Generated filename from Typedoc will be lowercase.
    const generatedFilePath = `${docPath}/${filename.toLowerCase()}.html`;
    return fs.exists(generatedFilePath).then(exists => {
      if (exists) {
        // Store in a lookup table for link fixing.
        lowerToUpperLookup[
          `${filename.toLowerCase()}.html`
        ] = `${filename}.html`;
        return fs.rename(generatedFilePath, tocFilePath);
      } else {
        console.warn(
          `Missing file: ${filename}.html requested ` +
            `in toc.yaml but not found in ${docPath}`
        );
      }
    });
  });
  return Promise.all(fileCheckPromises).then(() => filenames);
}
function checkForMissingFilesAndFixFilenameCase ( ) { // Get filenames from toc.yaml. const filenames = tocText . split ( '\n' ) . filter ( line => line . includes ( 'path:' ) ) . map ( line => line . split ( devsitePath ) [ 1 ] ) ; // Logs warning to console if a file from TOC is not found. const fileCheckPromises = filenames . map ( filename => { // Warns if file does not exist, fixes filename case if it does. // Preferred filename for devsite should be capitalized and taken from // toc.yaml. const tocFilePath = ` ${ docPath } ${ filename } ` ; // Generated filename from Typedoc will be lowercase. const generatedFilePath = ` ${ docPath } ${ filename . toLowerCase ( ) } ` ; return fs . exists ( generatedFilePath ) . then ( exists => { if ( exists ) { // Store in a lookup table for link fixing. lowerToUpperLookup [ ` ${ filename . toLowerCase ( ) } ` ] = ` ${ filename } ` ; return fs . rename ( generatedFilePath , tocFilePath ) ; } else { console . warn ( ` ${ filename } ` + ` ${ docPath } ` ) ; } } ) ; } ) ; return Promise . all ( fileCheckPromises ) . then ( ( ) => filenames ) ; }
Checks to see if any files listed in toc.yaml were not generated.
If files exist, fixes filename case to match toc.yaml version.
Checks to see if any files listed in toc . yaml were not generated . If files exist fixes filename case to match toc . yaml version .
Checks if a file from toc. yaml is missing and fixes filename case if it does.