-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d30754d
commit 16eb002
Showing
11 changed files
with
77 additions
and
55 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import https from "node:https"; | ||
|
||
export const getManifest = (manifestUrl) => { | ||
let chunks = undefined; | ||
|
||
return new Promise((resolve, reject) => { | ||
https.get(manifestUrl, (res) => { | ||
res.on("data", (chunk) => { | ||
chunks += chunk; | ||
}); | ||
|
||
res.on("error", (e) => { | ||
reject(e); | ||
}); | ||
|
||
res.on("end", () => { | ||
resolve(chunks); | ||
}); | ||
}); | ||
}); | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import fs from "node:fs/promises"; | ||
|
||
import { getManifest } from "./getManifest.js"; | ||
|
||
export const getReleaseInfo = async (version, cacheDir, manifestUrl) => { | ||
let releaseData = undefined; | ||
try { | ||
await fs.access(`${cacheDir}/manifest.json`); | ||
console.log(`[ INFO ] Manifest file already exists locally under ${cacheDir}`) | ||
} catch(e) { | ||
console.log(`[ ERROR ] Manifest file does not exist locally`); | ||
console.log(`[ INFO ] Downloading latest manifest file under ${cacheDir}`); | ||
const data = await getManifest(manifestUrl); | ||
await fs.writeFile(`${cacheDir}/manifest.json`, data.slice(9)); | ||
} finally { | ||
let manifestData = await fs.readFile(`${cacheDir}/manifest.json`); | ||
let manifestJson = JSON.parse(manifestData); | ||
releaseData = manifestJson.versions.find(release => release.version === `v${version}`); | ||
} | ||
return releaseData; | ||
}; |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
"platform": "osx", | ||
"arch": "x64", | ||
"outDir": "./build", | ||
"run": true | ||
"run": false | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.