-
Notifications
You must be signed in to change notification settings - Fork 2
. #3
base: master
Are you sure you want to change the base?
. #3
Conversation
tools/generator.js
Outdated
return `Error writing ${cfgPath}`; | ||
} | ||
// Read config.json. | ||
configJson = await fs.readJson(cfgPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you read this after you just wrote it up on line 287 and then you write it again later? Why not just keep it in memory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. I should keep it in memory. One of the plugins (copyFmToConfig) needs to update configJson (overwriting default values with frontmatter as needed) so, at the time, I wrote configJson to a file so that the plugin could read it, update it, and write it again. It might be better to just pass the configJson object to the plugin. This particular plugin still uses readJsonSync instead of async(), too. Would you be interested in making these changes as part of the PR? The plugins are in the tools/plugins folder. Thx.
No description provided.