diff --git a/packages/build/src/log/messages/compatibility.ts b/packages/build/src/log/messages/compatibility.ts index 3249a0da83..b3ce9e19b5 100644 --- a/packages/build/src/log/messages/compatibility.ts +++ b/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' @@ -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) { @@ -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 ({ diff --git a/packages/build/tests/plugins_list/snapshots/tests.js.md b/packages/build/tests/plugins_list/snapshots/tests.js.md index 44a05e79b1..93548b26fa 100644 --- a/packages/build/tests/plugins_list/snapshots/tests.js.md +++ b/packages/build/tests/plugins_list/snapshots/tests.js.md @@ -820,6 +820,9 @@ Generated by [AVA](https://avajs.dev). > Loading plugins␊ - netlify-plugin-contextual-env 0-4-0 from netlify.toml and package.json (latest 0-4-0, expected 0-4-1, compatible 0-4-1)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-4-0: version 1.0.0 is the most recent version compatible with Node.js <100␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -937,6 +940,9 @@ Generated by [AVA](https://avajs.dev). - netlify-plugin-contextual-env 0-1-0: latest version is 0-3-0␊ To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-1-0: version 1.0.0 is the most recent version compatible with Node.js <100␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -999,6 +1005,9 @@ Generated by [AVA](https://avajs.dev). - netlify-plugin-contextual-env 0-1-0: latest version is 0-3-0␊ To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-1-0: version 1.0.0 is the most recent version compatible with Node.js <100␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -1185,6 +1194,9 @@ Generated by [AVA](https://avajs.dev). - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-2-0: version 1.0.0 is the most recent version compatible with Node.js 6 - 120␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -1306,6 +1318,9 @@ Generated by [AVA](https://avajs.dev). Migration guide: http://test.com␊ To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-1-0: version 1.0.0 is the most recent version compatible with Node.js <100␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -1368,6 +1383,9 @@ Generated by [AVA](https://avajs.dev). - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-2-0: version 1.0.0 is the most recent version compatible with ansi-styles@<3␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -1604,6 +1622,9 @@ Generated by [AVA](https://avajs.dev). - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-2-0: version 1.0.0 is the most recent version compatible with ansi-styles@<3, Node.js <100␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -1666,6 +1687,9 @@ Generated by [AVA](https://avajs.dev). - netlify-plugin-contextual-env 0-2-0: latest version is 0-3-0␊ To upgrade this plugin, please remove it from "netlify.toml" and install it from the Netlify plugins directory instead (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-2-0: version 1.0.0 is the most recent version compatible with @netlify/dependency-with-range@<10␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ @@ -2627,6 +2651,9 @@ Generated by [AVA](https://avajs.dev). - netlify-plugin-contextual-env 0-3-0: latest version is 1-0-0␊ To upgrade this plugin, please uninstall and re-install it from the Netlify plugins directory (https://app.netlify.com/plugins)␊ ␊ + > Incompatible plugins␊ + - netlify-plugin-contextual-env 0-3-0: version 1.0.0 is the most recent version compatible with Node.js <100␊ + ␊ netlify-plugin-contextual-env (onPreBuild event) ␊ ────────────────────────────────────────────────────────────────␊ ␊ diff --git a/packages/build/tests/plugins_list/snapshots/tests.js.snap b/packages/build/tests/plugins_list/snapshots/tests.js.snap index 094b1e70f1..9d55f628c9 100644 Binary files a/packages/build/tests/plugins_list/snapshots/tests.js.snap and b/packages/build/tests/plugins_list/snapshots/tests.js.snap differ