aboutsummaryrefslogtreecommitdiff
path: root/node_modules/nexe/lib/releases.js
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-24 14:41:48 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-24 14:41:48 +0200
commitd25e11bee6ca5ca523884da132d18e1400e077b9 (patch)
tree8af39fde19f7ed640a60fb397c7edd647dff1c4c /node_modules/nexe/lib/releases.js
downloadkartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.gz
kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.tar.bz2
kartik-iridium-d25e11bee6ca5ca523884da132d18e1400e077b9.zip
Initial commit
Diffstat (limited to 'node_modules/nexe/lib/releases.js')
-rw-r--r--node_modules/nexe/lib/releases.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/node_modules/nexe/lib/releases.js b/node_modules/nexe/lib/releases.js
new file mode 100644
index 0000000..ffd5ec5
--- /dev/null
+++ b/node_modules/nexe/lib/releases.js
@@ -0,0 +1,56 @@
+"use strict";
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const got = require("got");
+const target_1 = require("./target");
+const versionsToSkip = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 15, 17, 19, 21, 22];
+function getJson(url, options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ return JSON.parse((yield got(url, options)).body);
+ });
+}
+function isBuildableVersion(version) {
+ if (version === '12.11.0') {
+ return false;
+ }
+ return !versionsToSkip.includes(Number(version.split('.')[0]));
+}
+function getLatestGitRelease(options) {
+ return getJson('https://api.github.com/repos/nexe/nexe/releases/latest', options);
+}
+exports.getLatestGitRelease = getLatestGitRelease;
+function getUnBuiltReleases(options) {
+ return __awaiter(this, void 0, void 0, function* () {
+ const nodeReleases = yield getJson('https://nodejs.org/download/release/index.json');
+ const existingVersions = (yield getLatestGitRelease(options)).assets.map((x) => target_1.getTarget(x.name));
+ const versionMap = {};
+ return nodeReleases
+ .reduce((versions, { version }) => {
+ version = version.replace('v', '').trim();
+ if (!isBuildableVersion(version) || versionMap[version]) {
+ return versions;
+ }
+ versionMap[version] = true;
+ target_1.platforms.forEach((platform) => {
+ target_1.architectures.forEach((arch) => {
+ if (arch === 'x86' && platform === 'mac')
+ return;
+ if (arch.includes('arm'))
+ return;
+ versions.push(target_1.getTarget({ platform, arch, version }));
+ });
+ });
+ return versions;
+ }, [])
+ .filter((x) => !existingVersions.some((t) => target_1.targetsEqual(t, x)));
+ });
+}
+exports.getUnBuiltReleases = getUnBuiltReleases;