Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@plone/registry as ESM module, move to TS, complete documentation #6399

Merged
merged 95 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
70559c1
WIP Update README for @plone/registry, added utilities registry
sneridagh Oct 12, 2024
db99028
First implementation of moving addon registry to TS and ESM.
sneridagh Oct 13, 2024
cfe41b7
Removing dangling pnpmlock
sneridagh Oct 13, 2024
944d6c1
Fix path
sneridagh Oct 13, 2024
62b4766
Fixes
sneridagh Oct 13, 2024
b80f9d5
Fix missing fake node_modules in fixtures
sneridagh Oct 13, 2024
d608239
Changelog
sneridagh Oct 13, 2024
6d82dfd
Fix tests
sneridagh Oct 13, 2024
fa9e675
Fix i18n to match the new ESM in @plone/registry
sneridagh Oct 13, 2024
9aeaf6a
Fix @plone/scripts
sneridagh Oct 13, 2024
6f26edf
Build all again for linting
sneridagh Oct 13, 2024
ef4c08f
Introduce new get() method in the addon registry
sneridagh Oct 13, 2024
f415b34
Refactor to TS other scripts. More polishments. Better tests
sneridagh Oct 13, 2024
1d37256
Create .readthedocs.yml
stevepiercy Oct 14, 2024
5251665
Fix tests
sneridagh Oct 14, 2024
2b34e98
Apply suggestions from code review
sneridagh Oct 14, 2024
c266a70
Update packages/registry/news/6399.breaking
sneridagh Oct 14, 2024
0ec33cd
Update packages/scripts/news/6399.feature
sneridagh Oct 14, 2024
2bf09b4
Fix storybook config
sneridagh Oct 14, 2024
e3b98b7
Fix storybook build for main
sneridagh Oct 14, 2024
e80b94c
Docs in @plone/registry
sneridagh Oct 14, 2024
c76b1b1
Requirements for docs in RTD
sneridagh Oct 14, 2024
67b700f
Requirements for docs in RTD 2
sneridagh Oct 14, 2024
51f09bb
Try to build with a custom command
sneridagh Oct 14, 2024
ddd0701
Try 3
sneridagh Oct 14, 2024
5c458df
Use post_install and don't use default sphinx builder.
stevepiercy Oct 14, 2024
304b042
Fix path to requirements-docs.txt
stevepiercy Oct 14, 2024
2881958
Revert to repo root for python install requirements
stevepiercy Oct 14, 2024
a36c126
Consolidate commands in Makefile
stevepiercy Oct 14, 2024
645a265
cd into registry
stevepiercy Oct 14, 2024
57a5244
Combine commands
stevepiercy Oct 14, 2024
6668e4b
Fix path to requirements
stevepiercy Oct 14, 2024
121e84a
Use commands instead of jobs to override the build process
stevepiercy Oct 14, 2024
8df4552
Fix lint
sneridagh Oct 14, 2024
9a9bf60
Fix prettier
sneridagh Oct 14, 2024
0fb7b77
Apply suggestions from code review
sneridagh Oct 14, 2024
4485e16
remove cruft
sneridagh Oct 14, 2024
30857cb
Fix storybook file reference
sneridagh Oct 14, 2024
47b105c
Fix references to plone-registry URL
sneridagh Oct 14, 2024
5255a97
WIP more docs
sneridagh Oct 14, 2024
3646e35
WIP
sneridagh Oct 14, 2024
c409647
Merge branch 'main' into registryesmandts
sneridagh Oct 18, 2024
f3e7e80
Fix code
sneridagh Oct 18, 2024
76b01ad
Fix other typo
sneridagh Oct 18, 2024
a174fa6
Merge branch 'main' into registryesmandts
sneridagh Oct 20, 2024
a09affa
lock
sneridagh Oct 20, 2024
75dec4d
More docs and add `registry.config.js` to the game
sneridagh Oct 20, 2024
e250d7b
new package in the fixture
sneridagh Oct 20, 2024
02ec019
Update glob version
sneridagh Oct 20, 2024
d449abc
New API for instantiating the Add-on Registry
sneridagh Oct 21, 2024
308eaf8
Apply suggestions from code review
sneridagh Oct 21, 2024
0c0cd8a
Fix i18n script
sneridagh Oct 21, 2024
624f7fb
How to instantiate the registry
sneridagh Oct 21, 2024
ea8ec70
More docs, polishments, move all to named exports
sneridagh Oct 21, 2024
2238307
Introduce plone-registry Vite plugin
sneridagh Oct 21, 2024
ca98c21
Apply suggestions from code review
sneridagh Oct 22, 2024
4d4bc76
Update packages/registry/src/addon-registry/addon-registry.ts
sneridagh Oct 22, 2024
dcbd645
Update docs/source/upgrade-guide/index.md
sneridagh Oct 22, 2024
f21434f
Apply suggestions from code review
sneridagh Oct 23, 2024
0ff5e5e
Impreove/complete some missing parts
sneridagh Oct 23, 2024
6be3887
Initialization
sneridagh Oct 23, 2024
c48d6a0
Add specific test for an app folder (non-Volto), add bare customizati…
sneridagh Oct 23, 2024
cdc28af
Changelog
sneridagh Oct 23, 2024
7222b43
Merge branch 'main' into registryesmandts
sneridagh Oct 23, 2024
1f813ad
remove only
sneridagh Oct 24, 2024
03fc1f0
Merge branch 'main' into registryesmandts
sneridagh Oct 24, 2024
0af08a5
Apply suggestions from code review
sneridagh Oct 25, 2024
8efb25f
David Suggestions
sneridagh Oct 25, 2024
afb0f3a
Changelog
sneridagh Oct 25, 2024
4cc244e
Apply suggestions from code review
sneridagh Oct 26, 2024
ad758d4
Explain better why do we want to use a configuration file
sneridagh Oct 26, 2024
3cd99ad
Clarify that you can use an string too, fix the example
sneridagh Oct 26, 2024
58ba93d
Added a warning for updating your shadowed components at the same tim…
sneridagh Oct 26, 2024
5a94bb4
Purge README
sneridagh Oct 26, 2024
2edb35b
Merge branch 'main' into registryesmandts
sneridagh Oct 26, 2024
301b610
Merge branch 'main' into registryesmandts
stevepiercy Oct 26, 2024
ba272ea
Add-on Registry is not a brand, but just a thing.
stevepiercy Oct 26, 2024
be685d1
Grammar on news item
stevepiercy Oct 26, 2024
87b0a78
Add-on Registry is not a brand, but just a thing.
stevepiercy Oct 26, 2024
5f75190
Complete sentence
stevepiercy Oct 26, 2024
7825088
Remove unused assets
stevepiercy Oct 27, 2024
f5791da
Add robots.txt with correct link to sitemap.xml
stevepiercy Oct 27, 2024
df038ab
Volto Foundation?
stevepiercy Oct 27, 2024
15f0292
Restore needed static files
stevepiercy Oct 27, 2024
bc0a175
Remove unneeded configuration.
stevepiercy Oct 27, 2024
bfe3b64
Move explanation docs into a Conceptual Guides section
stevepiercy Oct 27, 2024
cd14d36
Minor tweaks for grammar
stevepiercy Oct 27, 2024
3d4b45d
Move explanation of component and utility registry from index.
stevepiercy Oct 27, 2024
00dd707
Refactor and rename files to avoid repetition
stevepiercy Oct 27, 2024
c595d88
Clean up page titles
stevepiercy Oct 27, 2024
d08b27e
Clean up all how-to guides
stevepiercy Oct 27, 2024
5eb2898
Add html_meta stuff
stevepiercy Oct 27, 2024
79575b8
Add tree to shadow components docs, move it in the ToC to the last
sneridagh Oct 27, 2024
12f3910
Experiment with RTD preview builds
stevepiercy Oct 27, 2024
f603dd2
Add http://localhost:8080 to the whitelist in CI link check
sneridagh Oct 27, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ jobs:
- name: Install yalc
run: npm -g install yalc

