Skip to content

Commit

Permalink
Merge branch 'main' into fixtabbing-breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
iRohitSingh committed May 10, 2024
2 parents 040a838 + 0871cd8 commit 04ebf02
Show file tree
Hide file tree
Showing 12 changed files with 1,159 additions and 64 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ jobs:
ENVIRONMENT=${{ env.ENVIRONMENT }}
echo "ENVIRONMENT=${ENVIRONMENT}" >> $GITHUB_OUTPUT
echo "STACK_NAME=${ENVIRONMENT//./-}" >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("frontend/package.json")); print("VOLTO_VERSION=" + data["dependencies"]["@plone/volto"])' >> $GITHUB_OUTPUT
python3 -c 'import json; data = json.load(open("mrs.developer.json")); print("VOLTO_VERSION=" + data["core"]["tag"] or 'latest')' >> $GITHUB_OUTPUT
- run: echo "${{ steps.vars.outputs.VOLTO_VERSION }}"

release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -74,7 +76,7 @@ jobs:
build-args: |
ADDON_NAME=@kitconcept/volto-light-theme
ADDON_PATH=volto-light-theme
VOLTO_VERSION=${{ env.VOLTO_VERSION }}
VOLTO_VERSION=${{ needs.meta.outputs.VOLTO_VERSION }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: $${{ steps.meta.outputs.labels }}
Expand Down
29 changes: 25 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@

<!-- towncrier release notes start -->

## 3.3.0 (2024-04-26)

### Feature

- Make font-weights, font-sizes and font-heights overrideable adding the `!default` thingy @erral [#371](https://github.com/kitconcept/volto-light-theme/pull/371)

### Bugfix

- Fix event title margin bottom. @iFlameing [#357](https://github.com/kitconcept/volto-light-theme/pull/357)
- Fix Image block in grid is not working @iRohitSingh [#376](https://github.com/kitconcept/volto-light-theme/pull/376)

## 3.2.0 (2024-03-25)

### Feature

- Use project-less approach for developing @sneridagh [#369](https://github.com/kitconcept/volto-light-theme/pull/369)

### Bugfix

- Revert breaking change introduced in #346 @sneridagh [#373](https://github.com/kitconcept/volto-light-theme/pull/373)

## 3.1.2 (2024-03-18)

### Internal
Expand Down Expand Up @@ -335,19 +356,19 @@
- Add external link for slate block @iRohitSingh [#188](https://github.com/kitconcept/volto-light-theme/pull/188)
- Fix responsive of listing block. @iFlameing [#189](https://github.com/kitconcept/volto-light-theme/pull/189)
- Fix pagination styles for Listings. @danalvrz
- Fix pagination styles for Listings. @danalvrz
Change divider bar in News Item head title from string to pseudo-element. @danalvrz
Fix text decoration for links. @danalvrz
Fix background color for in-Grid Slate. @danalvrz
Fix background color for in-Grid Slate. @danalvrz
Fix Image block margins. @danalvrz
Fix Image block margins. @danalvrz
Fix Grid Listing variation CSS. @danalvrz
Fix Separator margin when preceded by Image block. @danalvrz
Fix Separator margin when preceded by Image block. @danalvrz
Fix Teaser margin in mobile. @danalvrz [#191](https://github.com/kitconcept/volto-light-theme/pull/191)
- Enable automatic hyphenation. @iFlameing [#193](https://github.com/kitconcept/volto-light-theme/pull/193)
Expand Down
32 changes: 32 additions & 0 deletions dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# syntax=docker/dockerfile:1
ARG VOLTO_VERSION
FROM plone/frontend-builder:${VOLTO_VERSION} as builder

ARG ADDON_NAME
ARG ADDON_PATH

ENV THEME='@kitconcept/volto-light-theme'

# Copy helper.py as /setupAddon
COPY dockerfiles/helper.py /setupAddon

# Copy addon code
COPY --chown=node:node ./packages/${ADDON_PATH} /app/src/addons/${ADDON_PATH}/

# Install
RUN <<EOT
set -e
/setupAddon
yarn install --network-timeout 1000000
yarn build
rm -rf cache omelette .yarn/cache
EOT

FROM plone/frontend-prod-config:${VOLTO_VERSION}

LABEL maintainer="kitconcept GmbH <[email protected]>" \
org.label-schema.name="ghcr.io/kitconcept/lighttheme" \
org.label-schema.description="Volto project with @kitconcept/volto-light-theme" \
org.label-schema.vendor="kitconcept GmbH"

COPY --from=builder /app/ /app/
132 changes: 132 additions & 0 deletions dockerfiles/helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
#!/usr/bin/python3
"""Addon support for Volto."""
from pathlib import Path
from typing import Tuple

import json
import logging
import os


logger = logging.getLogger("Volto Helper")


def get_jsconfig_path():
primary_path = (APP_FOLDER / "tsconfig.json").resolve()
fallback_path = (APP_FOLDER / "jsconfig.json").resolve()

if primary_path.exists():
return primary_path
elif fallback_path.exists():
return fallback_path
else:
return None


APP_FOLDER = Path("/app").resolve()
PACKAGE_JSON_PATH = (APP_FOLDER / "package.json").resolve()
JSCONFIG_PATH = get_jsconfig_path()
VOLTOCONFIGPATH = (APP_FOLDER / "volto.config.js").resolve()


ADDON_NAME = os.environ.get("ADDON_NAME", "")
ADDITIONAL_ADDONS = os.environ.get("ADDITIONAL_ADDONS", "")


def add_packages_to_package_json(config: dict, packages: dict) -> dict:
"""Add addons to the main `package.json`."""
addons = config.get("addons", [])
workspaces = config.get("workspaces", [])
for pkg_name, pkg_path in packages.items():
if not VOLTOCONFIGPATH.exists():
addons.append(pkg_name)
workspace_path = pkg_path.replace("/src", "")
workspaces.append(f"src/{workspace_path}")
config["addons"] = addons
config["workspaces"] = workspaces
return config


def parse_jsonconfig(config: dict) -> dict:
"""Parse existing `jsconfig.json`."""
packages = {}
config_paths = config.get("compilerOptions", {}).get("paths", {})
for pkg_name, pkg_path in config_paths.items():
if isinstance(pkg_path, list):
packages[pkg_name] = pkg_path[0]
return packages


def parse_addon_name(addon_name: str) -> Tuple[str, str]:
"""Parse the addon name and return also its probable path."""
if addon_name.startswith("@"):
_, path = addon_name.split("/")
return addon_name, path
return addon_name, addon_name


def addon_to_package_json(config: dict, addon_name: str, addon_path: str) -> dict:
"""Add a single addon to main `package.json`."""
project_addons = config["addons"]
project_dependencies = config["dependencies"]
# Process package.json for the addon
workspace_path = f"src/addons/{addon_path}"
addon_path = (APP_FOLDER / workspace_path).resolve()
addon_config = json.load(open(addon_path / "package.json"))
# Process peerDependencies
peer_dependencies = addon_config.get("peerDependencies", {})
for dependency_name, version in peer_dependencies.items():
if dependency_name in project_dependencies:
continue
project_dependencies[dependency_name] = version
# Process peerAddons
peer_addons = addon_config.get("peerAddons", [])
for name in peer_addons:
if name in project_addons:
continue
project_addons.append(name)
# Add our addon to addons and to workspaces
project_addons.append(addon_name)
workspaces = config.get("workspaces", [])
workspaces.append(workspace_path)

config["addons"] = project_addons
config["dependencies"] = project_dependencies
config["workspaces"] = workspaces
return config


def addon_to_jsconfig_json(config: dict, addon_name: str, addon_path: str) -> dict:
"""Add a single addon to `jsconfig.json`."""
if "compilerOptions" not in config:
config["compilerOptions"] = {}
if "paths" not in config:
config["compilerOptions"]["paths"] = {}

config["compilerOptions"]["paths"][addon_name] = [f"addons/{addon_path}/src"]
return config


if ADDON_NAME:
logger.info("Processing the ADDON_NAME variable.")
SETTINGS = (
(addon_to_package_json, PACKAGE_JSON_PATH),
(addon_to_jsconfig_json, JSCONFIG_PATH),
)
addon_name, addon_path = parse_addon_name(ADDON_NAME)
for func, path in SETTINGS:
data = func(json.load(open(path)), addon_name=addon_name, addon_path=addon_path)
json.dump(data, open(path, "w"), indent=2)
else:
packages = {}
if JSCONFIG_PATH.exists():
packages = parse_jsonconfig(json.load(open(JSCONFIG_PATH)))

if not packages:
logger.warning("Existing jsconfig.json does not contain packages.")
else:
logger.info("Processing existing jsconfig.json.")
package_json = json.load(open(PACKAGE_JSON_PATH))
# Process package_json
package_json = add_packages_to_package_json(package_json, packages)
json.dump(package_json, open(PACKAGE_JSON_PATH, "w"), indent=2)
7 changes: 6 additions & 1 deletion packages/volto-light-theme/.release-it.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"hooks": {
"after:bump": "pipx run towncrier build --draft --yes --version ${version} > .changelog.draft && pipx run towncrier build --yes --version ${version}",
"after:bump": [
"pipx run towncrier build --draft --yes --version ${version} > .changelog.draft",
"pipx run towncrier build --yes --version ${version}",
"cp ../../README.md ./ && cp CHANGELOG.md ../../CHANGELOG.md",
"git add ../../CHANGELOG.md"
],
"after:release": "rm .changelog.draft"
},
"git": {
Expand Down
Loading

0 comments on commit 04ebf02

Please sign in to comment.