diff --git a/npm/fetch.js b/npm/fetch.js index 0e3b9c83a67..1c57e9b6c22 100644 --- a/npm/fetch.js +++ b/npm/fetch.js @@ -22,6 +22,10 @@ const optionDefinitions = [ ]; const options = commandLineArgs(optionDefinitions); +function releaseUrlFor(name) { + return `https://github.com/facebook/hermes/releases/download/v${releaseVersion}/hermes-${name}-v${releaseVersion}.tar.gz`; +} + // This is a limited replacement for util.promisify(stream.pipeline), // because node 8 doesn't have stream.pipeline. function pipeline(readable, writable) { @@ -85,7 +89,7 @@ async function verifyAll(files, options = {}) { } async function downloadRelease(url, dest) { - console.log("downloading " + dest) + console.log("downloading " + dest + " from " + url) // pause on response is needed or else data is dropped while // creating the events.once Promise after. Creating the pipeline // automatically unpauses. @@ -189,27 +193,24 @@ async function fetchUnpackVerify(tarball, files, url, destdir) { }; async function fuvCliDarwin() { - // When a new release is created, the url and hashes of all the + // When a new release is created, the hashes of all the // artifacts will need to be updated here before the npm is built. // If not, the build will fail. TODO We could move the shasums to // an external file which would make it easier to cut new releases. - // To get this URL, do - // curl -H 'Accept: application/json' https://api.github.com/repos/facebook/hermes/releases/tags/ - // and use the 'url' property of the asset with the desired name. - const url = "https://api.github.com/repos/facebook/hermes/releases/assets/13575215" + const url = releaseUrlFor("cli-darwin"); const tarball = { name: "hermes-cli-darwin-v" + releaseVersion + ".tar.gz", - digest: "7f61886871180957f8bc006b857c27c240c291af04cfdd5e3544b85e341d8a15" + digest: "d90724fca1a97de39b21342a68907a4d801b638289123e36e524d180368ed3b5" }; const files = [ { name: "osx-bin/hermes", - digest: "8c07a68cdaa77e302c93f58d4963de18d9805fb851b85a413b3db06a89109678" + digest: "4f1002712c1a57e5d8f13f0a5c78510609f2deb71c672b5566a73971266e899a" }, { name: "osx-bin/hermes-repl", - digest: "de71b9186bc252f03c63c7af6509ead2ae7492d1c65d0f5f85b46cab9878a4fa" + digest: "e859d75405aade42720a4b7f5f5116fd6d5853ee285caff7c3739af64e36946e" } ]; const destdir = "osx-bin"; @@ -218,20 +219,20 @@ async function fuvCliDarwin() { } async function fuvCliLinux64() { - const url = "https://api.github.com/repos/facebook/hermes/releases/assets/13575216" + const url = releaseUrlFor("cli-linux"); const tarball = { name: "hermes-cli-linux-v" + releaseVersion + ".tar.gz", - digest: "3e1ddada71279d7d7c3edc6203b2d244da5278a7adf4ed8762eac3ac6b50e251" + digest: "baba17ec252a534c65694a9ad09c8043fa21b5b081b67bcfa73301525e497ee5" }; const destdir = "linux64-bin"; const files = [ { name: destdir + "/hermes", - digest: "33a13474fddbe615fd1e06373ef692dfd93440fc5accb5957933f4ec8cde99b2" + digest: "003ea5f67c4c450afe92f8c9b421ecfbec5a6bf08a542b24c7262b6669e2721e" }, { name: destdir + "/hermes-repl", - digest: "39f7c3e9179fcbaca763dfe0beaf29a0080023b813c53481a8c835dd0ebabc62" + digest: "93a2475d943623a5085b46e14581e5793834ed3ddfb895075faa8c492acf9be6" } ]; @@ -239,20 +240,20 @@ async function fuvCliLinux64() { } async function fuvCliWindows64() { - const url = "https://api.github.com/repos/facebook/hermes/releases/assets/13575297" + const url = releaseUrlFor("cli-windows"); const tarball = { name: "hermes-cli-windows-v" + releaseVersion + ".tar.gz", - digest: "7850ad333e6a8a785b3a0a070037a5fab11f452585364a8b276f0b4ef381be63" + digest: "5dfa724e40d7d089f52b7b829f11302eb273b5f66d5e8b8e0d1ca89289358aae" }; const destdir = "win64-bin"; const files = [ { name: destdir + "/hermes.exe", - digest: "bf33ac078a4b2e01350f4cd3f7268411ac4774f8741708c84badd9c1953558da" + digest: "f477b330eaea03cc946abee5efbbec484138122931d0ab1ef4e19b563aea7ffd" }, { name: destdir + "/hermes-repl.exe", - digest: "dee3a447c06f80691a92811c26d0df7a19b168c85438c203a0218517bc618d11" + digest: "27c1e523e6444e99805e4037d6ed9556cc86a76b09819c731a0a9475abfe7f6b" } ]; @@ -260,19 +261,19 @@ async function fuvCliWindows64() { } async function fuvRuntimeAndroid() { - const url = "https://api.github.com/repos/facebook/hermes/releases/assets/13575217"; + const url = releaseUrlFor("runtime-android"); const tarball = { name: "hermes-runtime-android-v" + releaseVersion + ".tar.gz", - digest: "5a206105ac7d506d28a5dbdeb3de4294cd996fa3153615a2fbc57c7134f9534d" + digest: "59ecb513b5dab6d3a3164464fcfab9878f83a109b910560727c6f80eb8d0faa7" }; const files = [ { name: "android/hermes-debug.aar", - digest: "5c4cdb5210accaf7fe180b5c5cd4fae261236c874ba97b6aa4e92cdf33a49a5b" + digest: "343740072195f5470399d39caba859fe844ddb24d42ca99b36a57bc2bde7ebec" }, { name: "android/hermes-release.aar", - digest: "210fad6b124dd9507fea3ce96975a1434ddef10ba93cc2784ad80fc907a7944f" + digest: "dfb77f73e47c52c27ea1884a13741ef9abfc45b9f831e721e39a0a30591c0e50" } ]; const destdir = "android";