Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/221.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unify usage of path to the repository on templates. @ericof
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Collection of templates for Plone integrators to use through Cook
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"cookieplone>=0.9.6",
"cookieplone>=0.9.7",
"gitpython>=3.1.43",
"pytest>=8.3.5",
"pytest-cookies>=0.7.0",
Expand Down
1 change: 1 addition & 0 deletions templates/add-ons/backend/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"initialize_documentation": ["1", "0"],
"__project_slug": "{{ cookiecutter.python_package_name }}",
"__repository_url": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__repository_git": "[email protected]:{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__feature_headless": "{{ cookiecutter.feature_headless }}",
"__feature_distribution": "0",
"__package_path": "{{ cookiecutter.python_package_name | package_path }}",
Expand Down
17 changes: 17 additions & 0 deletions templates/add-ons/backend/hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Pre generation hook."""

from collections import OrderedDict
from pathlib import Path

output_path = Path().resolve()

context: OrderedDict = {{cookiecutter}}


def main():
"""Validate context."""
pass


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,34 @@ And to create the Plone site:
make create-site
```

## Add features using `plonecli` or `bobtemplates.plone`
## Contribute

- [Issue Tracker]({{ cookiecutter.__repository_url }}/issues)
- [Source Code]({{ cookiecutter.__repository_url }}/)

### Prerequisites ✅

Ensure you have the following installed:

- UV 🐍
- git 🔗
- Docker 🐳

### Installation 🔧

1. Clone the repository:

```shell
git clone {{ cookiecutter.__repository_git }}.git
cd {{ cookiecutter.__project_slug }}
```
2. Install this codebase

```shell
make install
```

### Add features using `plonecli` or `bobtemplates.plone`

This package provides markers as strings (`<!-- extra stuff goes here -->`) that are compatible with [`plonecli`](https://github.com/plone/plonecli) and [`bobtemplates.plone`](https://github.com/plone/bobtemplates.plone).
These markers act as hooks to add all kinds of subtemplates, including behaviors, control panels, upgrade steps, or other subtemplates from `plonecli`.
Expand Down Expand Up @@ -48,11 +75,6 @@ You can check the list of available subtemplates in the [`bobtemplates.plone` `R
See also the documentation of [Mockup and Patternslib](https://6.docs.plone.org/classic-ui/mockup.html) for how to build the UI toolkit for Classic UI.
```

## Contribute

- [Issue Tracker]({{ cookiecutter.__repository_url }}/issues)
- [Source Code]({{ cookiecutter.__repository_url }}/)

## License

The project is licensed under GPLv2.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"""Update locales."""

from pathlib import Path

import logging
import re
import subprocess

from pathlib import Path

logger = logging.getLogger("i18n")
logger.setLevel(logging.DEBUG)
Expand All @@ -17,7 +15,7 @@
target_path = locale_path.parent.resolve()
domains = [path.name[:-4] for path in locale_path.glob("*.pot")]

i18ndude = "uv run i18ndude"
i18ndude = "uvx i18ndude"

# ignore node_modules files resulting in errors
excludes = '"*.html *json-schema*.xml"'
Expand Down
6 changes: 3 additions & 3 deletions templates/add-ons/documentation_starter/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"email": "[email protected]",
"github_organization": "collective",
"initialize_git": ["1", "0"],
"plone_version": "6.0",
"__folder_name": "{{ cookiecutter.github_organization|lower }}.{{ cookiecutter.title|replace(' ', '')|replace('-', '_')|replace('.', '')|lower }}",
"__normalized_package_name": "{{ cookiecutter.title|replace(' ', '')|replace('-', '_')|replace('.', '')|lower }}",
"__project_slug": "{{ cookiecutter.__normalized_package_name }}",
"__repository_url": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__repository_git": "[email protected]:{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__year": "{% now 'local', '%Y' %}",
"__profile_language": "en",
"__version_package": "1.0.0a0",
"__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
"__generator_signature": "This was generated by the [cookieplone-templates documentation_starter template](https://github.com/plone/cookieplone-templates/tree/main/documentation_starter) on {{ cookiecutter.__generator_date_long }}",
"__documentation_starter_format": "1",
Expand Down
17 changes: 17 additions & 0 deletions templates/add-ons/documentation_starter/hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Pre generation hook."""

from collections import OrderedDict
from pathlib import Path

output_path = Path().resolve()

context: OrderedDict = {{cookiecutter}}


def main():
"""Validate context."""
pass


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ See also Read the Docs documentation:

- [Pull request previews](https://docs.readthedocs.com/platform/stable/pull-requests.html)
- [Build process overview](https://docs.readthedocs.com/platform/stable/builds.html)

## Credits and Acknowledgements 🙏

{{ cookiecutter.__generator_signature }}. A special thanks to all contributors and supporters!
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

# -- Project information -----------------------------------------------------

project = "{{cookiecutter.title}}"
author = "{{cookiecutter.author}}"
trademark_name = "{{cookiecutter.github_organization}}"
project = "{{ cookiecutter.title }}"
author = "{{ cookiecutter.author }}"
trademark_name = "{{ cookiecutter.github_organization }}"
now = datetime.now()
year = str(now.year)
copyright = year
Expand Down Expand Up @@ -95,7 +95,7 @@
# Ignore file downloads
r"^/_static/",
# Ignore pages that require authentication
r"https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__normalized_package_name }}/issues/new", # requires auth
r"{{ cookiecutter.__repository_url }}/issues/new", # requires auth
# Ignore github.com pages with anchors
r"https://github.com/.*#.*",
# Ignore other specific anchors
Expand Down Expand Up @@ -155,7 +155,7 @@
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__normalized_package_name }}",
"url": "{{ cookiecutter.__repository_url }}",
"icon": "fa-brands fa-square-github",
"type": "fontawesome",
"attributes": {
Expand All @@ -182,7 +182,7 @@
"navigation_with_keys": True,
"path_to_docs": "docs/{{ cookiecutter.__folder_name }}",
"repository_branch": "main",
"repository_url": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__normalized_package_name }}",
"repository_url": "{{ cookiecutter.__repository_url }}",
"search_bar_text": "Search",
"show_toc_level": 2,
"use_edit_page_button": True,
Expand All @@ -192,7 +192,7 @@
# suggest edit link
# remark: is mandatory in "edit_page_url_template"
# html_context = {
# "edit_page_url_template": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__normalized_package_name }}/edit/main/docs/",
# "edit_page_url_template": "{{ cookiecutter.__repository_url }}/edit/main/docs/",
# }