- name: Build dependencies
run: make build-deps

- name: Install a yalc'ed version of the current Volto in the project - publish
run: |
yalc publish packages/types
Expand Down
3 changes: 2 additions & 1 deletion apps/plone/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const projectRootPath = __dirname;
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const AddonConfigurationRegistry =
require('@plone/registry/addon-registry').default;

let voltoPath = './node_modules/@plone/volto';

Expand Down
35 changes: 35 additions & 0 deletions docs/source/upgrade-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,41 @@ The `react/jsx-key` rule has been enabled in ESlint for catching missing `key` i
You might catch some violations in your project or add-on code after running ESlint.
Adding the missing `key` property whenever the violation is reported will fix it.

### `@plone/registry` moved to ESM

The `@plone/registry` package has been moved to ESM.
This unfortunately forces some import path changes that should be patched in your Plone project or add-on boilerplates.

```{note}
As always, when something changes in the boilerplate, you may regenerate one from Cookieplone and move your code into it, instead of fiddling with it.
```

For example, in your projects {file}`.eslintrc.js`:
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

```diff
const fs = require('fs');
const projectRootPath = __dirname;
-const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
+const AddonConfigurationRegistry =
+ require('@plone/registry/addon-registry').default;
```

also, in the Storybook configuration {file}`
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

```diff
defaultRazzleOptions,
);
- const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
+ const AddonConfigurationRegistry =
+ require('@plone/registry/addon-registry').default;
```

```{versionadded} Volto 18.0.0-alpha.21
```

```{versionadded} @plone/scripts 3.6.1
```

(volto-upgrade-guide-17.x.x)=

## Upgrading to Volto 17.x.x
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const projectRootPath = __dirname;
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const AddonConfigurationRegistry =
require('@plone/registry/addon-registry').default;

let voltoPath = './node_modules/@plone/volto';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ module.exports = {
[],
defaultRazzleOptions,
);
const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry');
const AddonConfigurationRegistry =
require('@plone/registry/addon-registry').default;

const registry = new AddonConfigurationRegistry(projectRootPath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ module.exports = {
// Base config
extends: ['eslint:recommended'],

ignorePatterns: ['docs/_static/searchtools.js'],

overrides: [
// React
{
Expand Down Expand Up @@ -61,7 +63,11 @@ module.exports = {

// Node
{
files: ['.eslintrc.js', 'src/*.js'],
files: [
'.eslintrc.cjs',
'src/addon-registry/**/*.{js,ts}',
'__tests__/**/*.{js,ts}',
],
env: {
node: true,
es6: true,
Expand Down
7 changes: 4 additions & 3 deletions packages/registry/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.parcel-cache/
dist
/bin
/lib
/include

# yarn 3
.pnp.*
.yarn/*
docs/_build/
32 changes: 32 additions & 0 deletions packages/registry/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
86 changes: 86 additions & 0 deletions packages/registry/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
### Defensive settings for make:
# https://tech.davis-hansson.com/p/make/
SHELL:=bash
.ONESHELL:
.SHELLFLAGS:=-eu -o pipefail -c
.SILENT:
.DELETE_ON_ERROR:
MAKEFLAGS+=--warn-undefined-variables
MAKEFLAGS+=--no-builtin-rules

# Sphinx variables
# You can set these variables from the command line.
SPHINXOPTS ?=
VALEOPTS ?=
# Internal variables.
SPHINXBUILD = "$(realpath bin/sphinx-build)"
SPHINXAUTOBUILD = "$(realpath bin/sphinx-autobuild)"
DOCS_DIR = ./docs/
BUILDDIR = ./_build/
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(SPHINXOPTS) .
VALEFILES := $(shell find $(DOCS_DIR) -type f -name "*.md" -print)

# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
RED=`tput setaf 1`
GREEN=`tput setaf 2`
RESET=`tput sgr0`
YELLOW=`tput setaf 3`

## Docs

bin/python: ## Create a Python virtual environment with the latest pip, and install documentation requirements
python3 -m venv . || virtualenv --clear --python=python3 .
bin/python -m pip install --upgrade pip
@echo "Python environment created."
bin/pip install -r ../../requirements-docs.txt
@echo "Requirements installed."

.PHONY: docs-clean
docs-clean: ## Clean current and legacy docs build directories, and Python virtual environment
rm -rf bin include lib
rm -rf docs/_build
cd $(DOCS_DIR) && rm -rf $(BUILDDIR)/

.PHONY: docs-html
docs-html: bin/python ## Build html
cd $(DOCS_DIR) && $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

.PHONY: docs-livehtml
docs-livehtml: bin/python ## Rebuild Sphinx documentation on changes, with live-reload in the browser
cd "$(DOCS_DIR)" && ${SPHINXAUTOBUILD} \
--ignore "*.swp" \
-b html . "$(BUILDDIR)/html" $(SPHINXOPTS)

.PHONY: docs-linkcheck
docs-linkcheck: bin/python ## Run linkcheck
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/ ."

.PHONY: docs-linkcheckbroken
docs-linkcheckbroken: bin/python ## Run linkcheck and show only broken links
cd $(DOCS_DIR) && $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck | GREP_COLORS='0;31' grep -wi "broken\|redirect" --color=always | GREP_COLORS='0;31' grep -vi "https://github.com/plone/volto/issues/" --color=always && if test $$? -eq 0; then exit 1; fi || test $$? -ne 0

.PHONY: docs-vale
docs-vale: bin/python ## Install (once) and run Vale style, grammar, and spell checks
bin/vale sync
bin/vale --no-wrap $(VALEOPTS) $(VALEFILES)
@echo
@echo "Vale is finished; look for any errors in the above output."

.PHONY: docs-rtd-pr-preview
docs-rtd-pr-preview: ## Build previews of pull requests that have documentation changes on Read the Docs via CI
pip install -r requirements-docs.txt
cd $(DOCS_DIR) && sphinx-build -b html $(ALLSPHINXOPTS) ${READTHEDOCS_OUTPUT}/html/

## Build

.PHONY: rename-to-cjs
rename-to-cjs: ## Rename the built files js -> cjs
mv dist/cjs/addon-registry.js dist/cjs/addon-registry.cjs
mv dist/cjs/create-addons-loader.js dist/cjs/create-addons-loader.cjs
mv dist/cjs/create-theme-loader.js dist/cjs/create-theme-loader.cjs
Loading
Loading