If a user needs to configure an optional docusaurus config key based on some condition, what is the best way to address it in docusaurus.config.js file? For example:
module.exports = {
/* If condition is true then */
showLastUpdateAuthor: true,
/* otherwise set it to false */
//Other config key value...
}
Here is what I tried and it worked. Is there a better way to handle this? Insights via Spread Syntax discussed here.
const branch = require('child_process')
.execSync('git branch --show-current')
.toString().trim();
module.exports = {
...(branch != 'main') ? {showLastUpdateAuthor: true,}:{showLastUpdateAuthor: false,},
//Other config key value...
}