# Announce that we have an opensearch plugin
Expand All @@ -201,7 +201,7 @@

# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
html_title = "%(project)s v%(release)s" % {"project": project, "release": release}
html_title = f"{project} v{release}"

# If false, no index is generated.
html_use_index = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dev = [
]

[project.urls]
Repository = "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__normalized_package_name }}"
Repository = "{{ cookiecutter.__repository_url }}"
Documentation = "https://MY_READTHEDOCS_PROJECT_SLUG.readthedocs.io/"

[build-system]
Expand Down
1 change: 1 addition & 0 deletions templates/add-ons/frontend/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"initialize_documentation": ["1", "0"],
"__project_slug": "{{ cookiecutter.frontend_addon_name }}",
"__repository_url": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__repository_git": "[email protected]:{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__folder_name": "{{ cookiecutter.frontend_addon_name }}",
"__npm_package_name": "{{ cookiecutter.npm_package_name }}",
"__version_frontend_package": "1.0.0-alpha.0",
Expand Down
11 changes: 2 additions & 9 deletions templates/add-ons/frontend/hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Pre generation hook."""

import sys
from collections import OrderedDict
from pathlib import Path
from textwrap import dedent

Expand All @@ -9,15 +10,7 @@

output_path = Path().resolve()

context = {
"frontend_addon_name": "{{ cookiecutter.frontend_addon_name }}",
"title": "{{ cookiecutter.title }}",
"description": "{{ cookiecutter.description }}",
"author": "{{ cookiecutter.author }}",
"email": "{{ cookiecutter.email }}",
"github_organization": "{{ cookiecutter.github_organization }}",
"npm_package_name": "{{ cookiecutter.__npm_package_name }}",
}
context: OrderedDict = {{cookiecutter}}


def check_errors(context: dict) -> data.ContextValidatorResult:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,25 @@ The development of this add-on is done in isolation using a new approach using p
For this reason, it only works with pnpm and Volto 18 (currently in alpha).


### Pre-requisites
### Prerequisites ✅

- [Node.js](https://6.docs.plone.org/install/create-project.html#node-js)
- [Make](https://6.docs.plone.org/install/create-project.html#make)
- [Docker](https://6.docs.plone.org/install/create-project.html#docker)

### Installation 🔧

1. Clone the repository:

```shell
git clone {{ cookiecutter.__repository_git }}.git
cd {{ cookiecutter.__project_slug }}
```
2. Install this codebase

```shell
make install
```

### Make convenience commands

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"homepage": "{{ cookiecutter.__repository_url }}#readme",
"repository": {
"type": "git",
"url": "[email protected]:{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}.git"
"url": "{{ cookiecutter.__repository_git }}"
},
"publishConfig": {
"access": "public"
Expand All @@ -26,6 +26,7 @@
"release-major-alpha": "release-it major --preRelease=alpha",
"release-alpha": "release-it --preRelease=alpha"
},
"addons": [],
"dependencies": {},
"peerDependencies": {
"react": "18.2.0",
Expand Down
1 change: 1 addition & 0 deletions templates/projects/monorepo/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"initialize_documentation": ["1", "0"],
"__project_slug": "{{ cookiecutter.project_slug }}",
"__repository_url": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__repository_git": "[email protected]:{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__version_package": "1.0.0a0",
"__version_frontend_package": "1.0.0-alpha.0",
"__feature_headless": "1",
Expand Down
3 changes: 2 additions & 1 deletion templates/projects/monorepo/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def generate_addons_backend(context, output_dir):

def generate_addons_frontend(context, output_dir):
"""Run volto generator."""
folder_name = "frontend"
# Handle packages inside an organization
frontend_addon_name = context.get("frontend_addon_name")
if frontend_addon_name.startswith("@") and "/" in frontend_addon_name:
Expand All @@ -91,7 +92,7 @@ def generate_addons_frontend(context, output_dir):
generator.generate_subtemplate(
f"{TEMPLATES_FOLDER}/add-ons/frontend",
output_dir,
"frontend",
folder_name,
context,
FRONTEND_ADDON_REMOVE,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@

Ensure you have the following installed:

- Python 3.11 🐍
- UV 🐍
- Node {{ cookiecutter.__node_version }} 🟩
- git 🔗
- pnpm 🧶
- Docker 🐳

Expand All @@ -23,7 +24,7 @@ Ensure you have the following installed:
1. Clone the repository:

```shell
git clone [email protected]:{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}.git
git clone {{ cookiecutter.__repository_git }}.git
cd {{ cookiecutter.__project_slug }}
```

Expand Down
17 changes: 17 additions & 0 deletions templates/sub/cache/hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Pre generation hook."""

from collections import OrderedDict
from pathlib import Path

output_path = Path().resolve()

context: OrderedDict = {{cookiecutter}}


def main():
"""Validate context."""
pass


if __name__ == "__main__":
main()
16 changes: 14 additions & 2 deletions templates/sub/project_settings/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
"python_package_name": "{{ cookiecutter.project_slug|replace(' ', '')|replace('-', '.') }}",
"frontend_addon_name": "volto-{{ cookiecutter.python_package_name|replace('_', '-')|replace('.', '-') }}",
"language_code": "en",
"use_prerelease_versions": "{{ 'No' | use_prerelease_versions }}",
"plone_version": "{{ 'No' | latest_plone }}",
"volto_version": "{{ cookiecutter.use_prerelease_versions | latest_volto }}",
"github_organization": "collective",
"container_registry": ["github", "docker_hub", "gitlab"],
"__feature_distribution": "0",
"__backend_managed_by_uv": "false",
"__project_slug": "{{ cookiecutter.python_package_name }}",
"__project_slug": "{{ cookiecutter.project_slug }}",
"__repository_url": "https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__repository_git": "[email protected]:{{ cookiecutter.github_organization }}/{{ cookiecutter.__project_slug }}",
"__npm_package_name": "{{ cookiecutter.frontend_addon_name }}",
"__container_registry_prefix": "{{ cookiecutter.container_registry | image_prefix }}",
"__container_image_prefix": "{{ cookiecutter.__container_registry_prefix }}{{ cookiecutter.github_organization }}/{{ cookiecutter.project_slug }}",
Expand All @@ -25,7 +28,12 @@
"__supported_versions_python": ["{{ cookiecutter.__python_version }}"],
"__supported_versions_plone": ["{{ cookiecutter.plone_version | as_major_minor }}"],
"__python_version_identifier": "{{ cookiecutter.__python_version | replace('.', '') }}",
"__version_frontend_package": "1.0.0-alpha.0",
"__version_plone_volto": "{{ cookiecutter.volto_version }}",
"__version_plone_scripts": "^3.6.1",
"__version_mrs_developer": "^2.2.0",
"__version_pnpm": "9.1.1",
"__version_release_it": "^17.1.1",
"_copy_without_render": [],
"_extensions": [
"cookieplone.filters.use_prerelease_versions",
Expand All @@ -42,5 +50,9 @@
"cookieplone.filters.latest_plone"
],
"__cookieplone_repository_path": "",
"__cookieplone_template": ""
"__cookieplone_template": "",
"__generator_sha": "",
"__generator_template_url": "https://github.com/plone/cookieplone-templates/tree/main/{{ cookiecutter.__cookieplone_template }}",
"__generator_date_long": "{% now 'utc', '%Y-%m-%d %H:%M:%S' %}",
"__generator_signature": "This was generated by [the cookieplone-templates {{ cookiecutter.__cookieplone_template }} template]({{ cookiecutter.__generator_template_url }}) on {{ cookiecutter.__generator_date_long }}"
}
Loading