diff --git a/backend_addon/cookiecutter.json b/backend_addon/cookiecutter.json
index 78213c4..59e934b 100644
--- a/backend_addon/cookiecutter.json
+++ b/backend_addon/cookiecutter.json
@@ -9,6 +9,7 @@
"1",
"0"
],
+ "__feature_headless": "{{ cookiecutter.feature_headless }}",
"__package_name": "{{ cookiecutter.python_package_name | package_name }}",
"__package_namespace": "{{ cookiecutter.python_package_name | package_namespace }}",
"__folder_name": "{{ cookiecutter.python_package_name }}",
@@ -16,8 +17,6 @@
"__profile_language": "en",
"__version_package": "1.0.0a0",
"__profile_version": "1000",
- "__gha_enable": true,
- "__generator_date_short": "{% now 'utc', '%Y-%m-%d' %}",
"__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
"__generator_signature": "This was generated by [cookiecutter-plone](https://github.com/plone/cookieplone-templates/backend_addon) on {{ cookiecutter.__generator_date_long }}",
"__backend_addon_git_initialize": "1",
diff --git a/backend_addon/hooks/post_gen_project.py b/backend_addon/hooks/post_gen_project.py
index 3ae6377..98bd59d 100644
--- a/backend_addon/hooks/post_gen_project.py
+++ b/backend_addon/hooks/post_gen_project.py
@@ -32,9 +32,15 @@ def handle_git_initialization(context: OrderedDict, output_dir: Path):
def main():
"""Final fixes."""
output_dir = Path().cwd()
- remove_headless = not int(context.get("feature_headless"))
- initialize_git = bool(int(context.get("__backend_addon_git_initialize")))
- backend_format = bool(int(context.get("__backend_addon_format")))
+ remove_headless = not int(
+ context.get("feature_headless")
+ ) # {{ cookiecutter.__feature_headless }}
+ initialize_git = bool(
+ int(context.get("__backend_addon_git_initialize"))
+ ) # {{ cookiecutter.__backend_addon_git_initialize }}
+ backend_format = bool(
+ int(context.get("__backend_addon_format"))
+ ) # {{ cookiecutter.__backend_addon_format }}
# Cleanup / Git
actions = [
[
diff --git a/backend_addon/tests/conftest.py b/backend_addon/tests/conftest.py
index c6eb0ca..5f5d0bc 100644
--- a/backend_addon/tests/conftest.py
+++ b/backend_addon/tests/conftest.py
@@ -1,6 +1,5 @@
"""Pytest configuration."""
-import re
from copy import deepcopy
from pathlib import Path
from typing import List
@@ -73,11 +72,6 @@ def cookieplone_root() -> dict:
return parent
-@pytest.fixture(scope="session")
-def variable_pattern():
- return re.compile("{{( ?cookiecutter)[.](.*?)}}")
-
-
@pytest.fixture(scope="session")
def context(cookieplone_root) -> dict:
"""Cookiecutter context."""
diff --git a/backend_addon/tests/test_variables.py b/backend_addon/tests/test_variables.py
new file mode 100644
index 0000000..52b784e
--- /dev/null
+++ b/backend_addon/tests/test_variables.py
@@ -0,0 +1,14 @@
+ALLOWED_MISSING = []
+ALLOWED_NOT_USED = []
+
+
+def test_no_missing_variables(variables_missing):
+ """Test no variable is missing from cookiecutter.json"""
+ assert len(variables_missing) == len(ALLOWED_MISSING)
+ assert variables_missing == ALLOWED_MISSING
+
+
+def test_not_used_variables(variables_not_used):
+ """Test variables are used."""
+ assert len(variables_not_used) == len(ALLOWED_NOT_USED)
+ assert variables_not_used == ALLOWED_NOT_USED
diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/README.md b/backend_addon/{{ cookiecutter.__folder_name }}/README.md
index 7ca026a..b0c4574 100644
--- a/backend_addon/{{ cookiecutter.__folder_name }}/README.md
+++ b/backend_addon/{{ cookiecutter.__folder_name }}/README.md
@@ -33,3 +33,7 @@ make create_site
## License
The project is licensed under GPLv2.
+
+## Credits and Acknowledgements 🙏
+
+Crafted with care by **{{ cookiecutter.__generator_signature }}**. A special thanks to all contributors and supporters!
diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/setup.py b/backend_addon/{{ cookiecutter.__folder_name }}/setup.py
index 6d81f6c..2812a14 100644
--- a/backend_addon/{{ cookiecutter.__folder_name }}/setup.py
+++ b/backend_addon/{{ cookiecutter.__folder_name }}/setup.py
@@ -52,7 +52,7 @@
"setuptools",
"Plone",
"plone.api",
- {%- if cookiecutter.feature_headless == '1' %}
+ {%- if cookiecutter.__feature_headless == '1' %}
"plone.restapi",
"plone.volto",
{%- endif %}
diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/configure.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/configure.zcml
index 6f3fc90..4db272e 100644
--- a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/configure.zcml
+++ b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/configure.zcml
@@ -16,7 +16,7 @@
- {%- if cookiecutter.feature_headless == '1' %}
+ {%- if cookiecutter.__feature_headless == '1' %}
{%- endif %}
diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/dependencies.zcml b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/dependencies.zcml
index d096392..36fb75a 100644
--- a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/dependencies.zcml
+++ b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/dependencies.zcml
@@ -1,7 +1,7 @@
- {%- if cookiecutter.feature_headless == '1' %}
+ {%- if cookiecutter.__feature_headless == '1' %}
{%- endif %}
diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/metadata.xml b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/metadata.xml
index 8d8f114..e9868dc 100644
--- a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/metadata.xml
+++ b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/profiles/default/metadata.xml
@@ -2,7 +2,7 @@
{{ cookiecutter.__profile_version }}
- {%- if cookiecutter.feature_headless == '1' %}
+ {%- if cookiecutter.__feature_headless == '1' %}
profile-plone.restapi:default
profile-plone.volto:default
{%- endif %}
diff --git a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/testing.py b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/testing.py
index 4e859b6..a161642 100644
--- a/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/testing.py
+++ b/backend_addon/{{ cookiecutter.__folder_name }}/src/{{ cookiecutter.__package_namespace }}/{{ cookiecutter.__package_name }}/testing.py
@@ -16,7 +16,7 @@ def setUpZope(self, app, configurationContext):
# Load any other ZCML that is required for your tests.
# The z3c.autoinclude feature is disabled in the Plone fixture base
# layer.
- {%- if cookiecutter.feature_headless == '1' %}
+ {%- if cookiecutter.__feature_headless == '1' %}
import plone.restapi
self.loadZCML(package=plone.restapi)
diff --git a/frontend_addon/cookiecutter.json b/frontend_addon/cookiecutter.json
index a01adbb..3f57afe 100644
--- a/frontend_addon/cookiecutter.json
+++ b/frontend_addon/cookiecutter.json
@@ -8,14 +8,13 @@
"npm_package_name": "{{ cookiecutter.frontend_addon_name }}",
"volto_version": "{{ 'Yes' | latest_volto }}",
"__folder_name": "{{ cookiecutter.frontend_addon_name }}",
- "__gha_enable": true,
+ "__npm_package_name": "{{ cookiecutter.npm_package_name }}",
"__version_package": "1.0.0-alpha.0",
"__version_plone_volto": "{{ cookiecutter.volto_version }}",
"__version_plone_components": "1.7.0",
"__version_plone_scripts": "^3.6.1",
"__version_mrs_developer": "^2.2.0",
"__version_pnpm": "9.1.1",
- "__version_pnpm_major": "9",
"__version_release_it": "^17.1.1",
"__gha_version_node": "20.x",
"__gha_version_checkout": "v4",
@@ -24,7 +23,6 @@
"__gha_version_background_action": "v1",
"__gha_version_upload_artifact": "v4",
"__gha_version_pages_deploy": "v4",
- "__generator_date_short": "{% now 'utc', '%Y-%m-%d' %}",
"__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
"__generator_signature": "This was generated by [cookiecutter-volto](https://github.com/plone/cookiecutter-volto/frontend_addon) on {{ cookiecutter.__generator_date_long }}",
"__prompts__": {
diff --git a/frontend_addon/hooks/pre_gen_project.py b/frontend_addon/hooks/pre_gen_project.py
index 53fe3ad..d783a08 100644
--- a/frontend_addon/hooks/pre_gen_project.py
+++ b/frontend_addon/hooks/pre_gen_project.py
@@ -16,7 +16,7 @@
"author": "{{ cookiecutter.author }}",
"email": "{{ cookiecutter.email }}",
"github_organization": "{{ cookiecutter.github_organization }}",
- "npm_package_name": "{{ cookiecutter.npm_package_name }}",
+ "npm_package_name": "{{ cookiecutter.__npm_package_name }}",
}
diff --git a/frontend_addon/tests/conftest.py b/frontend_addon/tests/conftest.py
index 0ab2735..3aa9488 100644
--- a/frontend_addon/tests/conftest.py
+++ b/frontend_addon/tests/conftest.py
@@ -1,6 +1,5 @@
"""Pytest configuration."""
-import re
from copy import deepcopy
from pathlib import Path
from typing import List
@@ -8,11 +7,6 @@
import pytest
-@pytest.fixture(scope="session")
-def variable_pattern():
- return re.compile("{{( ?cookiecutter)[.](.*?)}}")
-
-
@pytest.fixture(scope="session")
def cookieplone_root() -> dict:
"""Cookieplone root dir."""
diff --git a/frontend_addon/tests/test_variables.py b/frontend_addon/tests/test_variables.py
new file mode 100644
index 0000000..52b784e
--- /dev/null
+++ b/frontend_addon/tests/test_variables.py
@@ -0,0 +1,14 @@
+ALLOWED_MISSING = []
+ALLOWED_NOT_USED = []
+
+
+def test_no_missing_variables(variables_missing):
+ """Test no variable is missing from cookiecutter.json"""
+ assert len(variables_missing) == len(ALLOWED_MISSING)
+ assert variables_missing == ALLOWED_MISSING
+
+
+def test_not_used_variables(variables_not_used):
+ """Test variables are used."""
+ assert len(variables_not_used) == len(ALLOWED_NOT_USED)
+ assert variables_not_used == ALLOWED_NOT_USED
diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/.eslintrc.js b/frontend_addon/{{ cookiecutter.__folder_name }}/.eslintrc.js
index 49ffa7c..9909ae4 100644
--- a/frontend_addon/{{ cookiecutter.__folder_name }}/.eslintrc.js
+++ b/frontend_addon/{{ cookiecutter.__folder_name }}/.eslintrc.js
@@ -23,7 +23,7 @@ module.exports = {
],
['@plone/registry', `${coreLocation}/packages/registry/src`],
[
- '{{ cookiecutter.npm_package_name }}',
+ '{{ cookiecutter.__npm_package_name }}',
'./packages/{{ cookiecutter.frontend_addon_name }}/src',
],
],
diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile b/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile
index 0487e1d..eb52e7b 100644
--- a/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile
+++ b/frontend_addon/{{ cookiecutter.__folder_name }}/Makefile
@@ -23,7 +23,7 @@ PLONE_VERSION=6
DOCKER_IMAGE=plone/server-dev:${PLONE_VERSION}
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION}
-ADDON_NAME='{{ cookiecutter.npm_package_name }}'
+ADDON_NAME='{{ cookiecutter.__npm_package_name }}'
.PHONY: help
help: ## Show this help
diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/README.md b/frontend_addon/{{ cookiecutter.__folder_name }}/README.md
index 03313dd..7dd3830 100644
--- a/frontend_addon/{{ cookiecutter.__folder_name }}/README.md
+++ b/frontend_addon/{{ cookiecutter.__folder_name }}/README.md
@@ -1,8 +1,8 @@
-# {{ cookiecutter.title }} ({{ cookiecutter.npm_package_name }})
+# {{ cookiecutter.title }} ({{ cookiecutter.__npm_package_name }})
{{ cookiecutter.description }}
-[![npm](https://img.shields.io/npm/v/{{ cookiecutter.npm_package_name }})](https://www.npmjs.com/package/{{ cookiecutter.npm_package_name }})
+[![npm](https://img.shields.io/npm/v/{{ cookiecutter.__npm_package_name }})](https://www.npmjs.com/package/{{ cookiecutter.__npm_package_name }})
[![](https://img.shields.io/badge/-Storybook-ff4785?logo=Storybook&logoColor=white&style=flat-square)](https://{{ cookiecutter.github_organization }}.github.io/{{ cookiecutter.frontend_addon_name }}/)
[![Code analysis checks](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.frontend_addon_name }}/actions/workflows/code.yml/badge.svg)](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.frontend_addon_name }}/actions/workflows/code.yml)
[![Unit tests](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.frontend_addon_name }}/actions/workflows/unit.yml/badge.svg)](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.frontend_addon_name }}/actions/workflows/unit.yml)
@@ -22,19 +22,19 @@ Create a new Volto project (you can skip this step if you already have one):
```
npm install -g yo @plone/generator-volto
-yo @plone/volto my-volto-project --addon {{ cookiecutter.npm_package_name }}
+yo @plone/volto my-volto-project --addon {{ cookiecutter.__npm_package_name }}
cd my-volto-project
```
-Add `{{ cookiecutter.npm_package_name }}` to your package.json:
+Add `{{ cookiecutter.__npm_package_name }}` to your package.json:
```JSON
"addons": [
- "{{ cookiecutter.npm_package_name }}"
+ "{{ cookiecutter.__npm_package_name }}"
],
"dependencies": {
- "{{ cookiecutter.npm_package_name }}": "*"
+ "{{ cookiecutter.__npm_package_name }}": "*"
}
```
@@ -52,24 +52,24 @@ yarn start
### Volto 18 and later
-Add `{{ cookiecutter.npm_package_name }}` to your `package.json`:
+Add `{{ cookiecutter.__npm_package_name }}` to your `package.json`:
```json
"dependencies": {
- "{{ cookiecutter.npm_package_name }}": "*"
+ "{{ cookiecutter.__npm_package_name }}": "*"
}
```
-Add `{{ cookiecutter.npm_package_name }}` to your `volto.config.js`:
+Add `{{ cookiecutter.__npm_package_name }}` to your `volto.config.js`:
```javascript
-const addons = ['{{ cookiecutter.npm_package_name }}'];
+const addons = ['{{ cookiecutter.__npm_package_name }}'];
```
If this package provides a Volto theme, and you want to activate it, then add the following to your `volto.config.js`:
```javascript
-const theme = '{{ cookiecutter.npm_package_name }}';
+const theme = '{{ cookiecutter.__npm_package_name }}';
```
## Test installation
@@ -191,3 +191,7 @@ make test-acceptance
## License
The project is licensed under the MIT license.
+
+## Credits and Acknowledgements 🙏
+
+Crafted with care by **{{ cookiecutter.__generator_signature }}**. A special thanks to all contributors and supporters!
diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/package.json b/frontend_addon/{{ cookiecutter.__folder_name }}/package.json
index 4fa0896..62823c3 100644
--- a/frontend_addon/{{ cookiecutter.__folder_name }}/package.json
+++ b/frontend_addon/{{ cookiecutter.__folder_name }}/package.json
@@ -1,5 +1,5 @@
{
- "name": "{{ cookiecutter.npm_package_name }}-dev",
+ "name": "{{ cookiecutter.__npm_package_name }}-dev",
"version": "{{ cookiecutter.__version_package }}",
"description": "{{ cookiecutter.description }}",
"author": "{{ cookiecutter.author }}",
@@ -17,7 +17,7 @@
"start:prod": "pnpm --filter @plone/volto start:prod",
"build": "pnpm build:deps && VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto build",
"build:deps": "pnpm --filter @plone/registry --filter @plone/components build",
- "i18n": "pnpm --filter {{ cookiecutter.npm_package_name }} i18n",
+ "i18n": "pnpm --filter {{ cookiecutter.__npm_package_name }} i18n",
"test": "RAZZLE_JEST_CONFIG=$(pwd)/jest-addon.config.js pnpm --filter @plone/volto test -- --passWithNoTests",
"lint": "eslint --max-warnings=0 'packages/**/src/**/*.{js,jsx,ts,tsx}'",
"lint:fix": "eslint --fix 'packages/**/src/**/*.{js,jsx,ts,tsx}'",
@@ -25,17 +25,17 @@
"prettier:fix": "prettier --write 'packages/**/src/**/*.{js,jsx,ts,tsx}' ",
"stylelint": "stylelint 'packages/**/src/**/*.{css,scss,less}' --allow-empty-input",
"stylelint:fix": "stylelint 'packages/**/src/**/*.{css,scss,less}' --fix --allow-empty-input",
- "dry-release": "pnpm --filter {{ cookiecutter.npm_package_name }} dry-release",
- "release": "pnpm --filter {{ cookiecutter.npm_package_name }} release",
- "release-major-alpha": "pnpm --filter {{ cookiecutter.npm_package_name }} release-major-alpha",
- "release-alpha": "pnpm --filter {{ cookiecutter.npm_package_name }} release-alpha",
+ "dry-release": "pnpm --filter {{ cookiecutter.__npm_package_name }} dry-release",
+ "release": "pnpm --filter {{ cookiecutter.__npm_package_name }} release",
+ "release-major-alpha": "pnpm --filter {{ cookiecutter.__npm_package_name }} release-major-alpha",
+ "release-alpha": "pnpm --filter {{ cookiecutter.__npm_package_name }} release-alpha",
"storybook": "pnpm build:deps && VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto storybook dev -p 6006 -c $(pwd)/.storybook",
"build-storybook": "pnpm build:deps && VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto build-storybook -c $(pwd)/.storybook"
},
"dependencies": {
"@plone/volto": "workspace:*",
"@plone/registry": "workspace:*",
- "{{ cookiecutter.npm_package_name }}": "workspace:*"
+ "{{ cookiecutter.__npm_package_name }}": "workspace:*"
},
"devDependencies": {
"mrs-developer": "{{ cookiecutter.__version_mrs_developer }}"
diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/packages/{{ cookiecutter.frontend_addon_name }}/package.json b/frontend_addon/{{ cookiecutter.__folder_name }}/packages/{{ cookiecutter.frontend_addon_name }}/package.json
index 11df89a..9586220 100644
--- a/frontend_addon/{{ cookiecutter.__folder_name }}/packages/{{ cookiecutter.frontend_addon_name }}/package.json
+++ b/frontend_addon/{{ cookiecutter.__folder_name }}/packages/{{ cookiecutter.frontend_addon_name }}/package.json
@@ -1,5 +1,5 @@
{
- "name": "{{ cookiecutter.npm_package_name }}",
+ "name": "{{ cookiecutter.__npm_package_name }}",
"version": "{{ cookiecutter.__version_package }}",
"description": "{{ cookiecutter.description }}",
"main": "src/index.js",
diff --git a/frontend_addon/{{ cookiecutter.__folder_name }}/volto.config.js b/frontend_addon/{{ cookiecutter.__folder_name }}/volto.config.js
index 5c0ebec..0bd9c8c 100644
--- a/frontend_addon/{{ cookiecutter.__folder_name }}/volto.config.js
+++ b/frontend_addon/{{ cookiecutter.__folder_name }}/volto.config.js
@@ -1,4 +1,4 @@
-const addons = ['{{ cookiecutter.npm_package_name }}'];
+const addons = ['{{ cookiecutter.__npm_package_name }}'];
const theme = '';
module.exports = {
diff --git a/project/cookiecutter.json b/project/cookiecutter.json
index 42e3ad0..aa44530 100644
--- a/project/cookiecutter.json
+++ b/project/cookiecutter.json
@@ -36,6 +36,7 @@
"1",
"0"
],
+ "__feature_headless": "1",
"__npm_package_name": "{{ cookiecutter.frontend_addon_name }}",
"__folder_name": "{{ cookiecutter.project_slug }}",
"__python_package_name_upper": "{{ cookiecutter.python_package_name | pascal_case }}",
@@ -50,10 +51,8 @@
"__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
"__generator_signature": "This was generated by [cookieplone-templates](https://github.com/plone/cookieplone-templates) on {{ cookiecutter.__generator_date_long }}",
"__pre_commit_version": "3.7.1",
- "__gha_enable": true,
"__gha_version_checkout": "v4",
"__gha_version_setup_node": "v4",
- "__gha_version_setup_pnpm": "v4",
"__gha_version_cache": "v4",
"__gha_version_docker_stack": "v1.2.0",
"__gha_version_code_analysis": "v2",
@@ -75,7 +74,6 @@
"__devops_db_password": "{{ random_ascii_string(12) }}",
"__backend_addon_format": "1",
"__backend_addon_git_initialize": "0",
- "__frontend_addon_git_initialize": "0",
"__project_git_initialize": "1",
"__prompts__": {
"title": "Project Title",
diff --git a/project/hooks/post_gen_project.py b/project/hooks/post_gen_project.py
index 6655d4e..818e8c4 100644
--- a/project/hooks/post_gen_project.py
+++ b/project/hooks/post_gen_project.py
@@ -95,19 +95,25 @@ def main():
"""Final fixes."""
output_dir = Path().cwd()
- initialize_git = bool(int(context.get("__project_git_initialize")))
- backend_format = bool(int(context.get("__backend_addon_format")))
+ initialize_git = bool(
+ int(context.get("__project_git_initialize"))
+ ) # {{ cookiecutter.__project_git_initialize }}
+ backend_format = bool(
+ int(context.get("__backend_addon_format"))
+ ) # {{ cookiecutter.__backend_addon_format }}
# Cleanup / Git
actions = [
[
handle_devops_ansible,
"Remove Ansible files",
- not int(context.get("devops_ansible")),
+ not int(context.get("devops_ansible")), # {{ cookiecutter.devops_ansible }}
],
[
handle_devops_gha_deploy,
"Remove GHA deployment files",
- not int(context.get("devops_gha_deploy")),
+ not int(
+ context.get("devops_gha_deploy")
+ ), # {{ cookiecutter.devops_gha_deploy }}
],
[
handle_git_initialization,
@@ -122,7 +128,9 @@ def main():
console.print(f" -> {title}")
func(new_context, output_dir)
- subtemplates = context.get("__cookieplone_subtemplates", [])
+ subtemplates = context.get(
+ "__cookieplone_subtemplates", []
+ ) # {{ cookiecutter.__cookieplone_subtemplates }}
funcs = {k: v for k, v in globals().items() if k.startswith("generate_")}
for template_id, title, enabled in subtemplates:
# Convert sub/cache -> prepare_sub_cache
diff --git a/project/tests/test_cutter.py b/project/tests/test_cutter.py
index 526c8d9..7d0d372 100644
--- a/project/tests/test_cutter.py
+++ b/project/tests/test_cutter.py
@@ -1,14 +1,10 @@
"""Test cookiecutter generation."""
-import re
from pathlib import Path
from typing import List
import pytest
-PATTERN = "{{( ?cookiecutter)[.](.*?)}}"
-RE_OBJ = re.compile(PATTERN)
-
def build_files_list(root_dir: Path) -> List[Path]:
"""Build a list containing absolute paths to the generated files."""
@@ -24,12 +20,12 @@ def test_default_configuration(cookies, context: dict):
assert result.project_path.is_dir()
-def test_variable_substitution(cutter_result):
+def test_variable_substitution(cutter_result, variable_pattern):
"""Check if no file was unprocessed."""
paths = build_files_list(cutter_result.project_path)
for path in paths:
for line in open(path, "r"):
- match = RE_OBJ.search(line)
+ match = variable_pattern.search(line)
msg = f"cookiecutter variable not replaced in {path}"
assert match is None, msg
diff --git a/project/tests/test_variables.py b/project/tests/test_variables.py
new file mode 100644
index 0000000..746de3a
--- /dev/null
+++ b/project/tests/test_variables.py
@@ -0,0 +1,14 @@
+ALLOWED_MISSING = ["feature_headless", "npm_package_name"]
+ALLOWED_NOT_USED = []
+
+
+def test_no_missing_variables(variables_missing):
+ """Test no variable is missing from cookiecutter.json"""
+ assert len(variables_missing) == len(ALLOWED_MISSING)
+ assert variables_missing == ALLOWED_MISSING
+
+
+def test_not_used_variables(variables_not_used):
+ """Test variables are used."""
+ assert len(variables_not_used) == len(ALLOWED_NOT_USED)
+ assert variables_not_used == ALLOWED_NOT_USED
diff --git a/requirements.txt b/requirements.txt
index e284e8f..1b3107a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,6 +4,6 @@ isort
pytest
pytest-cookies
pytest-jsonschema >= 1.0.0a2
-cookieplone>=0.6.3
+cookieplone>=0.7.0
GitPython
wheel
diff --git a/sub/cache/cookiecutter.json b/sub/cache/cookiecutter.json
index 9a498f2..4415f5a 100644
--- a/sub/cache/cookiecutter.json
+++ b/sub/cache/cookiecutter.json
@@ -1,8 +1,6 @@
{
"title": "Project Title",
- "description": "A new project using Plone 6.",
"project_slug": "{{ cookiecutter.title | slugify }}",
- "hostname": "{{ cookiecutter.project_slug }}.example.com",
"author": "Plone Foundation",
"email": "collective@plone.org",
"python_package_name": "{{ cookiecutter.project_slug|replace(' ', '')|replace('-', '.') }}",
@@ -17,29 +15,13 @@
"__package_namespace": "{{ cookiecutter.python_package_name | package_namespace }}",
"__container_registry_prefix": "{{ cookiecutter.container_registry | image_prefix }}",
"__container_image_prefix": "{{ cookiecutter.__container_registry_prefix }}{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}",
- "__generator_date_short": "{% now 'utc', '%Y-%m-%d' %}",
- "__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
- "__generator_signature": "This was generated by [cookieplone-templates](https://github.com/plone/cookieplone-templates) on {{ cookiecutter.__generator_date_long }}",
- "__gha_enable": true,
"__gha_version_checkout": "v4",
- "__gha_version_docker_stack": "v1.2.0",
- "__gha_version_code_analysis": "v2",
"__gha_version_docker_metadata": "v5",
"__gha_version_docker_qemu": "v3",
"__gha_version_docker_buildx": "v3",
"__gha_version_docker_login": "v3",
"__gha_version_docker_build_push": "v4",
- "__devops_host": "{{ cookiecutter.hostname | extract_host }}",
- "__devops_compose_name": "{{ cookiecutter.project_slug | replace('.','-') | replace('_','-') }}",
- "__devops_stack_name": "{{ cookiecutter.hostname | replace('.','-') | replace('_','-') }}",
- "__devops_swarm_public_network": "nw-internal",
- "__devops_traefik_version": "v2.10",
- "__devops_traefik_local_include_ui": "yes",
- "__devops_traefik_stack_include_ui": "no",
- "__devops_traefik_docker_network": "{{ cookiecutter.__devops_stack_name }}_{{ cookiecutter.__devops_swarm_public_network }}",
"__devops_varnish_version": "7.4",
- "__devops_db_version": "14",
- "__devops_db_password": "{{ random_ascii_string(12) }}",
"_copy_without_render": [
],
"_extensions": [
diff --git a/sub/cache/tests/conftest.py b/sub/cache/tests/conftest.py
index c916c6d..4484509 100644
--- a/sub/cache/tests/conftest.py
+++ b/sub/cache/tests/conftest.py
@@ -1,18 +1,11 @@
"""Pytest configuration."""
-import re
-from copy import deepcopy
from pathlib import Path
from typing import List
import pytest
-@pytest.fixture(scope="session")
-def variable_pattern():
- return re.compile("{{( ?cookiecutter)[.](.*?)}}")
-
-
@pytest.fixture(scope="session")
def cookieplone_root() -> dict:
"""Cookieplone root dir."""
diff --git a/sub/cache/tests/test_variables.py b/sub/cache/tests/test_variables.py
new file mode 100644
index 0000000..52b784e
--- /dev/null
+++ b/sub/cache/tests/test_variables.py
@@ -0,0 +1,14 @@
+ALLOWED_MISSING = []
+ALLOWED_NOT_USED = []
+
+
+def test_no_missing_variables(variables_missing):
+ """Test no variable is missing from cookiecutter.json"""
+ assert len(variables_missing) == len(ALLOWED_MISSING)
+ assert variables_missing == ALLOWED_MISSING
+
+
+def test_not_used_variables(variables_not_used):
+ """Test variables are used."""
+ assert len(variables_not_used) == len(ALLOWED_NOT_USED)
+ assert variables_not_used == ALLOWED_NOT_USED
diff --git a/sub/frontend_project/cookiecutter.json b/sub/frontend_project/cookiecutter.json
index 29cc932..23e1119 100644
--- a/sub/frontend_project/cookiecutter.json
+++ b/sub/frontend_project/cookiecutter.json
@@ -2,19 +2,13 @@
"title": "Frontend Project",
"volto_version": "{{ 'Yes' | latest_volto }}",
"author": "Plone Community",
- "email": "collective@plone.org",
"__folder_name": "app",
- "__gha_enable": true,
"__version_plone_volto": "{{ cookiecutter.volto_version }}",
- "__generator_date_short": "{% now 'utc', '%Y-%m-%d' %}",
- "__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
- "__generator_signature": "This was generated by [cookieplone-templates](https://github.com/plone/cookieplone-templates) on {{ cookiecutter.__generator_date_long }}",
"__prompts__": {
"title": "Project name",
"volto_version": "Volto version"
},
"_copy_without_render": [
- "_project_files"
],
"_extensions": [
"cookieplone.filters.latest_volto"
diff --git a/sub/frontend_project/tests/conftest.py b/sub/frontend_project/tests/conftest.py
index 7c950dd..307edbc 100644
--- a/sub/frontend_project/tests/conftest.py
+++ b/sub/frontend_project/tests/conftest.py
@@ -1,18 +1,11 @@
"""Pytest configuration."""
-import re
-from copy import deepcopy
from pathlib import Path
from typing import List
import pytest
-@pytest.fixture(scope="session")
-def variable_pattern():
- return re.compile("{{( ?cookiecutter)[.](.*?)}}")
-
-
@pytest.fixture(scope="session")
def cookieplone_root() -> dict:
"""Cookieplone root dir."""
diff --git a/sub/frontend_project/tests/test_variables.py b/sub/frontend_project/tests/test_variables.py
new file mode 100644
index 0000000..52b784e
--- /dev/null
+++ b/sub/frontend_project/tests/test_variables.py
@@ -0,0 +1,14 @@
+ALLOWED_MISSING = []
+ALLOWED_NOT_USED = []
+
+
+def test_no_missing_variables(variables_missing):
+ """Test no variable is missing from cookiecutter.json"""
+ assert len(variables_missing) == len(ALLOWED_MISSING)
+ assert variables_missing == ALLOWED_MISSING
+
+
+def test_not_used_variables(variables_not_used):
+ """Test variables are used."""
+ assert len(variables_not_used) == len(ALLOWED_NOT_USED)
+ assert variables_not_used == ALLOWED_NOT_USED
diff --git a/sub/frontend_project/{{ cookiecutter.__folder_name }}/_project_files/package.json b/sub/frontend_project/{{ cookiecutter.__folder_name }}/_project_files/package.json
index 570c346..1a9ba71 100644
--- a/sub/frontend_project/{{ cookiecutter.__folder_name }}/_project_files/package.json
+++ b/sub/frontend_project/{{ cookiecutter.__folder_name }}/_project_files/package.json
@@ -2,7 +2,7 @@
"name": "project-dev",
"version": "1.0.0-alpha.0",
"description": "A new project with Plone & Volto",
- "author": "Plone Foundation",
+ "author": "{{ cookiecutter.author }}",
"homepage": "https://plone.org",
"license": "MIT",
"keywords": [
diff --git a/sub/project_settings/cookiecutter.json b/sub/project_settings/cookiecutter.json
index e9331dc..fe9d560 100644
--- a/sub/project_settings/cookiecutter.json
+++ b/sub/project_settings/cookiecutter.json
@@ -8,7 +8,6 @@
"frontend_addon_name": "volto-{{ cookiecutter.python_package_name|replace('_', '-')|replace('.', '-') }}",
"language_code": "en",
"plone_version": "{{ 'No' | latest_plone }}",
- "volto_version": "{{ 'Yes' | latest_volto }}",
"github_organization": "collective",
"container_registry": ["github", "docker_hub", "gitlab"],
"__version_package": "1.0.0a0",
@@ -18,11 +17,8 @@
"__folder_name": "{{ cookiecutter.project_slug }}",
"__package_name": "{{ cookiecutter.python_package_name | package_name }}",
"__package_namespace": "{{ cookiecutter.python_package_name | package_namespace }}",
- "__python_package_name_upper": "{{ cookiecutter.python_package_name | pascal_case }}",
- "__profile_version": "{% now 'utc', '%Y%m%d001' %}",
"__profile_language": "{{ cookiecutter.language_code|gs_language_code }}",
"__locales_language": "{{ cookiecutter.language_code|locales_language_code }}",
- "__node_version": "{{ cookiecutter.volto_version | node_version_for_volto }}",
"_copy_without_render": [],
"_extensions": [
"cookieplone.filters.use_prerelease_versions",
diff --git a/sub/project_settings/tests/conftest.py b/sub/project_settings/tests/conftest.py
index 9b4c15d..1ad75b2 100644
--- a/sub/project_settings/tests/conftest.py
+++ b/sub/project_settings/tests/conftest.py
@@ -1,18 +1,11 @@
"""Pytest configuration."""
-import re
-from copy import deepcopy
from pathlib import Path
from typing import List
import pytest
-@pytest.fixture(scope="session")
-def variable_pattern():
- return re.compile("{{( ?cookiecutter)[.](.*?)}}")
-
-
@pytest.fixture(scope="session")
def cookieplone_root() -> dict:
"""Cookieplone root dir."""
diff --git a/sub/project_settings/tests/test_variables.py b/sub/project_settings/tests/test_variables.py
new file mode 100644
index 0000000..52b784e
--- /dev/null
+++ b/sub/project_settings/tests/test_variables.py
@@ -0,0 +1,14 @@
+ALLOWED_MISSING = []
+ALLOWED_NOT_USED = []
+
+
+def test_no_missing_variables(variables_missing):
+ """Test no variable is missing from cookiecutter.json"""
+ assert len(variables_missing) == len(ALLOWED_MISSING)
+ assert variables_missing == ALLOWED_MISSING
+
+
+def test_not_used_variables(variables_not_used):
+ """Test variables are used."""
+ assert len(variables_not_used) == len(ALLOWED_NOT_USED)
+ assert variables_not_used == ALLOWED_NOT_USED