Skip to content

Commit

Permalink
Update validation for Volto and Node versions (#49)
Browse files Browse the repository at this point in the history
* Update Node versions

* changelog

* Don't claim support for Volto versions from before the pnpm transition
  • Loading branch information
davisagli authored Nov 12, 2024
1 parent 530af43 commit 1f46ed8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
13 changes: 4 additions & 9 deletions cookieplone/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion cookieplone/utils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions news/49.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix validation of Volto and Node versions. @davisagli
2 changes: 1 addition & 1 deletion tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
5 changes: 2 additions & 3 deletions tests/utils/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1f46ed8

Please sign in to comment.