Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@
Standardize usage of the repository URLs in 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,36 @@ 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 ✅

- An [operating system](https://6.docs.plone.org/install/create-project-cookieplone.html#prerequisites-for-installation) that runs all the requirements mentioned.
- [uv](https://6.docs.plone.org/install/create-project-cookieplone.html#uv)
- [Make](https://6.docs.plone.org/install/create-project-cookieplone.html#make)
- [Git](https://6.docs.plone.org/install/create-project-cookieplone.html#git)
- [Docker](https://docs.docker.com/get-started/get-docker/) (optional)

### Installation 🔧

1. Clone this repository, then change your working directory.

```shell
git clone {{ cookiecutter.__repository_git }}.git
cd {{ cookiecutter.__project_slug }}
```

2. Install this code base.

```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 +77,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
2 changes: 1 addition & 1 deletion templates/add-ons/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
volto-addon
volto-add-on
6 changes: 4 additions & 2 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 All @@ -19,7 +20,8 @@
"__version_mrs_developer": "^2.2.0",
"__version_pnpm": "9.1.1",
"__version_release_it": "^17.1.1",
"__gha_version_node": "20.x",
"__node_version": "{{ cookiecutter.volto_version | node_version_for_volto }}",
"__gha_version_node": "{{ cookiecutter.__node_version }}",
"__gha_version_checkout": "v4",
"__gha_version_setup_node": "v4",
"__gha_version_cache": "v4",
Expand All @@ -45,6 +47,7 @@
"_copy_without_render": [],
"_extensions": [
"cookieplone.filters.use_prerelease_versions",
"cookieplone.filters.node_version_for_volto",
"cookieplone.filters.latest_volto"
],
"__cookieplone_repository_path": "",
Expand All @@ -53,7 +56,6 @@
"__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 }}",
"__cookieplone_template": "",
"__cookieplone_subtemplates": [
[
"documentation_starter",
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 @@ -16,6 +16,28 @@
To install your project, you must choose the method appropriate to your version of Volto.


### Volto 18 and later

Add `{{ cookiecutter.__npm_package_name }}` to your `package.json`:

```json
"dependencies": {
"{{ cookiecutter.__npm_package_name }}": "*"
}
```

Add `{{ cookiecutter.__npm_package_name }}` to your `volto.config.js`:

```javascript
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 }}';
```

### Volto 17 and earlier

Create a new Volto project (you can skip this step if you already have one):
Expand Down Expand Up @@ -50,28 +72,6 @@ Start volto with:
yarn start
```

### Volto 18 and later

Add `{{ cookiecutter.__npm_package_name }}` to your `package.json`:

```json
"dependencies": {
"{{ cookiecutter.__npm_package_name }}": "*"
}
```

Add `{{ cookiecutter.__npm_package_name }}` to your `volto.config.js`:

```javascript
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 }}';
```

## Test installation

Visit http://localhost:3000/ in a browser, login, and check the awesome new features.
Expand All @@ -83,11 +83,29 @@ 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 ✅

- An [operating system](https://6.docs.plone.org/install/create-project-cookieplone.html#prerequisites-for-installation) that runs all the requirements mentioned.
- [nvm](https://6.docs.plone.org/install/create-project-cookieplone.html#nvm)
- [Node.js and pnpm](https://6.docs.plone.org/install/create-project.html#node-js) {{ cookiecutter.__node_version }}
- [Make](https://6.docs.plone.org/install/create-project-cookieplone.html#make)
- [Git](https://6.docs.plone.org/install/create-project-cookieplone.html#git)
- [Docker](https://docs.docker.com/get-started/get-docker/) (optional)

### Installation 🔧

1. Clone this repository, then change your working directory.

```shell
git clone {{ cookiecutter.__repository_git }}.git
cd {{ cookiecutter.__project_slug }}
```

2. Install this code base.

- [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)
```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
Loading