-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README cross reference tables as part of release process. (#176)
Update README cross reference tables as part of release process.
- Loading branch information
Showing
5 changed files
with
131 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const fs = require('fs'); | ||
const generateGlobalToModuleXref = require('./generate-markdown-table'); | ||
const generateModuleByModuleXref = require('./generate-by-module-markdown-table'); | ||
|
||
function updateREADME() { | ||
let originalContents = fs.readFileSync('README.md', 'utf8'); | ||
|
||
let updatedContents = originalContents.replace( | ||
/<!-- MODULE_TO_GLOBAL_CROSS_REFERENCE_START -->[\s\S]*<!-- MODULE_TO_GLOBAL_CROSS_REFERENCE_END -->/, | ||
// using replacement function here because our output includes $` which is a special replacement value | ||
// in String.prototype.replace, using a function avoids that pitfall | ||
() => { | ||
return `<!-- MODULE_TO_GLOBAL_CROSS_REFERENCE_START -->\n\n${generateGlobalToModuleXref()}\n\n<!-- MODULE_TO_GLOBAL_CROSS_REFERENCE_END -->`; | ||
} | ||
); | ||
|
||
let finalContents = updatedContents.replace( | ||
/<!-- MODULE_BY_MODULE_LISTING_START -->[\s\S]*<!-- MODULE_BY_MODULE_LISTING_END -->/m, | ||
// using replacement function here because our output includes $` which is a special replacement value | ||
// in String.prototype.replace, using a function avoids that pitfall | ||
() => { | ||
return `<!-- MODULE_BY_MODULE_LISTING_START -->\n\n${generateModuleByModuleXref()}\n\n<!-- MODULE_BY_MODULE_LISTING_END -->`; | ||
} | ||
); | ||
|
||
fs.writeFileSync('README.md', finalContents, 'utf8'); | ||
} | ||
|
||
if (require.main === module) { | ||
updateREADME(); | ||
} |