@common-stack/generate-plugin 8.0.2-alpha.1 → 8.1.1-alpha.1
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/CHANGELOG.md +4 -26
- package/LICENSE +34 -21
- package/lib/generators/add-backend/files/package.json +2 -2
- package/lib/generators/add-backend/files/src/modules/index.ts.template +2 -0
- package/lib/generators/add-backend/files/src/service.ts.template +2 -2
- package/lib/generators/add-frontend/frameworks/antui/src/root.tsx.template +37 -2
- package/lib/generators/add-frontend/frameworks/chakraui/src/root.tsx.template +38 -7
- package/lib/generators/add-frontend/frameworks/tailwindui/src/entry.client.tsx.template +11 -15
- package/lib/generators/add-frontend/frameworks/tailwindui/src/entry.server.tsx.template +9 -10
- package/lib/generators/add-frontend/frameworks/tailwindui/src/root.tsx.template +89 -34
- package/lib/generators/add-frontend/frameworks/tailwindui/tailwind.config.ts.template +288 -9
- package/lib/generators/add-frontend/templates/package.json +4 -8
- package/lib/generators/add-frontend/templates/server.js +11 -10
- package/lib/generators/add-frontend/templates/src/routes.ts.template +38 -0
- package/lib/generators/add-frontend/templates/vite.config.ts.template +91 -48
- package/lib/generators/add-fullstack/files/Jenkinsfile +1 -1
- package/lib/generators/add-fullstack/files/_prettierignore +7 -0
- package/lib/generators/add-fullstack/files/cdecode-config.json +6 -2
- package/lib/generators/add-fullstack/files/package.json +9 -13
- package/lib/generators/add-fullstack/files/scripts/fix-enum-references.js +58 -0
- package/lib/generators/add-fullstack/files/tsconfig.json +20 -24
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.cjs +1 -0
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.cjs.map +1 -1
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.mjs +1 -0
- package/lib/generators/add-fullstack/updates/htmlPluginUpdate.mjs.map +1 -1
- package/lib/generators/add-moleculer/files/package.json +6 -6
- package/lib/generators/add-package/files/browser/package.json +2 -2
- package/lib/generators/add-package/files/client/package.json +1 -1
- package/lib/generators/add-package/files/core/package.json +1 -1
- package/lib/generators/add-package/files/server/package.json +4 -4
- package/package.json +3 -3
- package/src/generators/add-backend/files/package.json +2 -2
- package/src/generators/add-backend/files/src/modules/index.ts.template +2 -0
- package/src/generators/add-backend/files/src/service.ts.template +2 -2
- package/src/generators/add-frontend/frameworks/antui/src/root.tsx.template +37 -2
- package/src/generators/add-frontend/frameworks/chakraui/src/root.tsx.template +38 -7
- package/src/generators/add-frontend/frameworks/tailwindui/src/entry.client.tsx.template +11 -15
- package/src/generators/add-frontend/frameworks/tailwindui/src/entry.server.tsx.template +9 -10
- package/src/generators/add-frontend/frameworks/tailwindui/src/root.tsx.template +89 -34
- package/src/generators/add-frontend/frameworks/tailwindui/tailwind.config.ts.template +288 -9
- package/src/generators/add-frontend/templates/package.json +4 -8
- package/src/generators/add-frontend/templates/server.js +11 -10
- package/src/generators/add-frontend/templates/src/routes.ts.template +38 -0
- package/src/generators/add-frontend/templates/vite.config.ts.template +91 -48
- package/src/generators/add-fullstack/files/Jenkinsfile +1 -1
- package/src/generators/add-fullstack/files/_prettierignore +7 -0
- package/src/generators/add-fullstack/files/cdecode-config.json +6 -2
- package/src/generators/add-fullstack/files/package.json +9 -13
- package/src/generators/add-fullstack/files/scripts/fix-enum-references.js +58 -0
- package/src/generators/add-fullstack/files/tsconfig.json +20 -24
- package/src/generators/add-fullstack/updates/htmlPluginUpdate.ts +2 -1
- package/src/generators/add-moleculer/files/package.json +6 -6
- package/src/generators/add-package/files/browser/package.json +2 -2
- package/src/generators/add-package/files/client/package.json +1 -1
- package/src/generators/add-package/files/core/package.json +1 -1
- package/src/generators/add-package/files/server/package.json +4 -4
- package/lib/generators/add-backend/files/src/api/root-schema.graphqls +0 -109
- package/src/generators/add-backend/files/src/api/root-schema.graphqls +0 -109
package/CHANGELOG.md
CHANGED
|
@@ -3,37 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.
|
|
6
|
+
## [8.1.1-alpha.1](https://github.com/cdmbase/common-stack/compare/v8.1.1-alpha.0...v8.1.1-alpha.1) (2025-11-25)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @common-stack/generate-plugin
|
|
9
9
|
|
|
10
|
-
## [8.
|
|
10
|
+
## [8.1.1-alpha.0](https://github.com/cdmbase/common-stack/compare/v6.0.8-alpha.0...v8.1.1-alpha.0) (2025-11-24)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [8.0.1-alpha.5](https://github.com/cdmbase/common-stack/compare/v8.0.1-alpha.4...v8.0.1-alpha.5) (2025-02-28)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @common-stack/generate-plugin
|
|
17
|
-
|
|
18
|
-
## [8.0.1-alpha.4](https://github.com/cdmbase/common-stack/compare/v8.0.1-alpha.3...v8.0.1-alpha.4) (2025-02-27)
|
|
19
|
-
|
|
20
|
-
**Note:** Version bump only for package @common-stack/generate-plugin
|
|
21
|
-
|
|
22
|
-
## [8.0.1-alpha.3](https://github.com/cdmbase/common-stack/compare/v8.0.1-alpha.2...v8.0.1-alpha.3) (2025-02-25)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @common-stack/generate-plugin
|
|
25
|
-
|
|
26
|
-
## [8.0.1-alpha.2](https://github.com/cdmbase/common-stack/compare/v8.0.1-alpha.1...v8.0.1-alpha.2) (2025-02-21)
|
|
27
|
-
|
|
28
|
-
**Note:** Version bump only for package @common-stack/generate-plugin
|
|
29
|
-
|
|
30
|
-
## [8.0.1-alpha.1](https://github.com/cdmbase/common-stack/compare/v8.0.1-alpha.0...v8.0.1-alpha.1) (2025-02-07)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @common-stack/generate-plugin
|
|
33
|
-
|
|
34
|
-
## [8.0.1-alpha.0](https://github.com/cdmbase/common-stack/compare/v6.0.8-alpha.0...v8.0.1-alpha.0) (2025-02-07)
|
|
12
|
+
### Features
|
|
35
13
|
|
|
36
|
-
**
|
|
14
|
+
- **server-stack:** add subGraph support ([6e5a232](https://github.com/cdmbase/common-stack/commit/6e5a232191b87065d197f090e923218eaa3deb95))
|
|
37
15
|
|
|
38
16
|
## [6.0.8-alpha.0](https://github.com/cdmbase/common-stack/compare/v0.0.251...v6.0.8-alpha.0) (2024-12-16)
|
|
39
17
|
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2017 CDMBase LLC.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
IMPLIED,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
PROPRIETARY LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-2025 CDMBase LLC. All Rights Reserved.
|
|
4
|
+
|
|
5
|
+
This software and associated documentation files (the "Software") are the
|
|
6
|
+
proprietary and confidential information of CDMBase LLC ("Confidential Information").
|
|
7
|
+
|
|
8
|
+
NOTICE: All information contained herein is, and remains the property of
|
|
9
|
+
CDMBase LLC. The intellectual and technical concepts contained herein are
|
|
10
|
+
proprietary to CDMBase LLC and may be covered by U.S. and Foreign Patents,
|
|
11
|
+
patents in process, and are protected by trade secret or copyright law.
|
|
12
|
+
|
|
13
|
+
Dissemination of this information or reproduction of this material is strictly
|
|
14
|
+
forbidden unless prior written permission is obtained from CDMBase LLC.
|
|
15
|
+
|
|
16
|
+
NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL
|
|
17
|
+
PROPERTY RIGHTS ARE GRANTED BY THIS DOCUMENT.
|
|
18
|
+
|
|
19
|
+
RESTRICTIONS:
|
|
20
|
+
1. You may NOT use, copy, modify, merge, publish, distribute, sublicense,
|
|
21
|
+
and/or sell copies of the Software without explicit written permission
|
|
22
|
+
from CDMBase LLC.
|
|
23
|
+
2. You may NOT reverse engineer, decompile, or disassemble the Software.
|
|
24
|
+
3. You may NOT remove or alter any proprietary notices or labels on the Software.
|
|
25
|
+
4. The Software is licensed, not sold.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
30
|
+
CDMBASE LLC BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
31
|
+
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
32
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
|
+
|
|
34
|
+
For licensing inquiries, please contact: legal@cdmbase.com
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"type": "git",
|
|
22
22
|
"url": "git+https://github.com/cdmbase/fullstack-pro.git"
|
|
23
23
|
},
|
|
24
|
-
"license": "
|
|
24
|
+
"license": "UNLICENSED",
|
|
25
25
|
"author": "CDMBase LLC",
|
|
26
26
|
"main": "dist/index.js",
|
|
27
27
|
"typings": "dist/main.d.ts",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@apollo/client": "^3.9.0",
|
|
66
66
|
"@babel/runtime": "^7.20.1",
|
|
67
|
-
"@common-stack/server-stack": "8.
|
|
67
|
+
"@common-stack/server-stack": "8.1.1-alpha.0",
|
|
68
68
|
"@remix-run/node": "~2.15.3",
|
|
69
69
|
"lodash": "^4.17.15",
|
|
70
70
|
"react": "18.2.0"
|
|
@@ -3,6 +3,8 @@ import modules, { settings } from './module';
|
|
|
3
3
|
export default modules;
|
|
4
4
|
export { settings };
|
|
5
5
|
|
|
6
|
+
export const serverConfigurations = {};
|
|
7
|
+
|
|
6
8
|
// export const updateContainers = (options) => {
|
|
7
9
|
// if (process.env.NODE_ENV !== 'development') {
|
|
8
10
|
// options.forEach(el => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { logger } from '@cdm-logger/server';
|
|
2
2
|
import * as url from 'url';
|
|
3
|
-
import modules, { settings } from './modules';
|
|
3
|
+
import modules, { settings, serverConfigurations } from './modules';
|
|
4
4
|
import { MainStackServer } from '@common-stack/server-stack';
|
|
5
5
|
import { config } from './config';
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ export class Service {
|
|
|
10
10
|
private app: MainStackServer;
|
|
11
11
|
|
|
12
12
|
public async initialize() {
|
|
13
|
-
this.app = new MainStackServer(modules, settings);
|
|
13
|
+
this.app = new MainStackServer(modules, settings, serverConfigurations);
|
|
14
14
|
await this.app.initialize();
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useRouteLoaderData, useRouteError } from '@remix-run/react';
|
|
4
|
+
import { json } from '@remix-run/node';
|
|
4
5
|
import { PluginArea } from '@common-stack/client-react';
|
|
5
6
|
import { subscribeReduxRouter } from '@common-stack/remix-router-redux';
|
|
6
7
|
import { ApplicationErrorHandler } from '@admin-layout/ant-ui';
|
|
@@ -10,10 +11,40 @@ import clientModules, { plugins } from '@app/frontend-stack-react/modules.js';
|
|
|
10
11
|
// @ts-ignore
|
|
11
12
|
import { useChangeLanguage } from 'remix-i18next/react';
|
|
12
13
|
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { LayoutCookieProvider } from '@admin-layout/client';
|
|
15
|
+
import { settingsLoaderUtil } from '@admin-layout/client/lib/components/UpdateSettings/UpdateSettings.server';
|
|
16
|
+
import { IAppLoadContext, IResourceParams } from '@common-stack/client-core';
|
|
17
|
+
import { FillRenderProvider, PluginsLoader } from '@common-stack/components-pro';
|
|
13
18
|
// @ts-ignore
|
|
14
19
|
import { ErrorBoundary } from '@app/frontend-stack-react/entries/antui/components/ErrorBoundary';
|
|
15
20
|
import { LocaleContext } from './context';
|
|
16
21
|
|
|
22
|
+
export const loader = async ({
|
|
23
|
+
request,
|
|
24
|
+
context,
|
|
25
|
+
params,
|
|
26
|
+
}: {
|
|
27
|
+
request: Request;
|
|
28
|
+
context: IAppLoadContext;
|
|
29
|
+
params: IResourceParams;
|
|
30
|
+
}) => {
|
|
31
|
+
const settingsResponse = await settingsLoaderUtil({ request });
|
|
32
|
+
const loadedPlugins = await PluginsLoader(plugins, { request, context, params });
|
|
33
|
+
|
|
34
|
+
return json(
|
|
35
|
+
{
|
|
36
|
+
settings: settingsResponse?.settings,
|
|
37
|
+
loadedPlugins,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
headers: [
|
|
41
|
+
['Cache-Control', 'max-age=300, s-maxage=600'],
|
|
42
|
+
['Set-Cookie', settingsResponse?.setCookie],
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
17
48
|
export const handle = {
|
|
18
49
|
i18n: 'common',
|
|
19
50
|
};
|
|
@@ -77,7 +108,9 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
77
108
|
</head>
|
|
78
109
|
<body>
|
|
79
110
|
<PluginArea />
|
|
80
|
-
|
|
111
|
+
<FillRenderProvider>
|
|
112
|
+
{clientModules.getWrappedRoot(children)}
|
|
113
|
+
</FillRenderProvider>
|
|
81
114
|
<ScrollRestoration />
|
|
82
115
|
<Scripts />
|
|
83
116
|
{getConstants()}
|
|
@@ -90,7 +123,9 @@ export default function App() {
|
|
|
90
123
|
return (
|
|
91
124
|
<ApplicationErrorHandler plugins={plugins}>
|
|
92
125
|
<ConfigProvider>
|
|
93
|
-
<
|
|
126
|
+
<LayoutCookieProvider>
|
|
127
|
+
<Outlet />
|
|
128
|
+
</LayoutCookieProvider>
|
|
94
129
|
</ConfigProvider>
|
|
95
130
|
</ApplicationErrorHandler>
|
|
96
131
|
);
|
|
@@ -14,9 +14,41 @@ import { useContext } from 'react';
|
|
|
14
14
|
import { ServerStyleContext, ClientStyleContext, LocaleContext } from './context';
|
|
15
15
|
import { withEmotionCache } from '@emotion/react';
|
|
16
16
|
import { useChangeLanguage } from 'remix-i18next/react';
|
|
17
|
+
import { LayoutCookieProvider } from '@admin-layout/client';
|
|
18
|
+
import { settingsLoaderUtil } from '@admin-layout/client/lib/components/UpdateSettings/UpdateSettings.server';
|
|
19
|
+
import { IAppLoadContext, IResourceParams } from '@common-stack/client-core';
|
|
20
|
+
import { FillRenderProvider, PluginsLoader } from '@common-stack/components-pro';
|
|
21
|
+
// @ts-ignore
|
|
17
22
|
import { i18nextInstance as i18next } from '@app/frontend-stack-react/i18n-localization/i18next.server.js';
|
|
23
|
+
// @ts-ignore
|
|
18
24
|
import { ErrorBoundary } from '@app/frontend-stack-react/entries/chakraui/components/ErrorBoundary.js';
|
|
19
25
|
|
|
26
|
+
export const loader = async ({
|
|
27
|
+
request,
|
|
28
|
+
context,
|
|
29
|
+
params,
|
|
30
|
+
}: {
|
|
31
|
+
request: Request;
|
|
32
|
+
context: IAppLoadContext;
|
|
33
|
+
params: IResourceParams;
|
|
34
|
+
}) => {
|
|
35
|
+
const settingsResponse = await settingsLoaderUtil({ request });
|
|
36
|
+
const loadedPlugins = await PluginsLoader(plugins, { request, context, params });
|
|
37
|
+
|
|
38
|
+
return json(
|
|
39
|
+
{
|
|
40
|
+
settings: settingsResponse?.settings,
|
|
41
|
+
loadedPlugins,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
headers: [
|
|
45
|
+
['Cache-Control', 'max-age=300, s-maxage=600'],
|
|
46
|
+
['Set-Cookie', settingsResponse?.setCookie],
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
20
52
|
interface DocumentProps {
|
|
21
53
|
children: React.ReactNode;
|
|
22
54
|
}
|
|
@@ -67,12 +99,7 @@ export const Document = withEmotionCache(({ children }: DocumentProps, emotionCa
|
|
|
67
99
|
</>
|
|
68
100
|
);
|
|
69
101
|
});
|
|
70
|
-
|
|
71
|
-
export let loader = async ({ request }) => {
|
|
72
|
-
let locale = await i18next.getLocale(request);
|
|
73
|
-
return json({ locale });
|
|
74
|
-
};
|
|
75
|
-
*/
|
|
102
|
+
|
|
76
103
|
export let handle = {
|
|
77
104
|
i18n: 'common',
|
|
78
105
|
};
|
|
@@ -94,7 +121,11 @@ export default function App() {
|
|
|
94
121
|
|
|
95
122
|
return (
|
|
96
123
|
<ApplicationErrorHandler plugins={plugins}>
|
|
97
|
-
<Document>
|
|
124
|
+
<Document>
|
|
125
|
+
<FillRenderProvider>
|
|
126
|
+
{clientModules.getWrappedRoot(<LayoutCookieProvider><Outlet /></LayoutCookieProvider>)}
|
|
127
|
+
</FillRenderProvider>
|
|
128
|
+
</Document>
|
|
98
129
|
</ApplicationErrorHandler>
|
|
99
130
|
);
|
|
100
131
|
}
|
|
@@ -55,21 +55,17 @@ async function hydrate() {
|
|
|
55
55
|
startTransition(() => {
|
|
56
56
|
hydrateRoot(
|
|
57
57
|
document,
|
|
58
|
-
|
|
59
|
-
<
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
</ReduxProvider>
|
|
70
|
-
</StrictMode>
|
|
71
|
-
</I18nextProvider>
|
|
72
|
-
) as any,
|
|
58
|
+
<I18nextProvider i18n={i18next}>
|
|
59
|
+
<ReduxProvider store={store}>
|
|
60
|
+
<SlotFillProvider>
|
|
61
|
+
<InversifyProvider container={container} modules={clientModules}>
|
|
62
|
+
<ApolloProvider client={client}>
|
|
63
|
+
<RemixBrowser />
|
|
64
|
+
</ApolloProvider>
|
|
65
|
+
</InversifyProvider>
|
|
66
|
+
</SlotFillProvider>
|
|
67
|
+
</ReduxProvider>
|
|
68
|
+
</I18nextProvider>,
|
|
73
69
|
);
|
|
74
70
|
});
|
|
75
71
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* For more information, see https://remix.run/file-conventions/entry.server
|
|
5
5
|
*/
|
|
6
6
|
import * as React from 'react';
|
|
7
|
+
import 'reflect-metadata';
|
|
7
8
|
(global as any).__CLIENT__ = false;
|
|
8
9
|
(global as any).__SERVER__ = true;
|
|
9
10
|
import { PassThrough, Transform } from 'node:stream';
|
|
@@ -28,7 +29,8 @@ import config from '@app/cde-webconfig.json';
|
|
|
28
29
|
// @ts-ignore
|
|
29
30
|
import type { IAppLoadContext } from '@common-stack/client-core';
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
// Reject/cancel all pending promises after 5 seconds
|
|
33
|
+
export const streamTimeout = 5000;
|
|
32
34
|
|
|
33
35
|
class ConstantsTransform extends Transform {
|
|
34
36
|
_fills: string[];
|
|
@@ -120,7 +122,7 @@ function handleBotRequest(
|
|
|
120
122
|
let shellRendered = false;
|
|
121
123
|
const { pipe, abort } = renderToPipeableStream(
|
|
122
124
|
<I18nextProvider i18n={i18nInstance}>
|
|
123
|
-
<RemixServer context={remixContext} url={request.url}
|
|
125
|
+
<RemixServer context={remixContext} url={request.url} />
|
|
124
126
|
</I18nextProvider>,
|
|
125
127
|
{
|
|
126
128
|
onAllReady() {
|
|
@@ -154,7 +156,7 @@ function handleBotRequest(
|
|
|
154
156
|
},
|
|
155
157
|
);
|
|
156
158
|
|
|
157
|
-
setTimeout(abort,
|
|
159
|
+
setTimeout(abort, streamTimeout + 1000);
|
|
158
160
|
});
|
|
159
161
|
}
|
|
160
162
|
|
|
@@ -184,11 +186,7 @@ function handleBrowserRequest(
|
|
|
184
186
|
<SlotFillProvider context={slotFillContext}>
|
|
185
187
|
<InversifyProvider container={container} modules={clientModules as any}>
|
|
186
188
|
<ApolloProvider client={client}>
|
|
187
|
-
<RemixServer
|
|
188
|
-
context={remixContext}
|
|
189
|
-
url={request.url}
|
|
190
|
-
abortDelay={ABORT_DELAY}
|
|
191
|
-
/>
|
|
189
|
+
<RemixServer context={remixContext} url={request.url} />
|
|
192
190
|
</ApolloProvider>
|
|
193
191
|
</InversifyProvider>
|
|
194
192
|
</SlotFillProvider>
|
|
@@ -203,8 +201,9 @@ function handleBrowserRequest(
|
|
|
203
201
|
const apolloState = { ...client.extract() };
|
|
204
202
|
const reduxState = { ...store.getState() };
|
|
205
203
|
const fills = Object.keys(slotFillContext.fills);
|
|
204
|
+
const styleSheet = '';
|
|
206
205
|
|
|
207
|
-
const transform = new ConstantsTransform(fills, apolloState, reduxState,
|
|
206
|
+
const transform = new ConstantsTransform(fills, apolloState, reduxState, styleSheet);
|
|
208
207
|
|
|
209
208
|
responseHeaders.set('Content-Type', 'text/html');
|
|
210
209
|
|
|
@@ -233,6 +232,6 @@ function handleBrowserRequest(
|
|
|
233
232
|
},
|
|
234
233
|
);
|
|
235
234
|
|
|
236
|
-
setTimeout(abort,
|
|
235
|
+
setTimeout(abort, streamTimeout + 1000);
|
|
237
236
|
});
|
|
238
237
|
}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
Links,
|
|
5
|
+
Meta,
|
|
6
|
+
Outlet,
|
|
7
|
+
Scripts,
|
|
8
|
+
ScrollRestoration,
|
|
9
|
+
useLoaderData,
|
|
10
|
+
useRouteError,
|
|
11
|
+
useRouteLoaderData,
|
|
12
|
+
data,
|
|
13
|
+
} from '@remix-run/react';
|
|
5
14
|
// @ts-ignore
|
|
6
15
|
import publicEnv from '@src/config/public-config';
|
|
7
16
|
import { PluginArea } from '@common-stack/client-react';
|
|
8
17
|
import { subscribeReduxRouter } from '@common-stack/remix-router-redux';
|
|
18
|
+
import { ApplicationErrorHandler, RemixErrorBoundary as ErrorBoundary } from '@admin-layout/tailwind-ui';
|
|
9
19
|
// @ts-ignore
|
|
10
20
|
import clientModules, { plugins } from '@app/frontend-stack-react/modules.js';
|
|
11
21
|
// @ts-ignore
|
|
@@ -13,31 +23,69 @@ import { useChangeLanguage } from 'remix-i18next/react';
|
|
|
13
23
|
import { useTranslation } from 'react-i18next';
|
|
14
24
|
// @ts-ignore
|
|
15
25
|
import { i18nextInstance as i18next } from '@app/frontend-stack-react/i18n-localization/i18next.server.js';
|
|
16
|
-
import
|
|
26
|
+
import { LayoutCookieProvider } from '@admin-layout/client';
|
|
27
|
+
import { settingsLoaderUtil } from '@admin-layout/client/lib/components/UpdateSettings/UpdateSettings.server';
|
|
28
|
+
import type { IAppLoadContext } from '@common-stack/client-core';
|
|
29
|
+
import type { IResourceParams } from '@common-stack/core';
|
|
30
|
+
import { FillRenderProvider, PluginsLoader } from '@common-stack/components-pro';
|
|
17
31
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
];
|
|
32
|
+
// eslint-disable-next-line import/no-unresolved
|
|
33
|
+
import styles from '../tailwind.css?url';
|
|
21
34
|
|
|
22
|
-
export const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
export const links = () => [{ rel: 'stylesheet', href: styles }];
|
|
36
|
+
|
|
37
|
+
export const loader = async ({
|
|
38
|
+
request,
|
|
39
|
+
context,
|
|
40
|
+
params,
|
|
41
|
+
}: {
|
|
42
|
+
request: Request;
|
|
43
|
+
context: IAppLoadContext;
|
|
44
|
+
params: IResourceParams;
|
|
45
|
+
}) => {
|
|
46
|
+
// Fetch settings with error handling - don't let settings failures break the app
|
|
47
|
+
let settingsResponse: any = {};
|
|
48
|
+
try {
|
|
49
|
+
settingsResponse =
|
|
50
|
+
(await settingsLoaderUtil({
|
|
51
|
+
request,
|
|
52
|
+
context,
|
|
53
|
+
params,
|
|
54
|
+
})) || {};
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error('❌ Failed to load settings, using defaults:', error);
|
|
57
|
+
// Continue without settings - the app should still work
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const [locale] = await Promise.all([i18next.getLocale(request)]);
|
|
61
|
+
const loadedPlugins = await PluginsLoader(plugins, { request, context, params });
|
|
62
|
+
return data(
|
|
63
|
+
{
|
|
64
|
+
__ENV__: publicEnv,
|
|
65
|
+
locale,
|
|
66
|
+
settings: settingsResponse?.settings || {},
|
|
67
|
+
loadedPlugins,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
headers: [
|
|
71
|
+
['Cache-Control', 'max-age=300, s-maxage=600'],
|
|
72
|
+
settingsResponse?.setCookie ? ['Set-Cookie', settingsResponse.setCookie] : null,
|
|
73
|
+
].filter(Boolean) as [string, string][],
|
|
74
|
+
},
|
|
75
|
+
);
|
|
28
76
|
};
|
|
29
77
|
|
|
30
78
|
export const handle = {
|
|
31
|
-
i18n: 'common',
|
|
79
|
+
i18n: ['common', 'translations', 'projects'],
|
|
32
80
|
};
|
|
33
81
|
|
|
34
|
-
export
|
|
35
|
-
return params.defaultShouldRevalidate && params.currentUrl.pathname !== params.nextUrl.pathname;
|
|
36
|
-
}
|
|
82
|
+
export const shouldRevalidate = () => false;
|
|
37
83
|
|
|
38
84
|
export function Layout({ children }: { children: React.ReactNode }) {
|
|
39
|
-
|
|
40
|
-
|
|
85
|
+
// useLoaderData is for happy paths with Error boundary it will fail
|
|
86
|
+
// https://github.com/remix-run/remix/issues/8951#issuecomment-1973321870
|
|
87
|
+
const loaderData = useRouteLoaderData<{ locale: any; __ENV__?: any }>('root');
|
|
88
|
+
const locale = loaderData?.locale || 'en';
|
|
41
89
|
|
|
42
90
|
const { i18n } = useTranslation();
|
|
43
91
|
|
|
@@ -53,7 +101,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
53
101
|
<>
|
|
54
102
|
<script
|
|
55
103
|
dangerouslySetInnerHTML={{
|
|
56
|
-
__html: `window.__ENV__ = ${JSON.stringify((
|
|
104
|
+
__html: `window.__ENV__ = ${JSON.stringify((loaderData as any)?.__ENV__ || {})}`,
|
|
57
105
|
}}
|
|
58
106
|
/>
|
|
59
107
|
<script
|
|
@@ -81,13 +129,28 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
81
129
|
<head>
|
|
82
130
|
<meta charSet="utf-8" />
|
|
83
131
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
132
|
+
{/* CRITICAL: Load Symbol.observable polyfill BEFORE any other scripts */}
|
|
133
|
+
<script
|
|
134
|
+
dangerouslySetInnerHTML={{
|
|
135
|
+
__html: `
|
|
136
|
+
(function() {
|
|
137
|
+
if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {
|
|
138
|
+
if (!Symbol.observable) {
|
|
139
|
+
Symbol.observable = Symbol.for('observable');
|
|
140
|
+
}
|
|
141
|
+
console.log('[Symbol.observable polyfill] Loaded in head:', Symbol.observable);
|
|
142
|
+
}
|
|
143
|
+
})();
|
|
144
|
+
`,
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
84
147
|
<Meta />
|
|
85
148
|
<Links />
|
|
86
149
|
{typeof window === 'undefined' ? `[__STYLESHEET__]` : ''}
|
|
87
150
|
</head>
|
|
88
151
|
<body>
|
|
89
152
|
<PluginArea />
|
|
90
|
-
{clientModules.getWrappedRoot(children)}
|
|
153
|
+
<FillRenderProvider>{clientModules.getWrappedRoot(children)}</FillRenderProvider>
|
|
91
154
|
<ScrollRestoration />
|
|
92
155
|
<Scripts />
|
|
93
156
|
{getConstants()}
|
|
@@ -96,22 +159,14 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
96
159
|
);
|
|
97
160
|
}
|
|
98
161
|
|
|
99
|
-
const TestComponent = () => {
|
|
100
|
-
return (
|
|
101
|
-
<div className="min-h-screen flex items-center justify-center bg-gray-100">
|
|
102
|
-
<div className="p-6 max-w-sm mx-auto bg-white rounded-xl shadow-md space-y-4">
|
|
103
|
-
<h1 className="text-2xl font-bold text-center">Hello, Tailwind CSS!</h1>
|
|
104
|
-
<p className="text-gray-500 text-center">This is a test page using React and Tailwind CSS.</p>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
162
|
export default function App() {
|
|
111
163
|
return (
|
|
112
|
-
|
|
113
|
-
|
|
164
|
+
<ApplicationErrorHandler plugins={plugins}>
|
|
165
|
+
<LayoutCookieProvider>
|
|
166
|
+
<Outlet />
|
|
167
|
+
</LayoutCookieProvider>
|
|
168
|
+
</ApplicationErrorHandler>
|
|
114
169
|
);
|
|
115
170
|
}
|
|
116
171
|
|
|
117
|
-
|
|
172
|
+
export { ErrorBoundary };
|