Skip to content

Commit 7d21def

Browse files
authored
Fix: Missing sourceinfo causes property lookup on undefined object (fixes #204)
* Fix: Missing sourceinfo causes property lookup on undefined object * Use correct conditions
1 parent 5950af6 commit 7d21def

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/integration/Plugin.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default class Plugin {
7979
* @returns {boolean|null}
8080
*/
8181
get isUpToDate () {
82-
if (!this.hasFrameworkCompatibleVersion) return true;
82+
if (!this.hasFrameworkCompatibleVersion) return true
8383
const canCheckSourceAgainstProject = (this.latestSourceVersion && this.projectVersion)
8484
if (!canCheckSourceAgainstProject) return null
8585
const isLatestVersion = (this.projectVersion === this.latestSourceVersion)
@@ -104,6 +104,14 @@ export default class Plugin {
104104
return (this._projectInfo?.version || null)
105105
}
106106

107+
/**
108+
* the required framework version from the source package json
109+
* @returns {string|null}
110+
*/
111+
get frameworkVersion () {
112+
return (this._sourceInfo?.framework || null)
113+
}
114+
107115
/**
108116
* a list of tags denoting the source versions of the plugin
109117
* @returns {[string]}
@@ -293,7 +301,7 @@ export default class Plugin {
293301

294302
// check if the latest version is compatible
295303
const satisfiesConstraint = !this.hasValidRequestVersion || semver.satisfies(this._sourceInfo.version, this.requestedVersion, semverOptions)
296-
const satisfiesFramework = semver.satisfies(framework, this._sourceInfo.framework, semverOptions)
304+
const satisfiesFramework = semver.satisfies(framework, this.frameworkVersion, semverOptions)
297305
if (!this.latestCompatibleSourceVersion && satisfiesFramework) this.latestCompatibleSourceVersion = this.latestSourceVersion
298306
if (satisfiesConstraint && satisfiesFramework) {
299307
return this.latestSourceVersion

lib/integration/PluginManagement/update.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ async function conflictResolution ({ logger, targets, isInteractive }) {
165165
}
166166
const preFilteredPlugins = targets.filter(target => !target.isLocalSource)
167167
const allQuestions = [
168-
add(preFilteredPlugins.filter(target => !target.hasFrameworkCompatibleVersion), 'There is no compatible version of the following plugins:', checkVersion),
168+
add(preFilteredPlugins.filter(target => !target.hasFrameworkCompatibleVersion && target.latestSourceVersion), 'There is no compatible version of the following plugins:', checkVersion),
169169
add(preFilteredPlugins.filter(target => target.hasFrameworkCompatibleVersion && !target.hasValidRequestVersion), 'The version requested is invalid, there are newer compatible versions of the following plugins:', checkVersion),
170170
add(preFilteredPlugins.filter(target => target.hasFrameworkCompatibleVersion && target.hasValidRequestVersion && !target.isApplyLatestCompatibleVersion), 'There are newer compatible versions of the following plugins:', checkVersion)
171171
].filter(Boolean)

0 commit comments

Comments
 (0)