-
Notifications
You must be signed in to change notification settings - Fork 960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundle Node 14 as a fallback for operating systems that cannot run Node 18 #4151
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,14 +28,16 @@ | |
* under the License. | ||
*/ | ||
|
||
import { basename } from 'path'; | ||
import { basename, resolve } from 'path'; | ||
import fetch from 'node-fetch'; | ||
import semver from 'semver'; | ||
|
||
import { Config, Platform } from '../../lib'; | ||
|
||
const NODE_RANGE_CACHE: { [key: string]: string } = {}; | ||
|
||
export const NODE14_FALLBACK_VERSION = '14.21.3'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it be over-engineering a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree that we would rather have one source of truth. Let's do a quick-follow on this. |
||
|
||
export async function getNodeDownloadInfo(config: Config, platform: Platform) { | ||
const version = getRequiredVersion(config); | ||
const arch = platform.getNodeArch(); | ||
|
@@ -57,6 +59,29 @@ export async function getNodeDownloadInfo(config: Config, platform: Platform) { | |
}; | ||
} | ||
|
||
export async function getNodeVersionDownloadInfo( | ||
version: string, | ||
architecture: string, | ||
isWindows: boolean, | ||
repoRoot: string | ||
) { | ||
const downloadName = isWindows | ||
? `node-v${version}-win-x64.zip` | ||
: `node-v${version}-${architecture}.tar.gz`; | ||
|
||
const url = `https://mirrors.nodejs.org/dist/v${version}/${downloadName}`; | ||
const downloadPath = resolve(repoRoot, '.node_binaries', version, basename(downloadName)); | ||
const extractDir = resolve(repoRoot, '.node_binaries', version, architecture); | ||
|
||
return { | ||
url, | ||
downloadName, | ||
downloadPath, | ||
extractDir, | ||
version, | ||
}; | ||
} | ||
|
||
export async function getLatestNodeVersion(config: Config) { | ||
const range = config.getNodeRange(); | ||
// Check cache and return if known | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I wonder if there would be a slight improvement to not even attempt to download node 14 if the the current node version fails as well (for platform availability reasons).
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.
At this stage we won't know since it is a redistributable package that we build here.