@plone/aurora 1.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-it.json +32 -0
- package/.stylelintrc +8 -0
- package/CHANGELOG.md +251 -0
- package/LICENSE.md +21 -0
- package/Makefile +82 -0
- package/README.md +61 -0
- package/acceptance/tests/basic.test.ts +14 -0
- package/app/config/index.test.ts +19 -0
- package/app/config/index.ts +15 -0
- package/app/config/server/content-migrations.server.test.ts +184 -0
- package/app/config/server/content-migrations.server.ts +59 -0
- package/app/config/server/migrations.server.ts +137 -0
- package/app/config/server.server.test.ts +33 -0
- package/app/config/server.server.ts +52 -0
- package/app/config/types.ts +49 -0
- package/app/entry.client.tsx +51 -0
- package/app/entry.server.tsx +81 -0
- package/app/i18n.ts +11 -0
- package/app/i18next.server.ts +26 -0
- package/app/middleware.server.test.ts +1088 -0
- package/app/middleware.server.ts +241 -0
- package/app/okroute.test.tsx +9 -0
- package/app/okroute.tsx +5 -0
- package/app/reset-fetcher.test.tsx +13 -0
- package/app/reset-fetcher.tsx +7 -0
- package/app/root.test.tsx +300 -0
- package/app/root.tsx +188 -0
- package/app/routes.ts +20 -0
- package/news/.gitkeep +0 -0
- package/package.json +104 -0
- package/public/favicon.ico +0 -0
- package/public/icon.svg +13 -0
- package/react-router.config.ts +5 -0
- package/registry-publicui.config.ts +11 -0
- package/registry.config.ts +13 -0
- package/tests/setup.ts +6 -0
- package/tests/testHelpers.tsx +29 -0
- package/towncrier.toml +33 -0
- package/tsconfig.json +35 -0
- package/vite.config.ts +111 -0
- package/vitest.config.ts +32 -0
package/app/root.tsx
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { useEffect, type PropsWithChildren } from 'react';
|
|
2
|
+
import { data, isRouteErrorResponse } from 'react-router';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { i18nextMiddleware, getLocale } from './i18next.server';
|
|
5
|
+
import type { Route } from './+types/root';
|
|
6
|
+
import config from '@plone/registry';
|
|
7
|
+
import {
|
|
8
|
+
ploneClearAuthCookieContext,
|
|
9
|
+
fetchPloneContent,
|
|
10
|
+
getAPIResourceWithAuth,
|
|
11
|
+
installServerMiddleware,
|
|
12
|
+
PloneClientMiddleware,
|
|
13
|
+
otherResources,
|
|
14
|
+
ploneClientContext,
|
|
15
|
+
ploneContentContext,
|
|
16
|
+
ploneSiteContext,
|
|
17
|
+
ploneUserContext,
|
|
18
|
+
linkMiddleware,
|
|
19
|
+
} from './middleware.server';
|
|
20
|
+
import { getClearAuthCookieHeader } from '@plone/react-router';
|
|
21
|
+
|
|
22
|
+
export const middleware = [
|
|
23
|
+
i18nextMiddleware,
|
|
24
|
+
installServerMiddleware,
|
|
25
|
+
PloneClientMiddleware,
|
|
26
|
+
otherResources,
|
|
27
|
+
getAPIResourceWithAuth,
|
|
28
|
+
fetchPloneContent,
|
|
29
|
+
linkMiddleware,
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export async function loader({ params, request, context }: Route.LoaderArgs) {
|
|
33
|
+
const locale = getLocale(context);
|
|
34
|
+
|
|
35
|
+
const cli = context.get(ploneClientContext);
|
|
36
|
+
const content = context.get(ploneContentContext);
|
|
37
|
+
const site = context.get(ploneSiteContext);
|
|
38
|
+
const user = context.get(ploneUserContext);
|
|
39
|
+
|
|
40
|
+
const path = `/${params['*'] || ''}`;
|
|
41
|
+
|
|
42
|
+
const rootLoaderDataUtilities = config.getUtilities({
|
|
43
|
+
type: 'rootLoaderData',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const rootContentSubRequests = config.getUtilities({
|
|
47
|
+
type: 'rootContentSubRequest',
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
for (const utility of rootContentSubRequests) {
|
|
52
|
+
await utility.method({
|
|
53
|
+
cli,
|
|
54
|
+
content,
|
|
55
|
+
request,
|
|
56
|
+
path,
|
|
57
|
+
params,
|
|
58
|
+
locale,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const rootLoaderDataUtilitiesData = await Promise.all([
|
|
63
|
+
...rootLoaderDataUtilities.map((utility) =>
|
|
64
|
+
utility.method({
|
|
65
|
+
cli,
|
|
66
|
+
content,
|
|
67
|
+
request,
|
|
68
|
+
path,
|
|
69
|
+
params,
|
|
70
|
+
locale,
|
|
71
|
+
}),
|
|
72
|
+
),
|
|
73
|
+
]);
|
|
74
|
+
|
|
75
|
+
const loaderData = {
|
|
76
|
+
content,
|
|
77
|
+
site,
|
|
78
|
+
locale,
|
|
79
|
+
isAuthenticated: user !== null,
|
|
80
|
+
// Each `rootLoaderData` utility returns a `{ status, data }` envelope
|
|
81
|
+
// (see `config/types.ts`). Merge each utility's `data` into the root
|
|
82
|
+
// loader data; utilities namespace their `data` to avoid clobbering.
|
|
83
|
+
// TODO: act on `status` (e.g. propagate a non-2xx to the response).
|
|
84
|
+
...rootLoaderDataUtilitiesData
|
|
85
|
+
.filter((item) => item)
|
|
86
|
+
.reduce(
|
|
87
|
+
(acc, item) => ({
|
|
88
|
+
...acc,
|
|
89
|
+
...(item.data as Record<string, unknown>),
|
|
90
|
+
}),
|
|
91
|
+
{},
|
|
92
|
+
),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return data(loaderData, {
|
|
96
|
+
headers: context.get(ploneClearAuthCookieContext)
|
|
97
|
+
? {
|
|
98
|
+
'Set-Cookie': await getClearAuthCookieHeader(),
|
|
99
|
+
}
|
|
100
|
+
: undefined,
|
|
101
|
+
});
|
|
102
|
+
} catch (error: any) {
|
|
103
|
+
throw data('Content Not Found', {
|
|
104
|
+
status: typeof error.status === 'number' ? error.status : 500,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type RootLoader = typeof loader;
|
|
110
|
+
|
|
111
|
+
export const handle = {
|
|
112
|
+
// In the handle export, we can add a i18n key with namespaces our route
|
|
113
|
+
// will need to load. This key can be a single string or an array of strings.
|
|
114
|
+
// TIP: In most cases, you should set this to your defaultNS from your i18n config
|
|
115
|
+
// or if you did not set one, set it to the i18next default namespace "translation"
|
|
116
|
+
i18n: 'common',
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export function Layout({
|
|
120
|
+
children,
|
|
121
|
+
loaderData,
|
|
122
|
+
}: PropsWithChildren<Route.ComponentProps>) {
|
|
123
|
+
// loaderData can be undefined in case of an error
|
|
124
|
+
const locale = loaderData?.locale || 'en';
|
|
125
|
+
|
|
126
|
+
// Sync the i18n instance's language to the locale detected by the loader,
|
|
127
|
+
// this way, when we do something to change the language, this locale will
|
|
128
|
+
// change and i18next will load the correct translation files
|
|
129
|
+
const { i18n } = useTranslation();
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (i18n.language !== locale) i18n.changeLanguage(locale);
|
|
132
|
+
}, [locale, i18n]);
|
|
133
|
+
|
|
134
|
+
return children;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// ToDo: improve error page and error handling
|
|
138
|
+
export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
|
|
139
|
+
let message = 'Oops!';
|
|
140
|
+
let details = 'An unexpected error occurred.';
|
|
141
|
+
let stack: string | undefined;
|
|
142
|
+
|
|
143
|
+
if (isRouteErrorResponse(error)) {
|
|
144
|
+
switch (error.status) {
|
|
145
|
+
case 404:
|
|
146
|
+
message = '404';
|
|
147
|
+
details = 'The requested page could not be found.';
|
|
148
|
+
break;
|
|
149
|
+
case 401:
|
|
150
|
+
message = '401';
|
|
151
|
+
details = 'You are not authorized to view this page.';
|
|
152
|
+
break;
|
|
153
|
+
case 500:
|
|
154
|
+
message = '500';
|
|
155
|
+
details =
|
|
156
|
+
'The server encountered an internal error. Did you start the backend?';
|
|
157
|
+
break;
|
|
158
|
+
default:
|
|
159
|
+
message = 'Error ' + error.status;
|
|
160
|
+
details = error.statusText || details;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
} else if (import.meta.env.DEV && error && error instanceof Error) {
|
|
164
|
+
details = error.message;
|
|
165
|
+
stack = error.stack;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<html lang="en">
|
|
170
|
+
<head>
|
|
171
|
+
<meta charSet="utf-8" />
|
|
172
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
173
|
+
<meta name="mobile-web-app-capable" content="yes" />
|
|
174
|
+
</head>
|
|
175
|
+
<body>
|
|
176
|
+
<main className="container mx-auto p-4 pt-16">
|
|
177
|
+
<h1>{message}</h1>
|
|
178
|
+
<p>{details}</p>
|
|
179
|
+
{stack && (
|
|
180
|
+
<pre className="w-full overflow-x-auto p-4">
|
|
181
|
+
<code>{stack}</code>
|
|
182
|
+
</pre>
|
|
183
|
+
)}
|
|
184
|
+
</main>
|
|
185
|
+
</body>
|
|
186
|
+
</html>
|
|
187
|
+
);
|
|
188
|
+
}
|
package/app/routes.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { RouteConfig } from '@react-router/dev/routes';
|
|
2
|
+
import type { ReactRouterRouteEntry } from '@plone/types';
|
|
3
|
+
import { route } from '@react-router/dev/routes';
|
|
4
|
+
import { getAddonRoutesConfig } from '@plone/react-router';
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line import/no-unresolved
|
|
7
|
+
import addonsRoutes from '../.plone/registry.routes.json';
|
|
8
|
+
// eslint-disable-next-line import/no-unresolved
|
|
9
|
+
import addonsInfo from '../.plone/registry.addonsInfo.json';
|
|
10
|
+
|
|
11
|
+
const routes: RouteConfig = [
|
|
12
|
+
route('ok', 'okroute.tsx', { id: 'ok' }),
|
|
13
|
+
route('reset-fetcher', 'reset-fetcher.tsx', { id: 'reset-fetcher' }),
|
|
14
|
+
...getAddonRoutesConfig(
|
|
15
|
+
(addonsRoutes as ReactRouterRouteEntry[]) || [],
|
|
16
|
+
addonsInfo,
|
|
17
|
+
),
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
export default routes;
|
package/news/.gitkeep
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plone/aurora",
|
|
3
|
+
"description": "Plone Aurora is the next-generation frontend for Plone CMS",
|
|
4
|
+
"version": "1.0.0-alpha.10",
|
|
5
|
+
"maintainers": [
|
|
6
|
+
{
|
|
7
|
+
"name": "Plone Foundation",
|
|
8
|
+
"url": "https://plone.org"
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"funding": "https://github.com/sponsors/plone",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/plone/aurora.git",
|
|
16
|
+
"directory": "apps/aurora"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/plone/aurora/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://plone-aurora.readthedocs.io/",
|
|
22
|
+
"keywords": [
|
|
23
|
+
"aurora",
|
|
24
|
+
"plone",
|
|
25
|
+
"react",
|
|
26
|
+
"frontend",
|
|
27
|
+
"framework"
|
|
28
|
+
],
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"type": "module",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@react-router/node": "8.2.0",
|
|
36
|
+
"@react-router/serve": "8.2.0",
|
|
37
|
+
"i18next": "^26.3.6",
|
|
38
|
+
"i18next-browser-languagedetector": "^8.0.4",
|
|
39
|
+
"i18next-fs-backend": "^2.6.0",
|
|
40
|
+
"i18next-http-backend": "^3.0.2",
|
|
41
|
+
"isbot": "^5.1.27",
|
|
42
|
+
"jwt-decode": "^4.0.0",
|
|
43
|
+
"react": "^19.2.0",
|
|
44
|
+
"react-dom": "^19.2.0",
|
|
45
|
+
"react-i18next": "^15.4.1",
|
|
46
|
+
"react-router": "8.2.0",
|
|
47
|
+
"remix-i18next": "^8.0.0",
|
|
48
|
+
"@plone/agave": "1.0.0-alpha.7",
|
|
49
|
+
"@plone/client": "2.0.0-alpha.6",
|
|
50
|
+
"@plone/components": "5.0.0-alpha.3",
|
|
51
|
+
"@plone/helpers": "2.0.0-alpha.8",
|
|
52
|
+
"@plone/publicui": "1.0.0-alpha.6",
|
|
53
|
+
"@plone/cmsui": "1.0.0-alpha.7",
|
|
54
|
+
"@plone/react-router": "2.0.0-alpha.6",
|
|
55
|
+
"@plone/layout": "1.0.0-alpha.11",
|
|
56
|
+
"@plone/registry": "4.0.0-alpha.3",
|
|
57
|
+
"@plone/theming": "1.0.0-alpha.7",
|
|
58
|
+
"@plone/blocks": "1.0.0-alpha.14",
|
|
59
|
+
"@plone/plate": "1.0.0-alpha.16",
|
|
60
|
+
"@plone/contents": "1.0.0-alpha.1"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@babel/core": "^7.28.5",
|
|
64
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
65
|
+
"@react-router/dev": "8.2.0",
|
|
66
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
67
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
68
|
+
"@testing-library/react": "^16.2.0",
|
|
69
|
+
"@types/node": "^24",
|
|
70
|
+
"@types/react": "^19.2.0",
|
|
71
|
+
"@types/react-dom": "^19.2.0",
|
|
72
|
+
"@vitest/coverage-v8": "^4.1.4",
|
|
73
|
+
"babel-plugin-react-compiler": "1.0.0",
|
|
74
|
+
"release-it": "^19.0.5",
|
|
75
|
+
"rollup-plugin-visualizer": "^7.0.1",
|
|
76
|
+
"typescript": "^5.9.2",
|
|
77
|
+
"vite": "^8.0.8",
|
|
78
|
+
"vite-plugin-babel": "1.7.3",
|
|
79
|
+
"vite-plugin-devtools-json": "^1.0.0",
|
|
80
|
+
"vitest": "^4.1.0",
|
|
81
|
+
"@plone/types": "3.0.0-alpha.5"
|
|
82
|
+
},
|
|
83
|
+
"engines": {
|
|
84
|
+
"node": ">=22.22.0"
|
|
85
|
+
},
|
|
86
|
+
"scripts": {
|
|
87
|
+
"dev": "pnpm exec init-loaders && react-router dev",
|
|
88
|
+
"dev:publicui": "REGISTRYCONFIG=registry-publicui.config.ts pnpm exec init-loaders && react-router dev",
|
|
89
|
+
"test": "pnpm exec init-loaders && vitest --coverage",
|
|
90
|
+
"start": "pnpm exec init-loaders && react-router dev",
|
|
91
|
+
"build": "pnpm exec init-loaders && react-router build",
|
|
92
|
+
"build:publicui": "REGISTRYCONFIG=registry-publicui.config.ts pnpm exec init-loaders && react-router build",
|
|
93
|
+
"start:prod": "react-router-serve ./build/server/index.js",
|
|
94
|
+
"check:ts": "react-router typegen && tsc",
|
|
95
|
+
"typecheck": "react-router typegen && tsc",
|
|
96
|
+
"typegen": "react-router typegen",
|
|
97
|
+
"release": "release-it",
|
|
98
|
+
"release-alpha": "release-it --preRelease=alpha",
|
|
99
|
+
"prettier:fix": "prettier --write '**/*.{js,jsx,ts,tsx}'",
|
|
100
|
+
"lint:fix": "eslint --max-warnings=0 './**/*.{js,jsx,ts,tsx}' --fix --no-error-on-unmatched-pattern",
|
|
101
|
+
"stylelint:fix": "sh -c 'if [ -f .stylelintrc ] || [ -f .stylelintrc.json ] || [ -f .stylelintrc.js ] || [ -f .stylelintrc.cjs ] || [ -f stylelint.config.js ] || [ -f stylelint.config.cjs ] || [ -f stylelint.config.mjs ]; then stylelint '''./**/*.{css,scss,less}''' --fix --allow-empty-input; else echo \"No local stylelint config, skipping\"; fi'",
|
|
102
|
+
"format": "pnpm prettier:fix && pnpm lint:fix && pnpm stylelint:fix"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
Binary file
|
package/public/icon.svg
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg width="41" height="41" viewBox="0 0 41 41" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_1_2)">
|
|
3
|
+
<path d="M17.717 15.963C20.1482 15.963 22.119 13.9922 22.119 11.561C22.119 9.12984 20.1482 7.159 17.717 7.159C15.2858 7.159 13.315 9.12984 13.315 11.561C13.315 13.9922 15.2858 15.963 17.717 15.963Z" fill="#0083BE"/>
|
|
4
|
+
<path d="M31.069 20.355C31.069 22.791 29.1 24.756 26.669 24.756C24.239 24.756 22.269 22.786 22.269 20.355C22.269 17.922 24.247 15.957 26.669 15.957C29.101 15.954 31.069 17.924 31.069 20.355Z" fill="#0083BE"/>
|
|
5
|
+
<path d="M17.702 33.578C20.1331 33.578 22.104 31.6071 22.104 29.176C22.104 26.7448 20.1331 24.774 17.702 24.774C15.2708 24.774 13.3 26.7448 13.3 29.176C13.3 31.6071 15.2708 33.578 17.702 33.578Z" fill="#0083BE"/>
|
|
6
|
+
<path d="M20.343 0C9.108 0.001 0.001 9.107 0 20.343C0.001 31.577 9.105 40.684 20.343 40.686C31.578 40.684 40.684 31.582 40.686 20.343C40.684 9.107 31.578 0.001 20.343 0ZM31.792 31.792C28.854 34.726 24.816 36.534 20.341 36.535C15.862 36.534 11.828 34.723 8.891 31.792C5.958 28.854 4.15 24.816 4.149 20.343C4.15 15.865 5.96 11.83 8.892 8.893C11.83 5.959 15.864 4.151 20.342 4.15C24.82 4.151 28.855 5.962 31.792 8.893C34.727 11.831 36.534 15.869 36.536 20.343C36.535 24.819 34.726 28.854 31.792 31.792Z" fill="#0083BE"/>
|
|
7
|
+
</g>
|
|
8
|
+
<defs>
|
|
9
|
+
<clipPath id="clip0_1_2">
|
|
10
|
+
<rect width="40.686" height="40.686" fill="white"/>
|
|
11
|
+
</clipPath>
|
|
12
|
+
</defs>
|
|
13
|
+
</svg>
|
package/tests/setup.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import i18next from 'i18next';
|
|
3
|
+
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { I18nextProvider, initReactI18next } from 'react-i18next';
|
|
6
|
+
|
|
7
|
+
import i18n from '../app/i18n';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Use this function to render a component with the i18next provider
|
|
11
|
+
* @param children The route Stub to render
|
|
12
|
+
*/
|
|
13
|
+
export async function renderWithI18n(children: React.ReactNode) {
|
|
14
|
+
await i18next
|
|
15
|
+
.use(initReactI18next)
|
|
16
|
+
.use(LanguageDetector)
|
|
17
|
+
.init({
|
|
18
|
+
...i18n,
|
|
19
|
+
ns: ['common'],
|
|
20
|
+
detection: {
|
|
21
|
+
order: ['htmlTag'],
|
|
22
|
+
caches: [],
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
const result = render(
|
|
26
|
+
<I18nextProvider i18n={i18next}>{children}</I18nextProvider>,
|
|
27
|
+
);
|
|
28
|
+
return result;
|
|
29
|
+
}
|
package/towncrier.toml
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[tool.towncrier]
|
|
2
|
+
filename = "CHANGELOG.md"
|
|
3
|
+
directory = "news/"
|
|
4
|
+
title_format = "## {version} ({project_date})"
|
|
5
|
+
underlines = ["", "", ""]
|
|
6
|
+
template = "../../packages/scripts/templates/towncrier_template.jinja"
|
|
7
|
+
start_string = "<!-- towncrier release notes start -->\n"
|
|
8
|
+
issue_format = "[#{issue}](https://github.com/plone/aurora/issues/{issue})"
|
|
9
|
+
|
|
10
|
+
[[tool.towncrier.type]]
|
|
11
|
+
directory = "breaking"
|
|
12
|
+
name = "Breaking"
|
|
13
|
+
showcontent = true
|
|
14
|
+
|
|
15
|
+
[[tool.towncrier.type]]
|
|
16
|
+
directory = "feature"
|
|
17
|
+
name = "Feature"
|
|
18
|
+
showcontent = true
|
|
19
|
+
|
|
20
|
+
[[tool.towncrier.type]]
|
|
21
|
+
directory = "bugfix"
|
|
22
|
+
name = "Bugfix"
|
|
23
|
+
showcontent = true
|
|
24
|
+
|
|
25
|
+
[[tool.towncrier.type]]
|
|
26
|
+
directory = "internal"
|
|
27
|
+
name = "Internal"
|
|
28
|
+
showcontent = true
|
|
29
|
+
|
|
30
|
+
[[tool.towncrier.type]]
|
|
31
|
+
directory = "documentation"
|
|
32
|
+
name = "Documentation"
|
|
33
|
+
showcontent = true
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": [
|
|
3
|
+
"**/*.ts",
|
|
4
|
+
"**/*.tsx",
|
|
5
|
+
"**/.server/**/*.ts",
|
|
6
|
+
"**/.server/**/*.tsx",
|
|
7
|
+
"**/.client/**/*.ts",
|
|
8
|
+
"**/.client/**/*.tsx",
|
|
9
|
+
".react-router/types/**/*"
|
|
10
|
+
],
|
|
11
|
+
"exclude": ["packages/*"],
|
|
12
|
+
"compilerOptions": {
|
|
13
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
14
|
+
"types": ["@react-router/node", "vite/client", "@plone/components/icons"],
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"jsx": "react-jsx",
|
|
18
|
+
"module": "ESNext",
|
|
19
|
+
"moduleResolution": "Bundler",
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"target": "ES2022",
|
|
22
|
+
"strict": true,
|
|
23
|
+
"allowJs": true,
|
|
24
|
+
"skipLibCheck": true,
|
|
25
|
+
"forceConsistentCasingInFileNames": true,
|
|
26
|
+
"paths": {
|
|
27
|
+
"~/*": ["./app/*"],
|
|
28
|
+
"@plone/aurora/*": ["./*"],
|
|
29
|
+
"@plone/plate/*": ["../../packages/plate/src/*"]
|
|
30
|
+
},
|
|
31
|
+
"noEmit": true,
|
|
32
|
+
"rootDirs": [".", "./.react-router/types"],
|
|
33
|
+
"plugins": [{ "name": "@react-router/dev" }]
|
|
34
|
+
}
|
|
35
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { reactRouter } from '@react-router/dev/vite';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { defineConfig, PluginOption } from 'vite';
|
|
4
|
+
import { PloneRegistryVitePlugin } from '@plone/registry/vite-plugin';
|
|
5
|
+
import { PloneSVGRVitePlugin } from '@plone/components/vite-plugin-svgr';
|
|
6
|
+
import applyAddonViteConfiguration from './.plone/vite.loader.js';
|
|
7
|
+
import babel from 'vite-plugin-babel';
|
|
8
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
9
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
10
|
+
import devtoolsJson from 'vite-plugin-devtools-json';
|
|
11
|
+
|
|
12
|
+
export default defineConfig(({ command, mode, isSsrBuild }) => {
|
|
13
|
+
const analyze = process.env.ANALYZE === 'true';
|
|
14
|
+
const target = isSsrBuild ? 'server' : 'client';
|
|
15
|
+
const statsDir = path.resolve(import.meta.dirname, 'build', 'stats');
|
|
16
|
+
|
|
17
|
+
const baseConfig = {
|
|
18
|
+
plugins: [
|
|
19
|
+
PloneSVGRVitePlugin(),
|
|
20
|
+
PloneRegistryVitePlugin(),
|
|
21
|
+
tailwindcss(),
|
|
22
|
+
reactRouter(),
|
|
23
|
+
babel({
|
|
24
|
+
include: /\.tsx?$/,
|
|
25
|
+
exclude: /node_modules/,
|
|
26
|
+
babelConfig: {
|
|
27
|
+
presets: ['@babel/preset-typescript'],
|
|
28
|
+
plugins: ['babel-plugin-react-compiler'],
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
devtoolsJson(),
|
|
32
|
+
...(analyze
|
|
33
|
+
? [
|
|
34
|
+
visualizer({
|
|
35
|
+
filename: path.join(statsDir, `stats-${target}.html`),
|
|
36
|
+
template: 'treemap',
|
|
37
|
+
gzipSize: true,
|
|
38
|
+
brotliSize: true,
|
|
39
|
+
}),
|
|
40
|
+
visualizer({
|
|
41
|
+
filename: path.join(statsDir, `stats-${target}.json`),
|
|
42
|
+
template: 'raw-data',
|
|
43
|
+
gzipSize: true,
|
|
44
|
+
brotliSize: true,
|
|
45
|
+
}),
|
|
46
|
+
]
|
|
47
|
+
: []),
|
|
48
|
+
] as PluginOption[],
|
|
49
|
+
optimizeDeps: {
|
|
50
|
+
// Server-only deps that Vite would otherwise still pick up for the
|
|
51
|
+
// client bundle — keep in sync with ssr.optimizeDeps.include below
|
|
52
|
+
exclude: [
|
|
53
|
+
'i18next-fs-backend',
|
|
54
|
+
'i18next-fs-backend/cjs',
|
|
55
|
+
'remix-i18next',
|
|
56
|
+
],
|
|
57
|
+
include: [
|
|
58
|
+
// App-level deps (in apps/aurora/package.json)
|
|
59
|
+
'i18next',
|
|
60
|
+
'i18next-browser-languagedetector',
|
|
61
|
+
'i18next-http-backend',
|
|
62
|
+
'react-i18next',
|
|
63
|
+
// Injected by babel-plugin-react-compiler, not in any package.json
|
|
64
|
+
'react/compiler-runtime',
|
|
65
|
+
// @plone/components and @plone/helpers are not registered add-ons, so
|
|
66
|
+
// their deps can't be declared in vite.extend.js — list them here
|
|
67
|
+
'@plone/components > @internationalized/date',
|
|
68
|
+
'@plone/components > @react-aria/utils',
|
|
69
|
+
'@plone/components > @react-spectrum/utils',
|
|
70
|
+
'@plone/components > clsx',
|
|
71
|
+
'@plone/components > react-aria',
|
|
72
|
+
'@plone/components > react-aria-components',
|
|
73
|
+
'@plone/components > react-aria-components/DropZone',
|
|
74
|
+
'@plone/components > react-aria-components/Form',
|
|
75
|
+
'@plone/components > react-aria-components/Group',
|
|
76
|
+
'@plone/components > react-aria-components/Modal',
|
|
77
|
+
'@plone/components > react-aria-components/Table',
|
|
78
|
+
'@plone/components > react-aria-components/Tooltip',
|
|
79
|
+
'@plone/components > react-aria-components/composeRenderProps',
|
|
80
|
+
'@plone/components > react-stately',
|
|
81
|
+
'@plone/components > tailwind-merge',
|
|
82
|
+
'@plone/components > tailwind-variants',
|
|
83
|
+
'@plone/helpers > jotai',
|
|
84
|
+
'@plone/helpers > jotai/utils',
|
|
85
|
+
'@plone/helpers > jotai-optics',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
ssr: {
|
|
89
|
+
optimizeDeps: {
|
|
90
|
+
include: ['i18next-fs-backend/cjs', 'isbot', 'remix-i18next'],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
resolve: {
|
|
94
|
+
tsconfigPaths: true,
|
|
95
|
+
},
|
|
96
|
+
server: {
|
|
97
|
+
port: 3000,
|
|
98
|
+
fs: {
|
|
99
|
+
// Allow serving files from one level up to the project root
|
|
100
|
+
// (required by the Cookieplone setup)
|
|
101
|
+
allow: ['../../../.'],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return applyAddonViteConfiguration(baseConfig, {
|
|
107
|
+
command,
|
|
108
|
+
mode,
|
|
109
|
+
isSsrBuild,
|
|
110
|
+
});
|
|
111
|
+
});
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { coverageConfigDefaults, defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
// https://vitejs.dev/config/
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [],
|
|
6
|
+
test: {
|
|
7
|
+
globals: true,
|
|
8
|
+
environment: 'jsdom',
|
|
9
|
+
setupFiles: ['./tests/setup.ts'],
|
|
10
|
+
// you might want to disable it, if you don't have tests that rely on CSS
|
|
11
|
+
// since parsing CSS is slow
|
|
12
|
+
// css: true,
|
|
13
|
+
exclude: ['**/node_modules/**', '**/lib/**', '**/acceptance/**'],
|
|
14
|
+
coverage: {
|
|
15
|
+
exclude: [
|
|
16
|
+
...coverageConfigDefaults.exclude,
|
|
17
|
+
'packages/**',
|
|
18
|
+
'build/**',
|
|
19
|
+
'*.config.ts',
|
|
20
|
+
'.plone/**',
|
|
21
|
+
'app/entry.server.tsx',
|
|
22
|
+
'app/entry.client.tsx',
|
|
23
|
+
'app/i18next.server.ts',
|
|
24
|
+
'app/i18n.ts',
|
|
25
|
+
'app/routes.ts',
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
resolve: {
|
|
30
|
+
tsconfigPaths: true,
|
|
31
|
+
},
|
|
32
|
+
});
|