Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/AdaptFrameworkModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand All @@ -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 })
Expand Down Expand Up @@ -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}`)
Expand Down
Loading