Skip to content

Commit

Permalink
fix: show incompatible plugins for major changes as well
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasholzer committed Mar 14, 2024
1 parent d90cda6 commit c18589b
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions packages/build/src/log/messages/compatibility.ts
@@ -1,7 +1,6 @@
import semver from 'semver'

import { isRuntime } from '../../utils/runtime.js'
import { isPreviousMajor } from '../../utils/semver.js'
import { getPluginOrigin } from '../description.js'
import { BufferedLogs, logArray, logSubHeader, logWarningArray, logWarningSubHeader } from '../logger.js'
import { THEME } from '../theme.js'
Expand Down Expand Up @@ -149,7 +148,7 @@ const getUpgradeInstruction = function (loadedFrom, origin) {
// Print a warning message when plugins are using a version that is too recent
// and does not meet some `compatibility` expectations.
// This can only happen when they are installed to `package.json`.
export const logIncompatiblePlugins = function (logs, pluginsOptions) {
export const logIncompatiblePlugins = function (logs: BufferedLogs, pluginsOptions) {
const incompatiblePlugins = pluginsOptions.filter(hasIncompatibleVersion).map(getIncompatiblePlugin)

if (incompatiblePlugins.length === 0) {
Expand All @@ -161,16 +160,7 @@ export const logIncompatiblePlugins = function (logs, pluginsOptions) {
}

const hasIncompatibleVersion = function ({ pluginPackageJson: { version }, compatibleVersion, compatWarning }) {
return (
compatWarning !== '' &&
version !== undefined &&
compatibleVersion !== undefined &&
// Using only the major version prevents printing this warning message when
// a site is using the right `compatibility` version, but is using the most
// recent version due to the time gap between `npm publish` and the
// `plugins.json` update
isPreviousMajor(compatibleVersion, version)
)
return compatWarning !== '' && version !== undefined && compatibleVersion !== undefined
}

const getIncompatiblePlugin = function ({
Expand Down

0 comments on commit c18589b

Please sign in to comment.