Skip to content

Commit

Permalink
try fixing 5.x issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Shibanov committed Mar 17, 2021
1 parent 77a48bb commit 36fa987
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
16 changes: 11 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16876,7 +16876,13 @@ class DotNetVersionInfo {
this.throwInvalidVersionFormat();
}
let major = this.getVersionNumberOrThrow(parts[0]);
let minor = this.getVersionNumberOrThrow(parts[1]);
let minor;
if (parts[1] === 'x') {
minor = parts[1];
}
else {
minor = this.getVersionNumberOrThrow(parts[1]);
}
this.fullversion = major + '.' + minor;
}
getVersionNumberOrThrow(input) {
Expand All @@ -16894,7 +16900,7 @@ class DotNetVersionInfo {
}
}
throwInvalidVersionFormat() {
throw 'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*';
throw new Error('Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*');
}
/**
* If true exacatly one version should be resolved
Expand Down Expand Up @@ -16997,7 +17003,7 @@ class DotnetCoreInstaller {
}
console.log(process.env['PATH']);
if (resultCode != 0) {
throw `Failed to install dotnet ${resultCode}. ${output}`;
throw new Error(`Failed to install dotnet ${resultCode}. ${output}`);
}
});
}
Expand Down Expand Up @@ -17025,7 +17031,7 @@ class DotnetCoreInstaller {
// Sort for latest version
releasesInfo = releasesInfo.sort((a, b) => semver.rcompare(a['sdk']['version'], b['sdk']['version']));
if (releasesInfo.length == 0) {
throw `Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`;
throw new Error(`Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`);
}
let release = releasesInfo[0];
return release['sdk']['version'];
Expand All @@ -17046,7 +17052,7 @@ class DotnetCoreInstaller {
return versionParts[0] == sdkParts[0];
});
if (releasesInfo.length === 0) {
throw `Could not find info for version ${versionParts.join('.')} at ${DotNetCoreIndexUrl}`;
throw new Error(`Could not find info for version ${versionParts.join('.')} at ${DotNetCoreIndexUrl}`);
}
return releasesInfo[0]['releases.json'];
});
Expand Down
25 changes: 18 additions & 7 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ export class DotNetVersionInfo {
}

let major = this.getVersionNumberOrThrow(parts[0]);
let minor = this.getVersionNumberOrThrow(parts[1]);
let minor;
if (parts[1] === 'x') {
minor = parts[1];
} else {
minor = this.getVersionNumberOrThrow(parts[1]);
}

this.fullversion = major + '.' + minor;
}
Expand All @@ -60,7 +65,9 @@ export class DotNetVersionInfo {
}

private throwInvalidVersionFormat() {
throw 'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*';
throw new Error(
'Invalid version format! Supported: 1.2.3, 1.2, 1.2.x, 1.2.*'
);
}

/**
Expand Down Expand Up @@ -187,7 +194,7 @@ export class DotnetCoreInstaller {
console.log(process.env['PATH']);

if (resultCode != 0) {
throw `Failed to install dotnet ${resultCode}. ${output}`;
throw new Error(`Failed to install dotnet ${resultCode}. ${output}`);
}
}

Expand Down Expand Up @@ -236,7 +243,9 @@ export class DotnetCoreInstaller {
);

if (releasesInfo.length == 0) {
throw `Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`;
throw new Error(
`Could not find dotnet core version. Please ensure that specified version ${versionInfo.inputVersion} is valid.`
);
}

let release = releasesInfo[0];
Expand Down Expand Up @@ -264,9 +273,11 @@ export class DotnetCoreInstaller {
});

if (releasesInfo.length === 0) {
throw `Could not find info for version ${versionParts.join(
'.'
)} at ${DotNetCoreIndexUrl}`;
throw new Error(
`Could not find info for version ${versionParts.join(
'.'
)} at ${DotNetCoreIndexUrl}`
);
}

return releasesInfo[0]['releases.json'];
Expand Down

0 comments on commit 36fa987

Please sign in to comment.