Repository: plone/cookieplone

Issue:
Volto 18 supports Node 22, but cookieplone rejects it
See https://community.plone.org/t/plone-6-1-beta-and-volto-18-released/20052/2

Hints from issue comments:

Solution patch:
diff --git a/cookieplone/settings.py b/cookieplone/settings.py
index 6d8a677..baafd54 100644
--- a/cookieplone/settings.py
+++ b/cookieplone/settings.py
@@ -11,21 +11,16 @@
     "3.12",
 ]
 
-DEFAULT_NODE = 18
+DEFAULT_NODE = 22
 SUPPORTED_NODE_VERSIONS = [
-    "16",
-    "17",
-    "18",
-    "19",
     "20",
+    "22",
 ]
 
 
-VOLTO_MIN_VERSION = "16"
+VOLTO_MIN_VERSION = "18.0.0-alpha.1"
 VOLTO_NODE = {
-    16: 16,
-    17: DEFAULT_NODE,
-    18: 20,
+    18: 22,
 }
 MIN_DOCKER_VERSION = "20.10"
 
diff --git a/cookieplone/utils/validators.py b/cookieplone/utils/validators.py
index 2f6b522..16fc213 100644
--- a/cookieplone/utils/validators.py
+++ b/cookieplone/utils/validators.py
@@ -94,7 +94,7 @@ def validate_volto_version(value: str) -> str:
     status = bool(version) and (
         version >= _version_from_str(settings.VOLTO_MIN_VERSION)
     )
-    return "" if status else f"{value} is not a valid Volto version."
+    return "" if status else f"Volto version {value} is not supported by this template."
 
 
 def run_context_validations(
diff --git a/news/49.bugfix b/news/49.bugfix
new file mode 100644
index 0000000..20e6119
--- /dev/null
+++ b/news/49.bugfix
@@ -0,0 +1 @@
+Fix validation of Volto and Node versions. @davisagli


Test patch:
diff --git a/tests/test_filters.py b/tests/test_filters.py
index 9ccabab..69c87c6 100644
--- a/tests/test_filters.py
+++ b/tests/test_filters.py
@@ -37,7 +37,7 @@ def func(filter_: str) -> Path:
         ["package_path", "{{'foo.bar.baz' | package_path}}", "foo/bar/baz"],
         ["pascal_case", "{{'foo_bar' | pascal_case}}", "FooBar"],
         ["use_prerelease_versions", "{{ '' | use_prerelease_versions }}", "No"],
-        ["node_version_for_volto", "{{'17' | node_version_for_volto}}", "18"],
+        ["node_version_for_volto", "{{'18' | node_version_for_volto}}", "22"],
         ["gs_language_code", "{{'ES' | gs_language_code}}", "es"],
         ["gs_language_code", "{{'es-MX' | gs_language_code}}", "es-mx"],
         ["locales_language_code", "{{'es-mx' | locales_language_code}}", "es_MX"],
diff --git a/tests/utils/test_validators.py b/tests/utils/test_validators.py
index 5c7c56a..e8973bf 100644
--- a/tests/utils/test_validators.py
+++ b/tests/utils/test_validators.py
@@ -184,10 +184,9 @@ def test_validate_plone_version(version: str, expected: str):
 @pytest.mark.parametrize(
     "version,expected",
     (
-        ("14.0.0", "14.0.0 is not a valid Volto version."),
         ("18.0.0-alpha.21", ""),
-        ("17.0.0", ""),
-        ("16.15.1", ""),
+        ("17.0.0", "Volto version 17.0.0 is not supported by this template."),
+        ("16.15.1", "Volto version 16.15.1 is not supported by this template."),
     ),
 )
 def test_validate_volto_version(version: str, expected: str):