From 8a686d2d534e3bef6ff196ae9eb3a80975ea4049 Mon Sep 17 00:00:00 2001 From: Thomas Taylor Date: Tue, 24 Mar 2026 23:43:22 +0000 Subject: [PATCH] Fix: Resolve semver range to concrete version before CLI install/update The CLI's installFramework and updateFramework expect a specific version tag, not a semver range. Passing targetVersionRange directly caused a 404 when the CLI tried to download a GitHub archive using the range as a branch name. Now resolves the range via getLatestVersion() first. Also fixes typo: getLatestFrameworkVersion param should be versionLimit not version (refs adaptlearning/adapt-cli#241). --- lib/AdaptFrameworkModule.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/AdaptFrameworkModule.js b/lib/AdaptFrameworkModule.js index 3fd8c98..279862a 100644 --- a/lib/AdaptFrameworkModule.js +++ b/lib/AdaptFrameworkModule.js @@ -161,7 +161,10 @@ class AdaptFrameworkModule extends AbstractModule { if (version) { this.checkVersionCompatibility(version) } - await this.runCliCommand('installFramework', { version: version ?? this.targetVersionRange }) + if (!version && this.targetVersionRange) { + version = await this.getLatestVersion() + } + await this.runCliCommand('installFramework', { version }) } catch (e) { this.log('error', `failed to install framework, ${e.message}`) throw e.statusCode ? e : this.app.errors.FW_INSTALL_FAILED.setData({ reason: e.message }) @@ -176,7 +179,7 @@ class AdaptFrameworkModule extends AbstractModule { */ async getLatestVersion () { try { - return semver.clean(await this.runCliCommand('getLatestFrameworkVersion', { version: this.targetVersionRange })) + return semver.clean(await this.runCliCommand('getLatestFrameworkVersion', { versionLimit: this.targetVersionRange })) } catch (e) { this.log('error', `failed to retrieve framework update data, ${e.message}`) throw this.app.errors.FW_LATEST_VERSION_FAILED.setData({ reason: e.message }) @@ -210,7 +213,10 @@ class AdaptFrameworkModule extends AbstractModule { if (version) { this.checkVersionCompatibility(version) } - await this.runCliCommand('updateFramework', { version: version ?? this.targetVersionRange }) + if (!version && this.targetVersionRange) { + version = await this.getLatestVersion() + } + await this.runCliCommand('updateFramework', { version }) this._version = await this.runCliCommand('getCurrentFrameworkVersion') } catch (e) { this.log('error', `failed to update framework, ${e.message}`)