@qlover/create-app 0.3.2 → 0.3.4
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 +139 -0
- package/package.json +4 -4
- package/templates/react-app/README.md +311 -120
- package/templates/react-app/config/Identifier.I18n.ts +1048 -0
- package/templates/react-app/config/app.router.json +7 -7
- package/templates/react-app/config/common.ts +13 -0
- package/templates/react-app/config/theme.json +7 -88
- package/templates/react-app/package.json +11 -5
- package/templates/react-app/postcss.config.js +1 -2
- package/templates/react-app/public/locales/en/common.json +142 -1
- package/templates/react-app/public/locales/zh/common.json +142 -1
- package/templates/react-app/src/App.tsx +16 -3
- package/templates/react-app/src/base/apis/AiApi.ts +4 -4
- package/templates/react-app/src/base/apis/feApi/FeApiAdapter.ts +2 -2
- package/templates/react-app/src/base/apis/userApi/UserApiAdapter.ts +2 -2
- package/templates/react-app/src/base/cases/AppConfig.ts +103 -0
- package/templates/react-app/src/base/cases/{appError/AppError.ts → AppError.ts} +0 -3
- package/templates/react-app/src/base/cases/DialogHandler.ts +86 -0
- package/templates/react-app/src/base/cases/RequestLogger.ts +1 -1
- package/templates/react-app/src/base/cases/RouterLoader.ts +166 -0
- package/templates/react-app/src/base/port/InteractionHubInterface.ts +94 -0
- package/templates/react-app/src/base/services/I18nService.ts +50 -3
- package/templates/react-app/src/base/services/ProcesserService.ts +0 -1
- package/templates/react-app/src/base/types/deprecated-antd.d.ts +60 -0
- package/templates/react-app/src/core/IOC.ts +18 -8
- package/templates/react-app/src/core/bootstrap.ts +41 -62
- package/templates/react-app/src/core/bootstraps/PrintBootstrap.ts +14 -0
- package/templates/react-app/src/core/bootstraps/index.ts +36 -7
- package/templates/react-app/src/core/globals.ts +8 -1
- package/templates/react-app/src/core/registers/RegisterApi.ts +2 -5
- package/templates/react-app/src/core/registers/RegisterCommon.ts +38 -29
- package/templates/react-app/src/core/registers/RegisterControllers.ts +5 -10
- package/templates/react-app/src/core/registers/RegisterGlobals.ts +21 -17
- package/templates/react-app/src/core/registers/index.ts +27 -13
- package/templates/react-app/src/main.tsx +1 -1
- package/templates/react-app/src/pages/404.tsx +1 -1
- package/templates/react-app/src/pages/500.tsx +1 -1
- package/templates/react-app/src/pages/auth/Login.tsx +128 -36
- package/templates/react-app/src/pages/base/About.tsx +118 -2
- package/templates/react-app/src/pages/base/ErrorIdentifier.tsx +38 -19
- package/templates/react-app/src/pages/base/Executor.tsx +442 -29
- package/templates/react-app/src/pages/base/Home.tsx +99 -93
- package/templates/react-app/src/pages/base/JSONStorage.tsx +47 -38
- package/templates/react-app/src/pages/base/Layout.tsx +5 -2
- package/templates/react-app/src/pages/base/Request.tsx +90 -208
- package/templates/react-app/src/pages/base/components/BaseHeader.tsx +13 -5
- package/templates/react-app/src/styles/css/antd-themes/_default.css +239 -0
- package/templates/react-app/src/styles/css/antd-themes/dark.css +176 -0
- package/templates/react-app/src/styles/css/antd-themes/index.css +3 -0
- package/templates/react-app/src/styles/css/antd-themes/no-context.css +34 -0
- package/templates/react-app/src/styles/css/antd-themes/pink.css +199 -0
- package/templates/react-app/src/{uikit/styles → styles}/css/index.css +3 -0
- package/templates/react-app/src/styles/css/page.css +11 -0
- package/templates/react-app/src/styles/css/tailwind.css +5 -0
- package/templates/react-app/src/styles/css/themes/_default.css +29 -0
- package/templates/react-app/src/styles/css/themes/dark.css +29 -0
- package/templates/react-app/src/styles/css/themes/index.css +3 -0
- package/templates/react-app/src/styles/css/themes/pink.css +29 -0
- package/templates/react-app/src/uikit/components/LanguageSwitcher.tsx +56 -0
- package/templates/react-app/src/uikit/components/Loading.tsx +27 -21
- package/templates/react-app/src/uikit/components/RouterRenderComponent.tsx +1 -1
- package/templates/react-app/src/uikit/components/ThemeSwitcher.tsx +63 -13
- package/templates/react-app/src/uikit/contexts/BaseRouteContext.ts +1 -1
- package/templates/react-app/src/uikit/controllers/RouterController.ts +1 -1
- package/templates/react-app/src/uikit/controllers/UserController.ts +2 -2
- package/templates/react-app/tailwind.config.js +1 -15
- package/templates/react-app/tsconfig.json +3 -2
- package/templates/react-app/tsconfig.node.json +2 -1
- package/templates/react-app/vite.config.ts +15 -3
- package/templates/react-app/lib/tailwind/root10px.js +0 -178
- package/templates/react-app/lib/tailwind/theme-generator.js +0 -238
- package/templates/react-app/public/locales/en/about.json +0 -3
- package/templates/react-app/public/locales/en/executor.json +0 -6
- package/templates/react-app/public/locales/en/home.json +0 -10
- package/templates/react-app/public/locales/en/jsonStorage.json +0 -11
- package/templates/react-app/public/locales/en/login.json +0 -7
- package/templates/react-app/public/locales/en/request.json +0 -15
- package/templates/react-app/public/locales/zh/about.json +0 -3
- package/templates/react-app/public/locales/zh/executor.json +0 -6
- package/templates/react-app/public/locales/zh/home.json +0 -10
- package/templates/react-app/public/locales/zh/jsonStorage.json +0 -11
- package/templates/react-app/public/locales/zh/login.json +0 -7
- package/templates/react-app/public/locales/zh/request.json +0 -15
- package/templates/react-app/src/base/cases/router-loader/index.ts +0 -90
- package/templates/react-app/src/base/port/InversifyIocInterface.ts +0 -9
- package/templates/react-app/src/core/AppConfig.ts +0 -36
- package/templates/react-app/src/uikit/styles/css/page.css +0 -3
- package/templates/react-app/src/uikit/styles/css/tailwind.css +0 -3
- /package/templates/react-app/config/{ErrorIdentifier.ts → Identifier.Error.ts} +0 -0
|
@@ -1,79 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type BootstrapExecutorPlugin,
|
|
4
|
-
InjectEnv,
|
|
5
|
-
InjectIOC,
|
|
6
|
-
InjectGlobal
|
|
7
|
-
} from '@qlover/corekit-bridge';
|
|
8
|
-
import AppConfig from '@/core/AppConfig';
|
|
9
|
-
import { envPrefix, browserGlobalsName, envBlackList } from '@config/common';
|
|
1
|
+
import { Bootstrap } from '@qlover/corekit-bridge';
|
|
2
|
+
import { envBlackList, envPrefix, browserGlobalsName } from '@config/common';
|
|
10
3
|
import { IOC } from './IOC';
|
|
11
4
|
import * as globals from '@/core/globals';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { GLOBAL_NO_WINDOW } from '@config/ErrorIdentifier';
|
|
5
|
+
import { IocRegister } from './registers';
|
|
6
|
+
import { BootstrapsRegistry } from './bootstraps';
|
|
7
|
+
import { GLOBAL_NO_WINDOW } from '@config/Identifier.Error';
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
onSuccess({ parameters: { logger } }) {
|
|
20
|
-
logger.info(
|
|
21
|
-
'bootstrap success!\n\n' +
|
|
22
|
-
`You can use \`%cwindow.${browserGlobalsName}%c\` to access the globals`,
|
|
23
|
-
'color: #0ff; font-weight: bold;',
|
|
24
|
-
'all: unset;'
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Bootstrap
|
|
31
|
-
*
|
|
32
|
-
* 1. inject env config to AppConfig
|
|
33
|
-
* 2. inject IOC to Application
|
|
34
|
-
* 3. inject globals to window
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
export default function startup({
|
|
38
|
-
window,
|
|
9
|
+
export default async function startup({
|
|
10
|
+
root,
|
|
39
11
|
envSource
|
|
40
12
|
}: {
|
|
41
|
-
|
|
13
|
+
root: unknown;
|
|
42
14
|
envSource: Record<string, unknown>;
|
|
43
15
|
}) {
|
|
44
|
-
if (!(typeof
|
|
16
|
+
if (!(typeof root !== 'undefined' && root instanceof Window)) {
|
|
45
17
|
throw new Error(GLOBAL_NO_WINDOW);
|
|
46
18
|
}
|
|
47
19
|
|
|
48
|
-
const { logger } = globals;
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
20
|
+
const { logger, appConfig } = globals;
|
|
21
|
+
|
|
22
|
+
const iocRegister = new IocRegister({
|
|
23
|
+
pathname: root.location.pathname,
|
|
24
|
+
appConfig
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const bootstrap = new Bootstrap({
|
|
28
|
+
root,
|
|
29
|
+
logger,
|
|
30
|
+
ioc: {
|
|
31
|
+
manager: IOC,
|
|
32
|
+
register: iocRegister
|
|
33
|
+
},
|
|
34
|
+
envOptions: {
|
|
35
|
+
target: appConfig,
|
|
36
|
+
source: envSource,
|
|
37
|
+
prefix: envPrefix,
|
|
38
|
+
blackList: envBlackList
|
|
39
|
+
},
|
|
40
|
+
globalOptions: {
|
|
41
|
+
sources: globals,
|
|
42
|
+
target: browserGlobalsName
|
|
43
|
+
}
|
|
44
|
+
});
|
|
71
45
|
|
|
72
46
|
try {
|
|
73
47
|
logger.info('bootstrap start...');
|
|
74
48
|
|
|
75
|
-
bootstrap
|
|
49
|
+
// init bootstrap
|
|
50
|
+
await bootstrap.initialize();
|
|
51
|
+
|
|
52
|
+
const bootstrapsRegistry = new BootstrapsRegistry(IOC);
|
|
53
|
+
|
|
54
|
+
await bootstrap.use(bootstrapsRegistry.register()).start();
|
|
76
55
|
} catch (error) {
|
|
77
|
-
logger.error(`${
|
|
56
|
+
logger.error(`${appConfig.appName} starup error:`, error);
|
|
78
57
|
}
|
|
79
58
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { browserGlobalsName } from '@config/common';
|
|
2
|
+
import { BootstrapExecutorPlugin } from '@qlover/corekit-bridge';
|
|
3
|
+
|
|
4
|
+
export const printBootstrap: BootstrapExecutorPlugin = {
|
|
5
|
+
pluginName: 'PrintBootstrap',
|
|
6
|
+
onSuccess({ parameters: { logger } }) {
|
|
7
|
+
logger.info(
|
|
8
|
+
'bootstrap success!\n\n' +
|
|
9
|
+
`You can use \`%cwindow.${browserGlobalsName}%c\` to access the globals`,
|
|
10
|
+
'color: #0ff; font-weight: bold;',
|
|
11
|
+
'all: unset;'
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
@@ -1,12 +1,41 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
BootstrapExecutorPlugin,
|
|
3
|
+
EnvConfigInterface,
|
|
4
|
+
IOCContainerInterface,
|
|
5
|
+
IOCFunctionInterface
|
|
6
|
+
} from '@qlover/corekit-bridge';
|
|
2
7
|
import { BootstrapApp } from './BootstrapApp';
|
|
3
8
|
import { UserApiBootstarp } from '@/base/apis/userApi/UserApiBootstarp';
|
|
4
9
|
import { FeApiBootstarp } from '@/base/apis/feApi/FeApiBootstarp';
|
|
5
10
|
import { AiApiBootstarp } from '@/base/apis/AiApi';
|
|
11
|
+
import { printBootstrap } from './PrintBootstrap';
|
|
12
|
+
import { IOCIdentifier, type IOCIdentifierMap } from '../IOC';
|
|
13
|
+
import { I18nService } from '@/base/services/I18nService';
|
|
6
14
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
export class BootstrapsRegistry {
|
|
16
|
+
constructor(
|
|
17
|
+
protected IOC: IOCFunctionInterface<IOCIdentifierMap, IOCContainerInterface>
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
get appConfig(): EnvConfigInterface {
|
|
21
|
+
return this.IOC(IOCIdentifier.AppConfig);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
register(): BootstrapExecutorPlugin[] {
|
|
25
|
+
const IOC = this.IOC;
|
|
26
|
+
|
|
27
|
+
const bootstrapList = [
|
|
28
|
+
IOC(I18nService),
|
|
29
|
+
new UserApiBootstarp(),
|
|
30
|
+
new FeApiBootstarp(),
|
|
31
|
+
AiApiBootstarp,
|
|
32
|
+
new BootstrapApp()
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
if (this.appConfig.env !== 'production') {
|
|
36
|
+
bootstrapList.push(printBootstrap);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return bootstrapList;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
// ! global variables, don't import any dependencies and don't have side effects
|
|
2
2
|
import { JSONStorage, JSONSerializer, SyncStorage } from '@qlover/fe-corekit';
|
|
3
3
|
import { ColorFormatter, ConsoleHandler, Logger } from '@qlover/corekit-bridge';
|
|
4
|
+
import { DialogHandler } from '@/base/cases/DialogHandler';
|
|
5
|
+
import { loggerStyles } from '@config/common';
|
|
6
|
+
import { AppConfig } from '@/base/cases/AppConfig';
|
|
4
7
|
|
|
5
8
|
const isProduction = import.meta.env.VITE_USER_NODE_ENV === 'production';
|
|
6
9
|
|
|
10
|
+
export const appConfig = new AppConfig();
|
|
11
|
+
|
|
12
|
+
export const dialogHandler = new DialogHandler();
|
|
13
|
+
|
|
7
14
|
/**
|
|
8
15
|
* Global logger
|
|
9
16
|
*/
|
|
10
17
|
export const logger = new Logger({
|
|
11
|
-
handlers: new ConsoleHandler(new ColorFormatter()),
|
|
18
|
+
handlers: new ConsoleHandler(new ColorFormatter(loggerStyles)),
|
|
12
19
|
silent: isProduction
|
|
13
20
|
});
|
|
14
21
|
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
InversifyRegisterInterface,
|
|
3
|
-
InversifyRegisterContainer
|
|
4
|
-
} from '@/base/port/InversifyIocInterface';
|
|
1
|
+
import { InversifyContainer, InversifyRegisterInterface } from '../IOC';
|
|
5
2
|
|
|
6
3
|
export class RegisterApi implements InversifyRegisterInterface {
|
|
7
|
-
register(_container:
|
|
4
|
+
register(_container: InversifyContainer): void {}
|
|
8
5
|
}
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
InversifyRegisterInterface,
|
|
3
|
-
InversifyRegisterContainer
|
|
4
|
-
} from '@/base/port/InversifyIocInterface';
|
|
5
1
|
import { FetchAbortPlugin, JSONStorage } from '@qlover/fe-corekit';
|
|
6
|
-
import { Logger }from '@qlover/logger';
|
|
7
|
-
import
|
|
8
|
-
|
|
2
|
+
import { Logger } from '@qlover/logger';
|
|
3
|
+
import {
|
|
4
|
+
InversifyContainer,
|
|
5
|
+
InversifyRegisterInterface,
|
|
6
|
+
IOCIdentifier,
|
|
7
|
+
IocRegisterOptions
|
|
8
|
+
} from '@/core/IOC';
|
|
9
9
|
import {
|
|
10
10
|
UserToken,
|
|
11
11
|
RequestCommonPlugin,
|
|
12
12
|
ApiMockPlugin,
|
|
13
13
|
ApiCatchPlugin,
|
|
14
|
-
ThemeService
|
|
14
|
+
ThemeService,
|
|
15
|
+
IOCManagerInterface
|
|
15
16
|
} from '@qlover/corekit-bridge';
|
|
16
17
|
import mockDataJson from '@config/feapi.mock.json';
|
|
17
18
|
import { RequestStatusCatcher } from '@/base/cases/RequestStatusCatcher';
|
|
18
|
-
import
|
|
19
|
+
import themeConfig from '@config/theme.json';
|
|
19
20
|
import { localJsonStorage } from '../globals';
|
|
21
|
+
import { I18nService } from '@/base/services/I18nService';
|
|
20
22
|
|
|
21
23
|
export class RegisterCommon implements InversifyRegisterInterface {
|
|
22
|
-
register(
|
|
24
|
+
register(
|
|
25
|
+
container: InversifyContainer,
|
|
26
|
+
_: IOCManagerInterface<InversifyContainer>,
|
|
27
|
+
options: IocRegisterOptions
|
|
28
|
+
): void {
|
|
29
|
+
const AppConfig = container.get(IOCIdentifier.AppConfig);
|
|
30
|
+
|
|
23
31
|
const userToken = new UserToken(
|
|
24
32
|
AppConfig.userTokenStorageKey,
|
|
25
33
|
container.get(JSONStorage)
|
|
@@ -31,30 +39,31 @@ export class RegisterCommon implements InversifyRegisterInterface {
|
|
|
31
39
|
token: () => userToken.getToken()
|
|
32
40
|
});
|
|
33
41
|
|
|
34
|
-
container.bind(FetchAbortPlugin
|
|
35
|
-
container.bind(UserToken
|
|
42
|
+
container.bind(FetchAbortPlugin, feApiAbort);
|
|
43
|
+
container.bind(UserToken, userToken);
|
|
36
44
|
|
|
37
|
-
container.bind(IOCIdentifier.FeApiToken
|
|
38
|
-
container
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
)
|
|
51
|
-
);
|
|
45
|
+
container.bind(IOCIdentifier.FeApiToken, userToken);
|
|
46
|
+
container.bind(IOCIdentifier.FeApiCommonPlugin, feApiRequestCommonPlugin);
|
|
47
|
+
container.bind(
|
|
48
|
+
IOCIdentifier.ApiMockPlugin,
|
|
49
|
+
new ApiMockPlugin(mockDataJson, container.get(Logger))
|
|
50
|
+
);
|
|
51
|
+
container.bind(
|
|
52
|
+
IOCIdentifier.ApiCatchPlugin,
|
|
53
|
+
new ApiCatchPlugin(
|
|
54
|
+
container.get(Logger),
|
|
55
|
+
container.get(RequestStatusCatcher)
|
|
56
|
+
)
|
|
57
|
+
);
|
|
52
58
|
|
|
53
|
-
container.bind(
|
|
59
|
+
container.bind(
|
|
60
|
+
ThemeService,
|
|
54
61
|
new ThemeService({
|
|
55
|
-
...
|
|
62
|
+
...themeConfig,
|
|
56
63
|
storage: localJsonStorage
|
|
57
64
|
})
|
|
58
65
|
);
|
|
66
|
+
|
|
67
|
+
container.bind(I18nService, new I18nService(options.pathname));
|
|
59
68
|
}
|
|
60
69
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
InversifyRegisterInterface,
|
|
3
|
-
InversifyRegisterContainer
|
|
4
|
-
} from '@/base/port/InversifyIocInterface';
|
|
5
|
-
|
|
6
1
|
import { localJsonStorage, logger } from '../globals';
|
|
7
2
|
import { RouterController } from '@/uikit/controllers/RouterController';
|
|
8
3
|
import { JSONStorageController } from '@/uikit/controllers/JSONStorageController';
|
|
9
4
|
import { ProcesserService } from '@/base/services/ProcesserService';
|
|
10
5
|
import { UserController } from '@/uikit/controllers/UserController';
|
|
11
6
|
import { base as baseRoutes } from '@config/app.router.json';
|
|
7
|
+
import { InversifyRegisterInterface } from '../IOC';
|
|
8
|
+
import { InversifyContainer } from '../IOC';
|
|
12
9
|
|
|
13
10
|
export class RegisterControllers implements InversifyRegisterInterface {
|
|
14
|
-
register(container:
|
|
11
|
+
register(container: InversifyContainer): void {
|
|
15
12
|
const routerController = new RouterController({
|
|
16
13
|
config: baseRoutes,
|
|
17
14
|
logger
|
|
@@ -19,10 +16,8 @@ export class RegisterControllers implements InversifyRegisterInterface {
|
|
|
19
16
|
|
|
20
17
|
const jsonStorageController = new JSONStorageController(localJsonStorage);
|
|
21
18
|
|
|
22
|
-
container.bind(RouterController
|
|
23
|
-
container
|
|
24
|
-
.bind(JSONStorageController)
|
|
25
|
-
.toConstantValue(jsonStorageController);
|
|
19
|
+
container.bind(RouterController, routerController);
|
|
20
|
+
container.bind(JSONStorageController, jsonStorageController);
|
|
26
21
|
|
|
27
22
|
container.get(ProcesserService).use(container.get(UserController));
|
|
28
23
|
}
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { JSONSerializer, JSONStorage } from '@qlover/fe-corekit';
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import type { IOCManagerInterface } from '@qlover/corekit-bridge';
|
|
3
|
+
import { dialogHandler, JSON, localJsonStorage, logger } from '../globals';
|
|
4
|
+
import {
|
|
5
|
+
type InversifyContainer,
|
|
6
|
+
type InversifyRegisterInterface,
|
|
7
|
+
IOCIdentifier,
|
|
8
|
+
IocRegisterOptions
|
|
9
|
+
} from '@/core/IOC';
|
|
9
10
|
import { Logger } from '@qlover/logger';
|
|
10
11
|
|
|
11
12
|
export class RegisterGlobals implements InversifyRegisterInterface {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
register(
|
|
14
|
+
container: InversifyContainer,
|
|
15
|
+
_: IOCManagerInterface<InversifyContainer>,
|
|
16
|
+
options: IocRegisterOptions
|
|
17
|
+
): void {
|
|
15
18
|
// inject AppConfig to IOC
|
|
16
|
-
container.bind(IOCIdentifier.AppConfig
|
|
19
|
+
container.bind(IOCIdentifier.AppConfig, options.appConfig);
|
|
20
|
+
container.bind(IOCIdentifier.DialogHandler, dialogHandler);
|
|
17
21
|
|
|
18
|
-
container.bind(JSONSerializer
|
|
19
|
-
container.bind(IOCIdentifier.JSON
|
|
22
|
+
container.bind(JSONSerializer, JSON);
|
|
23
|
+
container.bind(IOCIdentifier.JSON, JSON);
|
|
20
24
|
|
|
21
|
-
container.bind(Logger
|
|
22
|
-
container.bind(IOCIdentifier.Logger
|
|
25
|
+
container.bind(Logger, logger);
|
|
26
|
+
container.bind(IOCIdentifier.Logger, logger);
|
|
23
27
|
|
|
24
|
-
container.bind(JSONStorage
|
|
25
|
-
container.bind(IOCIdentifier.JSONStorage
|
|
28
|
+
container.bind(JSONStorage, localJsonStorage);
|
|
29
|
+
container.bind(IOCIdentifier.JSONStorage, localJsonStorage);
|
|
26
30
|
}
|
|
27
31
|
}
|
|
@@ -1,18 +1,32 @@
|
|
|
1
|
-
import type { InversifyRegisterInterface } from '@/base/port/InversifyIocInterface';
|
|
2
1
|
import { RegisterGlobals } from './RegisterGlobals';
|
|
3
2
|
import { RegisterCommon } from './RegisterCommon';
|
|
4
3
|
import { RegisterApi } from './RegisterApi';
|
|
5
4
|
import { RegisterControllers } from './RegisterControllers';
|
|
6
|
-
import
|
|
5
|
+
import {
|
|
6
|
+
InversifyContainer,
|
|
7
|
+
InversifyRegisterInterface,
|
|
8
|
+
IocRegisterOptions
|
|
9
|
+
} from '../IOC';
|
|
10
|
+
import { IOCManagerInterface } from '@qlover/corekit-bridge';
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
export class IocRegister implements InversifyRegisterInterface {
|
|
13
|
+
constructor(protected options: IocRegisterOptions) {}
|
|
14
|
+
|
|
15
|
+
getRegisterList(): InversifyRegisterInterface[] {
|
|
16
|
+
return [
|
|
17
|
+
new RegisterGlobals(),
|
|
18
|
+
new RegisterCommon(),
|
|
19
|
+
new RegisterApi(),
|
|
20
|
+
new RegisterControllers()
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
register(
|
|
25
|
+
ioc: InversifyContainer,
|
|
26
|
+
manager: IOCManagerInterface<InversifyContainer>
|
|
27
|
+
): void {
|
|
28
|
+
this.getRegisterList().forEach((register) => {
|
|
29
|
+
register.register(ioc, manager, this.options);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -5,7 +5,7 @@ export default function NotFound({ route }: { route?: string }) {
|
|
|
5
5
|
return (
|
|
6
6
|
<div className="flex flex-col justify-center min-h-screen py-6 bg-background sm:py-12">
|
|
7
7
|
<div className="relative py-3 mx-auto sm:max-w-xl">
|
|
8
|
-
<h1 className="text-
|
|
8
|
+
<h1 className="text-text text-2xl font-bold text-center">
|
|
9
9
|
404 -{route ? `${t('404.notComponent')}: ${route}` : t('404.notPage')}
|
|
10
10
|
</h1>
|
|
11
11
|
</div>
|
|
@@ -5,7 +5,7 @@ export default function NotFound500() {
|
|
|
5
5
|
return (
|
|
6
6
|
<div className="flex flex-col justify-center min-h-screen py-6 bg-background sm:py-12">
|
|
7
7
|
<div className="relative py-3 mx-auto sm:max-w-xl">
|
|
8
|
-
<h1 className="text-
|
|
8
|
+
<h1 className="text-text text-2xl font-bold text-center">
|
|
9
9
|
500 - {t('500.title')}
|
|
10
10
|
</h1>
|
|
11
11
|
</div>
|