chore: prettier, lint and rebuild solution

This commit is contained in:
Ivan Zosimov 2023-09-13 14:13:13 +02:00
parent 446ddaedf9
commit 8036ba5657
2 changed files with 26 additions and 22 deletions

11
dist/setup/index.js vendored
View file

@ -102681,8 +102681,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
const platform = this.getPlatformOption(); const platform = this.getPlatformOption();
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; const availableVersionsUrl = 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl)) const fetchedDragonwellVersions = (yield this.http.getJson(availableVersionsUrl)).result;
.result;
if (!fetchedDragonwellVersions) { if (!fetchedDragonwellVersions) {
throw new Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`); throw new Error(`Couldn't fetch any dragonwell versions from ${availableVersionsUrl}`);
} }
@ -102726,7 +102725,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
if (jdkVersion === 'latest') { if (jdkVersion === 'latest') {
continue; continue;
} }
if (jdkVersion.split(".").length > 3) { if (jdkVersion.split('.').length > 3) {
jdkVersion = this.transformToSemver(jdkVersion); jdkVersion = this.transformToSemver(jdkVersion);
} }
for (const edition in archMap) { for (const edition in archMap) {
@ -102734,7 +102733,7 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
os: platform, os: platform,
architecture: arch, architecture: arch,
jdk_version: jdkVersion, jdk_version: jdkVersion,
checksum: (_a = archMap[edition].sha256) !== null && _a !== void 0 ? _a : "", checksum: (_a = archMap[edition].sha256) !== null && _a !== void 0 ? _a : '',
download_link: archMap[edition].download_url, download_link: archMap[edition].download_url,
edition: edition, edition: edition,
image_type: 'jdk' image_type: 'jdk'
@ -102759,8 +102758,8 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
// Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools.
transformToSemver(version) { transformToSemver(version) {
const splits = version.split('.'); const splits = version.split('.');
const versionMainPart = splits.slice(0, 3).join("."); const versionMainPart = splits.slice(0, 3).join('.');
const versionBuildPart = splits.slice(3).join("."); const versionBuildPart = splits.slice(3).join('.');
return `${versionMainPart}+${versionBuildPart}`; return `${versionMainPart}+${versionBuildPart}`;
} }
getPlatformOption() { getPlatformOption() {

View file

@ -6,7 +6,11 @@ import fs from 'fs';
import path from 'path'; import path from 'path';
import {JavaBase} from '../base-installer'; import {JavaBase} from '../base-installer';
import {extractJdkFile, getDownloadArchiveExtension, isVersionSatisfies} from '../../util'; import {
extractJdkFile,
getDownloadArchiveExtension,
isVersionSatisfies
} from '../../util';
import {IDragonwellVersions, IDragonwellAllVersions} from './models'; import {IDragonwellVersions, IDragonwellAllVersions} from './models';
import { import {
JavaDownloadRelease, JavaDownloadRelease,
@ -56,9 +60,9 @@ export class DragonwellDistribution extends JavaBase {
const availableVersionsUrl = const availableVersionsUrl =
'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json'; 'https://raw.githubusercontent.com/dragonwell-releng/dragonwell-setup-java/main/releases.json';
const fetchedDragonwellVersions = const fetchedDragonwellVersions = (
(await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl)) await this.http.getJson<IDragonwellAllVersions>(availableVersionsUrl)
.result; ).result;
if (!fetchedDragonwellVersions) { if (!fetchedDragonwellVersions) {
throw new Error( throw new Error(
@ -120,7 +124,6 @@ export class DragonwellDistribution extends JavaBase {
for (const majorVersion in dragonwellVersions) { for (const majorVersion in dragonwellVersions) {
const majorVersionMap = dragonwellVersions[majorVersion]; const majorVersionMap = dragonwellVersions[majorVersion];
for (let jdkVersion in majorVersionMap) { for (let jdkVersion in majorVersionMap) {
const jdkVersionMap = majorVersionMap[jdkVersion]; const jdkVersionMap = majorVersionMap[jdkVersion];
if (!(platform in jdkVersionMap)) { if (!(platform in jdkVersionMap)) {
continue; continue;
@ -135,7 +138,7 @@ export class DragonwellDistribution extends JavaBase {
continue; continue;
} }
if (jdkVersion.split(".").length > 3) { if (jdkVersion.split('.').length > 3) {
jdkVersion = this.transformToSemver(jdkVersion); jdkVersion = this.transformToSemver(jdkVersion);
} }
@ -144,7 +147,7 @@ export class DragonwellDistribution extends JavaBase {
os: platform, os: platform,
architecture: arch, architecture: arch,
jdk_version: jdkVersion, jdk_version: jdkVersion,
checksum: archMap[edition].sha256 ?? "", checksum: archMap[edition].sha256 ?? '',
download_link: archMap[edition].download_url, download_link: archMap[edition].download_url,
edition: edition, edition: edition,
image_type: 'jdk' image_type: 'jdk'
@ -160,7 +163,9 @@ export class DragonwellDistribution extends JavaBase {
} }
// Sorts versions in descending order as by default data in JSON isn't sorted // Sorts versions in descending order as by default data in JSON isn't sorted
private sortParsedVersions(eligibleVersions: IDragonwellVersions[]): IDragonwellVersions[] { private sortParsedVersions(
eligibleVersions: IDragonwellVersions[]
): IDragonwellVersions[] {
const sortedVersions = eligibleVersions.sort((versionObj1, versionObj2) => { const sortedVersions = eligibleVersions.sort((versionObj1, versionObj2) => {
const version1 = versionObj1.jdk_version; const version1 = versionObj1.jdk_version;
const version2 = versionObj2.jdk_version; const version2 = versionObj2.jdk_version;
@ -173,8 +178,8 @@ export class DragonwellDistribution extends JavaBase {
// Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools. // Common practice is to transform excess digits to the so-called semver build part, which is prefixed with the plus sign, to be able to operate with them using semver tools.
private transformToSemver(version: string) { private transformToSemver(version: string) {
const splits = version.split('.'); const splits = version.split('.');
const versionMainPart = splits.slice(0,3).join("."); const versionMainPart = splits.slice(0, 3).join('.');
const versionBuildPart = splits.slice(3).join("."); const versionBuildPart = splits.slice(3).join('.');
return `${versionMainPart}+${versionBuildPart}`; return `${versionMainPart}+${versionBuildPart}`;
} }