@common-stack/generate-plugin 6.0.8-alpha.3 → 6.0.8-alpha.31
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 +116 -4
- package/docker-releases/backend/package.json +6 -7
- package/docker-releases/frontend/antd/package.json +7 -7
- package/lib/generators/add-backend/files/package.json +1 -1
- package/lib/generators/add-backend/files/webpack.config.js +3 -1
- package/lib/generators/add-frontend/frameworks/antui/context.tsx.template +8 -0
- package/lib/generators/add-frontend/frameworks/antui/entry.client.tsx.template +9 -2
- package/lib/generators/add-frontend/frameworks/antui/entry.server.tsx.template +60 -51
- package/lib/generators/add-frontend/frameworks/antui/root.tsx.template +7 -11
- package/lib/generators/add-frontend/frameworks/chakraui/context.tsx.template +6 -0
- package/lib/generators/add-frontend/frameworks/chakraui/entry.client.tsx.template +23 -15
- package/lib/generators/add-frontend/frameworks/chakraui/entry.server.tsx.template +33 -30
- package/lib/generators/add-frontend/frameworks/chakraui/root.tsx.template +8 -4
- package/lib/generators/add-frontend/templates/package.json +2 -2
- package/lib/generators/add-fullstack/files/package.json +4 -4
- package/lib/generators/add-moleculer/files/config.json +5 -0
- package/lib/generators/add-moleculer/files/package.json +5 -5
- package/lib/generators/add-moleculer/files/rollup.config.mjs +14 -1
- package/package.json +3 -3
- package/src/generators/add-frontend/frameworks/antui/context.tsx.template +8 -0
- package/src/generators/add-frontend/frameworks/antui/entry.client.tsx.template +9 -2
- package/src/generators/add-frontend/frameworks/antui/entry.server.tsx.template +60 -51
- package/src/generators/add-frontend/frameworks/antui/root.tsx.template +7 -11
- package/src/generators/add-frontend/frameworks/chakraui/context.tsx.template +6 -0
- package/src/generators/add-frontend/frameworks/chakraui/entry.client.tsx.template +23 -15
- package/src/generators/add-frontend/frameworks/chakraui/entry.server.tsx.template +33 -30
- package/src/generators/add-frontend/frameworks/chakraui/root.tsx.template +8 -4
- package/src/generators/add-fullstack/files/package.json +4 -4
- package/src/generators/add-moleculer/files/config.json +5 -0
- package/src/generators/add-moleculer/files/package.json +5 -5
- package/src/generators/add-moleculer/files/rollup.config.mjs +14 -1
- package/lib/generators/add-moleculer/files/src/modules/module.ts.template +0 -31
- package/src/generators/add-moleculer/files/src/modules/module.ts.template +0 -31
|
@@ -36,8 +36,7 @@ import config from '@app/cde-webconfig.json';
|
|
|
36
36
|
|
|
37
37
|
import { Head } from './root';
|
|
38
38
|
import type { IAppLoadContext } from '@common-stack/client-core';
|
|
39
|
-
|
|
40
|
-
import { ServerStyleContext } from './context';
|
|
39
|
+
import { ServerStyleContext, LocaleContext } from './context';
|
|
41
40
|
import { i18nextInstance as i18next } from '@app/frontend-stack-react/i18n-localization/i18next.server.js';
|
|
42
41
|
|
|
43
42
|
const { extractCriticalToChunks } = createEmotionServer(defaultCache);
|
|
@@ -149,17 +148,19 @@ async function handleBrowserRequest(
|
|
|
149
148
|
|
|
150
149
|
const html = renderToString(
|
|
151
150
|
<I18nextProvider i18n={instance}>
|
|
152
|
-
<
|
|
153
|
-
<
|
|
154
|
-
<
|
|
155
|
-
<
|
|
156
|
-
<
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
<LocaleContext.Provider value={lng}>
|
|
152
|
+
<CacheProvider value={defaultCache}>
|
|
153
|
+
<ApolloProvider client={client}>
|
|
154
|
+
<ReduxProvider store={store}>
|
|
155
|
+
<SlotFillProvider context={slotFillContext}>
|
|
156
|
+
<InversifyProvider container={container} modules={clientModules}>
|
|
157
|
+
<RemixServer context={remixContext} url={request.url} />
|
|
158
|
+
</InversifyProvider>
|
|
159
|
+
</SlotFillProvider>
|
|
160
|
+
</ReduxProvider>
|
|
161
|
+
</ApolloProvider>
|
|
162
|
+
</CacheProvider>
|
|
163
|
+
</LocaleContext.Provider>
|
|
163
164
|
</I18nextProvider>,
|
|
164
165
|
);
|
|
165
166
|
|
|
@@ -177,23 +178,25 @@ async function handleBrowserRequest(
|
|
|
177
178
|
const { pipe, abort } = renderToPipeableStream(
|
|
178
179
|
(
|
|
179
180
|
<I18nextProvider i18n={instance}>
|
|
180
|
-
<
|
|
181
|
-
<
|
|
182
|
-
<
|
|
183
|
-
<
|
|
184
|
-
<
|
|
185
|
-
<
|
|
186
|
-
<
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
181
|
+
<LocaleContext.Provider value={lng}>
|
|
182
|
+
<ServerStyleContext.Provider value={chunks.styles}>
|
|
183
|
+
<CacheProvider value={defaultCache}>
|
|
184
|
+
<ApolloProvider client={client}>
|
|
185
|
+
<ReduxProvider store={store}>
|
|
186
|
+
<SlotFillProvider context={slotFillContext}>
|
|
187
|
+
<InversifyProvider container={container} modules={clientModules}>
|
|
188
|
+
<RemixServer
|
|
189
|
+
context={remixContext}
|
|
190
|
+
url={request.url}
|
|
191
|
+
abortDelay={ABORT_DELAY}
|
|
192
|
+
/>
|
|
193
|
+
</InversifyProvider>
|
|
194
|
+
</SlotFillProvider>
|
|
195
|
+
</ReduxProvider>
|
|
196
|
+
</ApolloProvider>
|
|
197
|
+
</CacheProvider>
|
|
198
|
+
</ServerStyleContext.Provider>
|
|
199
|
+
</LocaleContext.Provider>
|
|
197
200
|
</I18nextProvider>
|
|
198
201
|
) as any,
|
|
199
202
|
{
|
|
@@ -11,7 +11,7 @@ import { ApplicationErrorHandler } from '@admin-layout/chakra-ui';
|
|
|
11
11
|
import clientModules, { plugins } from '@app/frontend-stack-react/modules.js';
|
|
12
12
|
import { createHead } from 'remix-island';
|
|
13
13
|
import { useContext } from 'react';
|
|
14
|
-
import { ServerStyleContext, ClientStyleContext } from './context';
|
|
14
|
+
import { ServerStyleContext, ClientStyleContext, LocaleContext } from './context';
|
|
15
15
|
import { withEmotionCache } from '@emotion/react';
|
|
16
16
|
import { useChangeLanguage } from 'remix-i18next/react';
|
|
17
17
|
import { i18nextInstance as i18next } from '@app/frontend-stack-react/i18n-localization/i18next.server.js';
|
|
@@ -31,6 +31,9 @@ export const Head = createHead(() => (
|
|
|
31
31
|
export const Document = withEmotionCache(({ children }: DocumentProps, emotionCache) => {
|
|
32
32
|
const serverStyleData = useContext(ServerStyleContext);
|
|
33
33
|
const clientStyleData = useContext(ClientStyleContext);
|
|
34
|
+
const locale = useContext(LocaleContext);
|
|
35
|
+
|
|
36
|
+
useChangeLanguage(locale);
|
|
34
37
|
|
|
35
38
|
React.useEffect(() => {
|
|
36
39
|
// re-link sheet container
|
|
@@ -64,12 +67,12 @@ export const Document = withEmotionCache(({ children }: DocumentProps, emotionCa
|
|
|
64
67
|
</>
|
|
65
68
|
);
|
|
66
69
|
});
|
|
67
|
-
|
|
70
|
+
/*
|
|
68
71
|
export let loader = async ({ request }) => {
|
|
69
72
|
let locale = await i18next.getLocale(request);
|
|
70
73
|
return json({ locale });
|
|
71
74
|
};
|
|
72
|
-
|
|
75
|
+
*/
|
|
73
76
|
export let handle = {
|
|
74
77
|
i18n: 'common',
|
|
75
78
|
};
|
|
@@ -79,11 +82,12 @@ export function shouldRevalidate(params: any) {
|
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
export default function App() {
|
|
85
|
+
/*
|
|
82
86
|
const data = useRouteLoaderData<{ locale: any }>('root');
|
|
83
87
|
const locale = data?.locale;
|
|
84
88
|
|
|
85
89
|
useChangeLanguage(locale);
|
|
86
|
-
|
|
90
|
+
*/
|
|
87
91
|
React.useEffect(() => {
|
|
88
92
|
subscribeReduxRouter({ store: window.__remixStore, router: window.__remixRouter } as any);
|
|
89
93
|
}, []);
|
|
@@ -146,9 +146,9 @@
|
|
|
146
146
|
"@babel/preset-typescript": "^7.18.6",
|
|
147
147
|
"@babel/register": "^7.18.9",
|
|
148
148
|
"@babel/runtime": "^7.20.1",
|
|
149
|
-
"@common-stack/env-list-loader": "6.0.8-alpha.
|
|
150
|
-
"@common-stack/generate-plugin": "6.0.8-alpha.
|
|
151
|
-
"@common-stack/rollup-vite-utils": "6.0.8-alpha.
|
|
149
|
+
"@common-stack/env-list-loader": "6.0.8-alpha.30",
|
|
150
|
+
"@common-stack/generate-plugin": "6.0.8-alpha.30",
|
|
151
|
+
"@common-stack/rollup-vite-utils": "6.0.8-alpha.30",
|
|
152
152
|
"@emotion/babel-plugin": "^11.11.0",
|
|
153
153
|
"@graphql-codegen/add": "^5.0.2",
|
|
154
154
|
"@graphql-codegen/cli": "^5.0.2",
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
"jest-raw-loader": "^1.0.1",
|
|
273
273
|
"jest-transform-graphql": "^2.1.0",
|
|
274
274
|
"jsdom": "^20.0.2",
|
|
275
|
-
"lerna": "8",
|
|
275
|
+
"lerna": "8.1.8",
|
|
276
276
|
"less": "^4.1.3",
|
|
277
277
|
"less-loader": "^11.0.0",
|
|
278
278
|
"lint-staged": "^15.2.7",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"watch": "npm run start:dev"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@common-stack/client-core": "6.0.8-alpha.
|
|
29
|
-
"@common-stack/core": "6.0.8-alpha.
|
|
30
|
-
"@common-stack/server-core": "6.0.8-alpha.
|
|
31
|
-
"@common-stack/server-stack": "6.0.8-alpha.
|
|
32
|
-
"@common-stack/store-mongo": "6.0.8-alpha.
|
|
28
|
+
"@common-stack/client-core": "6.0.8-alpha.30",
|
|
29
|
+
"@common-stack/core": "6.0.8-alpha.30",
|
|
30
|
+
"@common-stack/server-core": "6.0.8-alpha.30",
|
|
31
|
+
"@common-stack/server-stack": "6.0.8-alpha.30",
|
|
32
|
+
"@common-stack/store-mongo": "6.0.8-alpha.30",
|
|
33
33
|
"@container-stack/mailing-api": "5.2.1-alpha.1",
|
|
34
34
|
"helmet": "^3.21.2",
|
|
35
35
|
"react": "18.2.0",
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
import graphql from '@rollup/plugin-graphql';
|
|
2
2
|
import typescript from '@rollup/plugin-typescript';
|
|
3
3
|
import { string } from 'rollup-plugin-string';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { writeBackendModuleFile } from '@common-stack/rollup-vite-utils';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = path.dirname(__filename);
|
|
10
|
+
|
|
11
|
+
// Write backend module file before bundling
|
|
12
|
+
try {
|
|
13
|
+
const packageConfig = await import('./config.json', { assert: { type: 'json' } });
|
|
14
|
+
await writeBackendModuleFile(path.join(__dirname, 'src/modules'), packageConfig.default);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
console.error('Error writing backend module file:', e);
|
|
17
|
+
}
|
|
4
18
|
|
|
5
19
|
const bundle = (config) => ({
|
|
6
20
|
...config,
|
|
7
21
|
input: 'src/index.ts',
|
|
8
|
-
// marking all node modules as external
|
|
9
22
|
external: (id) => !/^[./]/.test(id),
|
|
10
23
|
});
|
|
11
24
|
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ContainerModule, interfaces } from 'inversify';
|
|
2
|
-
import { Feature } from '@common-stack/server-core';
|
|
3
|
-
import { TaggedType } from '@common-stack/core';
|
|
4
|
-
import { config } from '../config';
|
|
5
|
-
|
|
6
|
-
const subTopic = config.CONNECTION_ID;
|
|
7
|
-
export const settings: any = {
|
|
8
|
-
connectionId: config.CONNECTION_ID,
|
|
9
|
-
namespace: config.NAMESPACE,
|
|
10
|
-
subTopic,
|
|
11
|
-
logger: config.LOG_LEVEL,
|
|
12
|
-
workspaceId: config.CONNECTION_ID || 'DEFAULT',
|
|
13
|
-
configPath: process.env.CONFIG_PATH,
|
|
14
|
-
adminApiNamespace: 'api-admin',
|
|
15
|
-
apiNamespace: 'api-admin',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const defaultModule = () =>
|
|
19
|
-
new ContainerModule((bind: interfaces.Bind) => {
|
|
20
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('default', true);
|
|
21
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('microservice', true);
|
|
22
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged(TaggedType.MICROSERVICE, true);
|
|
23
|
-
bind('MongoOptions').toConstantValue({});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const DefaultFeature = new Feature({
|
|
27
|
-
createContainerFunc: [defaultModule],
|
|
28
|
-
createHemeraContainerFunc: [defaultModule],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default new Feature<any>(DefaultFeature);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ContainerModule, interfaces } from 'inversify';
|
|
2
|
-
import { Feature } from '@common-stack/server-core';
|
|
3
|
-
import { TaggedType } from '@common-stack/core';
|
|
4
|
-
import { config } from '../config';
|
|
5
|
-
|
|
6
|
-
const subTopic = config.CONNECTION_ID;
|
|
7
|
-
export const settings: any = {
|
|
8
|
-
connectionId: config.CONNECTION_ID,
|
|
9
|
-
namespace: config.NAMESPACE,
|
|
10
|
-
subTopic,
|
|
11
|
-
logger: config.LOG_LEVEL,
|
|
12
|
-
workspaceId: config.CONNECTION_ID || 'DEFAULT',
|
|
13
|
-
configPath: process.env.CONFIG_PATH,
|
|
14
|
-
adminApiNamespace: 'api-admin',
|
|
15
|
-
apiNamespace: 'api-admin',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const defaultModule = () =>
|
|
19
|
-
new ContainerModule((bind: interfaces.Bind) => {
|
|
20
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('default', true);
|
|
21
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged('microservice', true);
|
|
22
|
-
bind('Settings').toConstantValue(settings).whenTargetTagged(TaggedType.MICROSERVICE, true);
|
|
23
|
-
bind('MongoOptions').toConstantValue({});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const DefaultFeature = new Feature({
|
|
27
|
-
createContainerFunc: [defaultModule],
|
|
28
|
-
createHemeraContainerFunc: [defaultModule],
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default new Feature<any>(DefaultFeature);
|