-
Notifications
You must be signed in to change notification settings - Fork 30
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
feat: expose standalone download function #73
Conversation
This allows downloading binaries for more than one platform. We want to use this in ipfs-desktop, to download both amd64 and arm64 binaries required for building universal DMGs. Exposing download function here allows us to 1. leverage cached downloads, avoid fetching same arch twice 2. confirm download by checkign sha512
/** | ||
* @param {string} [version] | ||
* @param {string} [platform] | ||
* @param {string} [arch] | ||
* @param {string} [installPath] | ||
*/ | ||
module.exports = async (version, platform, arch, installPath) => { | ||
module.exports.downloadAndUpdateBin = async (version, platform, arch, installPath) => { |
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.
ℹ️ This funciton did download+link. Renamed to better describe what it really does.
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.
ℹ️ Had to do this to pass lint
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.
ℹ️ Added test for download
function.
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.
lgtm
const { download } = require('./download') | ||
|
||
module.exports.download = download |
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.
do we want to expose the downloadAndUpdateBin
as well?
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 think no, it is only meaningful in NPM's postinstall hook, there is no use case where end use would want to use it.
Merging so this ships with 0.29.x |
This PR exposes manual
download
function that allows downloading binaries for more than one platform in programmatic fashion.Use case: we want to use this in ipfs-desktop, to download both amd64 and arm64 binaries required for building universal DMGs (ipfs/ipfs-desktop#1856).
Exposing
download
function here allows us to: