Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
refactor: rename minVersion property to minimumVersion (#1865)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarnsley authored Mar 25, 2020
1 parent 677b5f0 commit 4e5c4a8
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions __tests__/unit/services/plugin-manager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ describe('Plugin Manager', () => {
name: 'test-plugin-1',
keywords: PLUGINS.keywords,
'desktop-wallet': {
minVersion: '1.0'
minimumVersion: '1.0'
}
}
const invalidPlugin = {
name: 'test-plugin-2',
keywords: PLUGINS.keywords,
'desktop-wallet': {
minVersion: '3.0'
minimumVersion: '3.0'
}
}

Expand Down
4 changes: 2 additions & 2 deletions __tests__/unit/store/modules/plugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ describe('PluginModule', () => {
store.dispatch('plugin/setInstalled', {
config: {
...installedPlugins[0].config,
minVersion: '1.0.0'
minimumVersion: '1.0.0'
}
})
expect(store.getters['plugin/isInstalledSupported'](installedPlugins[0].config.id)).toBe(true)
Expand All @@ -736,7 +736,7 @@ describe('PluginModule', () => {
store.dispatch('plugin/setInstalled', {
config: {
...installedPlugins[0].config,
minVersion: '3.0.0'
minimumVersion: '3.0.0'
}
})
expect(store.getters['plugin/isInstalledSupported'](installedPlugins[0].config.id)).toBe(false)
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/services/plugin-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ export class PluginManager {
console.info(`${plugin.id} is not a valid package name`)
}

const minVersionSatisfied = !plugin.minVersion || semver.gte(releaseService.currentVersion, plugin.minVersion)
if (!minVersionSatisfied) {
const minimumVersionSatisfied = !plugin.minimumVersion || semver.gte(releaseService.currentVersion, plugin.minimumVersion)
if (!minimumVersionSatisfied) {
console.info(`${plugin.id} requires a higher wallet version`)
}

return validName && minVersionSatisfied
return validName && minimumVersionSatisfied
})

const plugins = configs.reduce((plugins, config) => {
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/services/plugin-manager/config-sanitizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ const sanitizeVersion = version => {
return semver.valid(version) || semver.coerce(version) || '0.0.0'
}

const sanitizeMinVersion = config => {
const minVersion = getOption(config, 'minVersion') || config.minVersion
return semver.valid(minVersion) || semver.coerce(minVersion) || '0.0.0'
const sanitizeMinimumVersion = config => {
const minimumVersion = getOption(config, 'minimumVersion') || config.minimumVersion
return semver.valid(minimumVersion) || semver.coerce(minimumVersion) || '0.0.0'
}

const sanitizeLogo = config => {
Expand Down Expand Up @@ -167,7 +167,7 @@ export {
sanitizeIsOfficial,
sanitizeKeywords,
sanitizeLogo,
sanitizeMinVersion,
sanitizeMinimumVersion,
sanitizePermissions,
sanitizeSize,
sanitizeSource,
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/services/plugin-manager/plugin-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
sanitizeIsOfficial,
sanitizeKeywords,
sanitizeLogo,
sanitizeMinVersion,
sanitizeMinimumVersion,
sanitizePermissions,
sanitizeSize,
sanitizeSource,
Expand All @@ -26,7 +26,7 @@ export class PluginConfiguration {
images,
homepage,
isOfficial,
minVersion,
minimumVersion,
permissions,
size,
source,
Expand All @@ -43,7 +43,7 @@ export class PluginConfiguration {
this.images = images
this.homepage = homepage
this.isOfficial = isOfficial
this.minVersion = minVersion
this.minimumVersion = minimumVersion
this.permissions = permissions
this.size = size
this.source = source
Expand All @@ -63,7 +63,7 @@ export class PluginConfiguration {
images: sanitizeImages(config),
homepage: config.homepage,
isOfficial: sanitizeIsOfficial(config.name),
minVersion: sanitizeMinVersion(config),
minimumVersion: sanitizeMinimumVersion(config),
permissions: sanitizePermissions(config),
size: await sanitizeSize(config, pluginPath) || 0,
source: sanitizeSource(config),
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/store/modules/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ export default {
isInstalledSupported: (_, getters) => pluginId => {
const plugin = getters.installedById(pluginId)

if (!plugin.config.minVersion) {
if (!plugin.config.minimumVersion) {
return true
}

return semver.gte(releaseService.currentVersion, plugin.config.minVersion)
return semver.gte(releaseService.currentVersion, plugin.config.minimumVersion)
},

avatar: state => profile => {
Expand Down

0 comments on commit 4e5c4a8

Please sign in to comment.