Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f293dcf

Browse filesBrowse files
joyeecheungcodebytere
authored andcommitted
tools: add NODE_TEST_NO_INTERNET to the doc builder
At the moment the doc builder tries to access the internet for CHANGELOG information and only falls back to local sources after the connection fails or a 5 second timeout. This means that the doc building could take at least 7 minutes on a machine with hijacked connection to Github for useless network attempts. This patch adds a NODE_TEST_NO_INTERNET environment variable to directly bypass these attempts so that docs can be built in reasonable time on a machine like that. PR-URL: #31849 Fixes: #29918 Reviewed-By: Matheus Marchini <mat@mmarchini.me> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent e08fef1 commit f293dcf
Copy full SHA for f293dcf

File tree

Expand file treeCollapse file tree

1 file changed

+16
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-10
lines changed
Open diff view settings
Collapse file

‎tools/doc/versions.js‎

Copy file name to clipboardExpand all lines: tools/doc/versions.js
+16-10Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const getUrl = (url) => {
3131
});
3232
};
3333

34+
const kNoInternet = !!process.env.NODE_TEST_NO_INTERNET;
35+
3436
module.exports = {
3537
async versions() {
3638
if (_versions) {
@@ -42,16 +44,20 @@ module.exports = {
4244
const url =
4345
'https://raw.githubusercontent.com/nodejs/node/master/CHANGELOG.md';
4446
let changelog;
45-
try {
46-
changelog = await getUrl(url);
47-
} catch (e) {
48-
// Fail if this is a release build, otherwise fallback to local files.
49-
if (isRelease()) {
50-
throw e;
51-
} else {
52-
const file = path.join(srcRoot, 'CHANGELOG.md');
53-
console.warn(`Unable to retrieve ${url}. Falling back to ${file}.`);
54-
changelog = readFileSync(file, { encoding: 'utf8' });
47+
const file = path.join(srcRoot, 'CHANGELOG.md');
48+
if (kNoInternet) {
49+
changelog = readFileSync(file, { encoding: 'utf8' });
50+
} else {
51+
try {
52+
changelog = await getUrl(url);
53+
} catch (e) {
54+
// Fail if this is a release build, otherwise fallback to local files.
55+
if (isRelease()) {
56+
throw e;
57+
} else {
58+
console.warn(`Unable to retrieve ${url}. Falling back to ${file}.`);
59+
changelog = readFileSync(file, { encoding: 'utf8' });
60+
}
5561
}
5662
}
5763
const ltsRE = /Long Term Support/i;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.