| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e08fef1 commit f293dcf
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,8 @@ const getUrl = (url) => { | |||
| 31 | 31 | }); | |
| 32 | 32 | }; | |
| 33 | 33 | ||
| 34 | + const kNoInternet = !!process.env.NODE_TEST_NO_INTERNET; | ||
| 35 | + | ||
| 34 | 36 | module.exports = { | |
| 35 | 37 | async versions() { | |
| 36 | 38 | if (_versions) { | |
@@ -42,16 +44,20 @@ module.exports = { | |||
| 42 | 44 | const url = | |
| 43 | 45 | 'https://raw.githubusercontent.com/nodejs/node/master/CHANGELOG.md'; | |
| 44 | 46 | 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 | + } | ||
| 55 | 61 | } | |
| 56 | 62 | } | |
| 57 | 63 | const ltsRE = /Long Term Support/i; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments