Skip to content

Commit

Permalink
Merge branch 'issue-2-project-template' into fixforymlandreadme
Browse files Browse the repository at this point in the history
  • Loading branch information
sneridagh authored Jun 7, 2024
2 parents 6bfbe2a + 6df9ed1 commit dba6a37
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- List all packages you depend here -->
{%- if cookiecutter.__feature_headless == '1' %}
<include package="plone.volto" />
<include package="plone.restapi" />
<include package="plone.volto" />
{%- endif %}

</configure>
1 change: 1 addition & 0 deletions frontend_addon/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"__version_mrs_developer": "^2.2.0",
"__version_pnpm": "9.1.1",
"__version_release_it": "^17.1.1",
"__version_pre_commit": "3.7.1",
"__gha_version_node": "20.x",
"__gha_version_checkout": "v4",
"__gha_version_setup_node": "v4",
Expand Down
12 changes: 12 additions & 0 deletions frontend_addon/{{ cookiecutter.__folder_name }}/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
const fs = require('fs');
const projectRootPath = __dirname;
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');

let coreLocation;
if (fs.existsSync(`${projectRootPath}/core`))
coreLocation = `${projectRootPath}/core`;
else if (fs.existsSync(`${projectRootPath}/../../core`))
coreLocation = `${projectRootPath}/../../core`;

const registry = new AddonConfigurationRegistry(
`${coreLocation}/packages/volto`,
);

// Extends ESlint configuration for adding the aliases to `src` directories in Volto addons
const addonAliases = Object.keys(registry.packages).map((o) => [
o,
registry.packages[o].modulePath,
]);

module.exports = {
extends: `${coreLocation}/packages/volto/.eslintrc`,
rules: {
Expand All @@ -26,6 +37,7 @@ module.exports = {
'{{ cookiecutter.__npm_package_name }}',
'./packages/{{ cookiecutter.frontend_addon_name }}/src',
],
...addonAliases,
],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
repos:
- repo: https://github.com/pre-commit/mirrors-eslint
rev: 'v9.2.0'
- repo: local
hooks:
- id: prettier
name: prettier
entry: pnpm exec prettier --write
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
- id: eslint
files: '^packages/.*/src/.*/*.(js,jsx,ts,tsx)$'
name: eslint
entry: pnpm exec eslint --max-warnings=0 --fix
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
- id: stylelint
name: stylelint
entry: pnpm exec stylelint --fix
language: system
files: '^packages/.*/src/.*/?.*.(css|scss|less)$'
types: [file]
- id: i18n
name: i18n
entry: make ci-i18n
language: system
files: '^packages/.*/src/.*/?.*.(js|jsx|ts|tsx)$'
types: [file]
7 changes: 6 additions & 1 deletion frontend_addon/{{ cookiecutter.__folder_name }}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`

GIT_FOLDER=$(CURRENT_DIR)/.git
PRE_COMMIT=pipx run --spec 'pre-commit=={{cookiecutter.__version_pre_commit}}' pre-commit

PLONE_VERSION=6
DOCKER_IMAGE=plone/server-dev:${PLONE_VERSION}
DOCKER_IMAGE_ACCEPTANCE=plone/server-acceptance:${PLONE_VERSION}
Expand All @@ -33,9 +36,11 @@ help: ## Show this help

.PHONY: install
install: ## Installs the add-on in a development environment
@echo "$(GREEN)Install$(RESET)"
if [ -d $(GIT_FOLDER) ]; then $(PRE_COMMIT) install; else echo "$(RED) Not installing pre-commit$(RESET)";fi
pnpm dlx mrs-developer missdev --no-config --fetch-https
pnpm i
pnpm pnpm build:deps
pnpm build:deps

.PHONY: start
start: ## Starts Volto, allowing reloading of the add-on during development
Expand Down
4 changes: 2 additions & 2 deletions frontend_addon/{{ cookiecutter.__folder_name }}/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build:deps": "pnpm --filter @plone/registry --filter @plone/components build",
"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}'",
"lint": "VOLTOCONFIG=$(pwd)/volto.config.js eslint --max-warnings=0 'packages/**/src/**/*.{js,jsx,ts,tsx}'",
"lint:fix": "VOLTOCONFIG=$(pwd)/volto.config.js eslint --fix 'packages/**/src/**/*.{js,jsx,ts,tsx}'",
"prettier": "prettier --check 'packages/**/src/**/*.{js,jsx,ts,tsx}'",
"prettier:fix": "prettier --write 'packages/**/src/**/*.{js,jsx,ts,tsx}' ",
"stylelint": "stylelint 'packages/**/src/**/*.{css,scss,less}' --allow-empty-input",
Expand Down
1 change: 0 additions & 1 deletion project/tests/test_project_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def test_backend_package_files_removed(cutter_result, filename: str):
["setup.py", "plone.restapi"],
["src/plonegov/ploneorgbr/dependencies.zcml", "plone.volto"],
["src/plonegov/ploneorgbr/dependencies.zcml", "plone.restapi"],
["src/plonegov/ploneorgbr/profiles/default/metadata.xml", "plone.restapi:default"],
["src/plonegov/ploneorgbr/profiles/default/metadata.xml", "plone.volto:default"],
]

Expand Down
3 changes: 3 additions & 0 deletions project/{{ cookiecutter.__folder_name }}/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
!.vscode
node_modules
/core
/public
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
13 changes: 13 additions & 0 deletions project/{{ cookiecutter.__folder_name }}/public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions project/{{ cookiecutter.__folder_name }}/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *

19 changes: 19 additions & 0 deletions project/{{ cookiecutter.__folder_name }}/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const addons = ['{{ cookiecutter.__npm_package_name }}'];
const theme = '';

module.exports = {
addons,
theme
};

0 comments on commit dba6a37

Please sign in to comment.