Skip to content

Commit

Permalink
Merge branch 'main' into slots-base
Browse files Browse the repository at this point in the history
* main: (27 commits)
  React Router 7 experimental PoC (#6472)
  First batch of the overhaul of the add-ons section (#6397)
  URL Management control panel: show errors from CSV upload (#6473)
  Release 18.0.3
  Release @plone/registry 2.1.2
  Preparing for 18.0.3
  Fix weird issue in images build with typings (#6471)
  Release 18.0.2
  Release @plone/providers 1.0.0-alpha.5
  Release @plone/scripts 3.8.1
  Release @plone/components 2.1.1
  Fix packaging and plone/components src export (#6470)
  Release @plone/registry 2.1.1
  Repackage registry
  Release 18.0.1
  Release @plone/providers 1.0.0-alpha.4
  Release @plone/components 2.1.0
  Release @plone/client 1.0.0-alpha.20
  Release @plone/scripts 3.8.0
  Release @plone/registry 2.1.0
  ...
  • Loading branch information
sneridagh committed Nov 6, 2024
2 parents f89b43b + 5c0dd14 commit e3e70ec
Show file tree
Hide file tree
Showing 250 changed files with 4,231 additions and 3,184 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const config = {
],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 0,
},
},
{
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,4 @@ docs/_build/
/.tool-versions
docs/source/news

.turbo
.parcel-cache/
tsconfig.tsbuildinfo
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ public-hoist-pattern[]=*prettier*
public-hoist-pattern[]=*stylelint*
public-hoist-pattern[]=*cypress*
public-hoist-pattern[]=*process*
public-hoist-pattern[]=*parcel*
22 changes: 14 additions & 8 deletions PACKAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,31 @@ Core packages must not depend on any other `@plone/*` package, with only one exc
They must be published and bundled in a traditional (transpiled) way.
The bundle of these packages must work on both CommonJS and ECMAScript Module (ESM) environments.

## Feature packages

- `@plone/contents`


## Utility packages

- `@plone/blocks`
- `@plone/providers`
- `@plone/helpers`
- `@plone/drivers`
- `@plone/rsc`


### Rules

Utility packages can depend on core packages and other utility packages.
They must be published in a traditional way, bundled.
This bundle must work on both CommonJS and ESM environments.

## Feature packages

- `@plone/blocks`
- `@plone/slots`
- `@plone/contents`

### Rules

Feature packages (or add-on packages) can depend on any other package.
They must not be transpiled, but as source.
They must provide a default configuration registry loader as default main entry point export.
They must be able to be loaded as any other add-on.

## Development utility packages

Expand All @@ -55,7 +61,7 @@ They contain utilities that are useful for the development of a Volto project.
Some of them are released:

- `@plone/scripts`
- `@plone/generator-volto`
- `@plone/generator-volto` (deprecated)

Some of them are used by the build, and separated in packages for convenience.

Expand Down
80 changes: 80 additions & 0 deletions apps/rr7/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* This is intended to be a basic starting point for linting in your app.
* It relies on recommended configs out of the box for simplicity, but you can
* and should modify this configuration to best suit your team's needs.
*/

/** @type {import('eslint').Linter.Config} */
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
commonjs: true,
es6: true,
},

// Base config
extends: ['eslint:recommended'],

overrides: [
// React
{
files: ['**/*.{js,jsx,ts,tsx}'],
plugins: ['react', 'jsx-a11y'],
extends: [
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
],
settings: {
react: {
version: 'detect',
},
formComponents: ['Form'],
linkComponents: [
{ name: 'Link', linkAttribute: 'to' },
{ name: 'NavLink', linkAttribute: 'to' },
],
},
},

// Typescript
{
files: ['**/*.{ts,tsx}'],
plugins: ['@typescript-eslint', 'import'],
parser: '@typescript-eslint/parser',
settings: {
'import/internal-regex': '^~/',
'import/resolver': {
node: {
extensions: ['.ts', '.tsx'],
},
typescript: {
alwaysTryTypes: true,
},
},
},
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
},

// Node
{
files: ['.eslintrc.js'],
env: {
node: true,
},
},
],
};
7 changes: 7 additions & 0 deletions apps/rr7/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules

/.cache
/build
.env
.react-router
.registry.loader.js
30 changes: 30 additions & 0 deletions apps/rr7/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Plone on React Router 7

This is a proof of concept of a [React Router](https://reactrouter.com/dev/docs) app, using the `@plone/*` libraries.
This is intended to serve as both a playground for the development of both packages and as a demo of Plone using Remix.

> [!WARNING]
> This package or app is experimental.
> The community offers no support whatsoever for it.
> Breaking changes may occur without notice.
## Development

To start, from the root of the monorepo:

```shell
pnpm install
pnpm --filter plone-remix run dev
```

Then start the Plone backend:

% TODO MAKEFILE
```shell
make backend-docker-start
```


## About this app

- [Remix Docs](https://remix.run/docs/en/main)
8 changes: 8 additions & 0 deletions apps/rr7/app/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import ploneClient from '@plone/client';
import config from '@plone/registry';

const cli = ploneClient.initialize({
apiPath: config.settings.apiPath,
});

export { cli as ploneClient };
15 changes: 15 additions & 0 deletions apps/rr7/app/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import config from '@plone/registry';
import { blocksConfig, slate } from '@plone/blocks';

const settings = {
apiPath: 'http://localhost:3000',
slate,
};

// @ts-expect-error We need to fix typing
config.set('settings', settings);

// @ts-expect-error We need to fix typing
config.set('blocks', { blocksConfig });

export default config;
98 changes: 98 additions & 0 deletions apps/rr7/app/root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { useState } from 'react';
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
useHref,
useLocation,
useNavigate,
useParams,
} from 'react-router';
import type { LinksFunction } from 'react-router';

import { QueryClient } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import PloneClient from '@plone/client';
import { PloneProvider } from '@plone/providers';
import { flattenToAppURL } from './utils';
import config from '@plone/registry';
import './config';

import '@plone/components/dist/basic.css';

function useHrefLocal(to: string) {
return useHref(flattenToAppURL(to));
}

export const links: LinksFunction = () => [
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossOrigin: 'anonymous',
},
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap',
},
];

export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
);
}

export default function App() {
const [queryClient] = useState(
() =>
new QueryClient({
defaultOptions: {
queries: {
// With SSR, we usually want to set some default staleTime
// above 0 to avoid refetching immediately on the client
staleTime: 60 * 1000,
},
},
}),
);

const [ploneClient] = useState(() =>
PloneClient.initialize({
apiPath: config.settings.apiPath,
}),
);

const RRNavigate = useNavigate();
const navigate = (to: string) => {
return RRNavigate(flattenToAppURL(to));
};

return (
<PloneProvider
ploneClient={ploneClient}
queryClient={queryClient}
useLocation={useLocation}
useParams={useParams}
useHref={useHrefLocal}
navigate={navigate}
>
<Outlet />
<ReactQueryDevtools initialIsOpen={false} />
</PloneProvider>
);
}
7 changes: 7 additions & 0 deletions apps/rr7/app/routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { RouteConfig } from '@react-router/dev/routes';
import { index, route } from '@react-router/dev/routes';

export const routes: RouteConfig = [
index('routes/home.tsx'),
route('*', 'routes/$.tsx'),
];
2 changes: 2 additions & 0 deletions apps/rr7/app/routes/$.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Content, { loader } from './home';
export { loader, Content as default };
Loading

0 comments on commit e3e70ec

Please sign in to comment.