FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc, tools: added caching support for `CHANGELOG.md` in `tools/doc/versions.js` by hassaanp · Pull Request #32515 · nodejs/node · GitHub

/ node Public

doc, tools: added caching support for CHANGELOG.md in tools/doc/versions.js - #32515

Closed
hassaanp wants to merge 2 commits into
nodejs:masterfrom
hassaanp:feat/cache-changelog
Closed

doc, tools: added caching support for CHANGELOG.md in tools/doc/versions.js#32515
hassaanp wants to merge 2 commits into
nodejs:masterfrom
hassaanp:feat/cache-changelog

Conversation

Copy link
Copy Markdown
Contributor

When running make doc the CHANGELOG.md file is pulled everytime for each
of the doc file that requires the versions list. This commit introduces a
new file called .master-CHANGELOG.md which will be created once so that
subsequent calls for the version are pulled locally instead of from the repo.
Since this file is not part of the codebase proper, it is appended in the
.gitignore file.

Closes #32512

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

…ons.js

When running `make doc` the CHANGELOG.md file is pulled everytime for each
of the doc file that requires the versions list. This commit introduces a
new file called `.master-CHANGELOG.md` which will be created once so that
subsequent calls for the version are pulled locally instead of from the repo.
Since this file is not part of the codebase proper, it is appended in the
.gitignore file.

References Issue nodejs#32512
nodejs-github-bot added doc Issues and PRs related to the documentations. meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory. labels Mar 27, 2020
Comment thread tools/doc/versions.js Outdated
});
};

const createMaster = (masterPath, file) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

this function only is used once, why not code inline?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You are right. My bad.
Thanks for the suggestion.

…angelog

Review for the pull request nodejs#32515 suggested to use inline command
instead of creating a function that is not used again.
Comment thread tools/doc/versions.js
const masterChangelog = path.join(srcRoot, '.master-CHANGELOG.md');
if (kNoInternet) {
changelog = readFileSync(file, { encoding: 'utf8' });
} else if (existsSync(masterChangelog)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This should probably be using statSync and check whether the file is outdated – otherwise this isn’t caching, it’s just storing a file and keeping it around forever.

(Also, it’s odd that we use fs.*Sync() functions inside an async function, although it’s not that important for this script. I’d suggest using readFile, stat, writeFile from fs.promises instead, just to reflect best practices.)

Copy link
Copy Markdown
Member

Apologies to @hassaanp I've had a in progress change for this on my backlog for awhile and was able to finish it today (since I'm off work today): #32518

Copy link
Copy Markdown
Contributor Author

Apologies to @hassaanp I've had a in progress change for this on my backlog for awhile and was able to finish it today (since I'm off work today): #32518

No worries. You can go ahead and close this if you want.

hassaanp closed this Apr 1, 2020
This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Issues and PRs related to the documentations. meta Issues and PRs related to the general management of the project. tools Issues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tools/doc/versions.js should cache version data

5 participants


Back | FazBrowse Home | New Git URL