@qlover/create-app 0.7.6 → 0.7.7

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/templates/next-app/.env.template +22 -0
  5. package/dist/templates/next-app/.prettierignore +58 -0
  6. package/dist/templates/next-app/README.md +36 -0
  7. package/dist/templates/next-app/build/generateLocales.ts +25 -0
  8. package/dist/templates/next-app/config/IOCIdentifier.ts +45 -0
  9. package/dist/templates/next-app/config/Identifier/common.error.ts +34 -0
  10. package/dist/templates/next-app/config/Identifier/common.ts +62 -0
  11. package/dist/templates/next-app/config/Identifier/index.ts +10 -0
  12. package/dist/templates/next-app/config/Identifier/page.about.ts +181 -0
  13. package/dist/templates/next-app/config/Identifier/page.executor.ts +272 -0
  14. package/dist/templates/next-app/config/Identifier/page.home.ts +63 -0
  15. package/dist/templates/next-app/config/Identifier/page.identifiter.ts +39 -0
  16. package/dist/templates/next-app/config/Identifier/page.jsonStorage.ts +72 -0
  17. package/dist/templates/next-app/config/Identifier/page.login.ts +165 -0
  18. package/dist/templates/next-app/config/Identifier/page.register.ts +147 -0
  19. package/dist/templates/next-app/config/Identifier/page.request.ts +182 -0
  20. package/dist/templates/next-app/config/common.ts +34 -0
  21. package/dist/templates/next-app/config/i18n/PageI18nInterface.ts +51 -0
  22. package/dist/templates/next-app/config/i18n/i18nConfig.ts +12 -0
  23. package/dist/templates/next-app/config/i18n/index.ts +3 -0
  24. package/dist/templates/next-app/config/i18n/loginI18n.ts +42 -0
  25. package/dist/templates/next-app/config/theme.ts +23 -0
  26. package/dist/templates/next-app/docs/env.md +94 -0
  27. package/dist/templates/next-app/eslint.config.mjs +181 -0
  28. package/dist/templates/next-app/next.config.ts +21 -0
  29. package/dist/templates/next-app/package.json +58 -0
  30. package/dist/templates/next-app/plugins/eslint-plugin-testid.mjs +94 -0
  31. package/dist/templates/next-app/plugins/generateLocalesPlugin.ts +33 -0
  32. package/dist/templates/next-app/postcss.config.mjs +5 -0
  33. package/dist/templates/next-app/public/file.svg +1 -0
  34. package/dist/templates/next-app/public/globe.svg +1 -0
  35. package/dist/templates/next-app/public/locales/en/common.json +183 -0
  36. package/dist/templates/next-app/public/locales/zh/common.json +183 -0
  37. package/dist/templates/next-app/public/next.svg +1 -0
  38. package/dist/templates/next-app/public/vercel.svg +1 -0
  39. package/dist/templates/next-app/public/window.svg +1 -0
  40. package/dist/templates/next-app/src/app/[locale]/favicon.ico +0 -0
  41. package/dist/templates/next-app/src/app/[locale]/layout.tsx +44 -0
  42. package/dist/templates/next-app/src/app/[locale]/login/FeatureItem.tsx +13 -0
  43. package/dist/templates/next-app/src/app/[locale]/login/LoginForm.tsx +115 -0
  44. package/dist/templates/next-app/src/app/[locale]/login/page.tsx +73 -0
  45. package/dist/templates/next-app/src/app/[locale]/not-found.tsx +24 -0
  46. package/dist/templates/next-app/src/app/[locale]/page.tsx +106 -0
  47. package/dist/templates/next-app/src/base/cases/AppConfig.ts +15 -0
  48. package/dist/templates/next-app/src/base/cases/InversifyContainer.ts +33 -0
  49. package/dist/templates/next-app/src/base/port/I18nServiceInterface.ts +25 -0
  50. package/dist/templates/next-app/src/base/port/UserServiceInterface.ts +11 -0
  51. package/dist/templates/next-app/src/base/services/I18nService.ts +115 -0
  52. package/dist/templates/next-app/src/base/services/UserService.ts +23 -0
  53. package/dist/templates/next-app/src/core/IOC.ts +58 -0
  54. package/dist/templates/next-app/src/core/IocRegisterImpl.ts +100 -0
  55. package/dist/templates/next-app/src/core/bootstraps/BootstrapClient.ts +98 -0
  56. package/dist/templates/next-app/src/core/bootstraps/BootstrapsRegistry.ts +47 -0
  57. package/dist/templates/next-app/src/core/bootstraps/IocIdentifierTest.ts +26 -0
  58. package/dist/templates/next-app/src/core/bootstraps/PrintBootstrap.ts +18 -0
  59. package/dist/templates/next-app/src/core/globals.ts +21 -0
  60. package/dist/templates/next-app/src/i18n/request.ts +22 -0
  61. package/dist/templates/next-app/src/i18n/routing.ts +30 -0
  62. package/dist/templates/next-app/src/middleware.ts +22 -0
  63. package/dist/templates/next-app/src/server/getServerI18n.ts +26 -0
  64. package/dist/templates/next-app/src/styles/css/antd-themes/_default.css +239 -0
  65. package/dist/templates/next-app/src/styles/css/antd-themes/dark.css +178 -0
  66. package/dist/templates/next-app/src/styles/css/antd-themes/index.css +3 -0
  67. package/dist/templates/next-app/src/styles/css/antd-themes/no-context.css +34 -0
  68. package/dist/templates/next-app/src/styles/css/antd-themes/pink.css +204 -0
  69. package/dist/templates/next-app/src/styles/css/index.css +6 -0
  70. package/dist/templates/next-app/src/styles/css/page.css +19 -0
  71. package/dist/templates/next-app/src/styles/css/tailwind.css +5 -0
  72. package/dist/templates/next-app/src/styles/css/themes/_default.css +29 -0
  73. package/dist/templates/next-app/src/styles/css/themes/dark.css +29 -0
  74. package/dist/templates/next-app/src/styles/css/themes/index.css +3 -0
  75. package/dist/templates/next-app/src/styles/css/themes/pink.css +29 -0
  76. package/dist/templates/next-app/src/styles/css/zIndex.css +9 -0
  77. package/dist/templates/next-app/src/uikit/components/BaseHeader.tsx +42 -0
  78. package/dist/templates/next-app/src/uikit/components/BootstrapsProvider.tsx +25 -0
  79. package/dist/templates/next-app/src/uikit/components/ComboProvider.tsx +45 -0
  80. package/dist/templates/next-app/src/uikit/components/LanguageSwitcher.tsx +52 -0
  81. package/dist/templates/next-app/src/uikit/components/LocaleLink.tsx +51 -0
  82. package/dist/templates/next-app/src/uikit/components/NextIntlProvider.tsx +21 -0
  83. package/dist/templates/next-app/src/uikit/components/ThemeSwitcher.tsx +86 -0
  84. package/dist/templates/next-app/src/uikit/context/IOCContext.ts +6 -0
  85. package/dist/templates/next-app/src/uikit/hook/useI18nInterface.ts +28 -0
  86. package/dist/templates/next-app/src/uikit/hook/useIOC.ts +37 -0
  87. package/dist/templates/next-app/src/uikit/hook/useMountedClient.ts +11 -0
  88. package/dist/templates/next-app/src/uikit/hook/useStore.ts +15 -0
  89. package/dist/templates/next-app/tailwind.config.ts +8 -0
  90. package/dist/templates/next-app/tsconfig.json +36 -0
  91. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ import { useTranslations } from 'next-intl';
2
+ import { useMemo } from 'react';
3
+ import type { PageI18nInterface } from '@config/i18n/PageI18nInterface';
4
+
5
+ /**
6
+ * Hook to get the i18n interface
7
+ *
8
+ * @param i18nInterface - The i18n interface to get
9
+ * @returns The i18n interface
10
+ */
11
+ export function useI18nInterface<T extends PageI18nInterface>(
12
+ i18nInterface: T
13
+ ): T {
14
+ const t = useTranslations();
15
+
16
+ const i18n = useMemo(() => {
17
+ return Object.fromEntries(
18
+ Object.entries(i18nInterface).map(([key, value]) => {
19
+ if (typeof value === 'string') {
20
+ return [key, t(value)];
21
+ }
22
+ return [key, value];
23
+ })
24
+ ) as T;
25
+ }, [i18nInterface, t]);
26
+
27
+ return i18n;
28
+ }
@@ -0,0 +1,37 @@
1
+ import { useContext } from 'react';
2
+ import { IOCContext } from '../context/IOCContext';
3
+ import type { IOCIdentifierMap } from '@config/IOCIdentifier';
4
+ import type {
5
+ IOCContainerInterface,
6
+ IOCFunctionInterface
7
+ } from '@qlover/corekit-bridge';
8
+
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ type IOCIdentifier = keyof IOCIdentifierMap | (new (...args: any[]) => any);
11
+
12
+ export function useIOC(): IOCFunctionInterface<
13
+ IOCIdentifierMap,
14
+ IOCContainerInterface
15
+ >;
16
+ export function useIOC<T extends IOCIdentifier>(
17
+ identifier: T
18
+ ): T extends keyof IOCIdentifierMap
19
+ ? IOCIdentifierMap[T]
20
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
+ T extends new (...args: any[]) => any
22
+ ? InstanceType<T>
23
+ : never;
24
+
25
+ export function useIOC<T extends IOCIdentifier>(identifier?: T) {
26
+ const IOC = useContext(IOCContext);
27
+
28
+ if (!IOC) {
29
+ throw new Error('IOC is not found');
30
+ }
31
+
32
+ if (identifier === undefined) {
33
+ return IOC;
34
+ }
35
+
36
+ return IOC(identifier);
37
+ }
@@ -0,0 +1,11 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ export const useMountedClient = () => {
4
+ const [mounted, setMounted] = useState(false);
5
+
6
+ useEffect(() => {
7
+ setMounted(true);
8
+ }, []);
9
+
10
+ return mounted;
11
+ };
@@ -0,0 +1,15 @@
1
+ import { useSliceStore, type SliceStore } from '@qlover/slice-store-react';
2
+ import type {
3
+ StoreInterface,
4
+ StoreStateInterface
5
+ } from '@qlover/corekit-bridge';
6
+
7
+ export function useStore<
8
+ C extends StoreInterface<StoreStateInterface>,
9
+ State = C['state']
10
+ >(store: C, selector?: (state: C['state']) => State): State {
11
+ return useSliceStore(
12
+ store as unknown as SliceStore<StoreStateInterface>,
13
+ selector
14
+ );
15
+ }
@@ -0,0 +1,8 @@
1
+ import type { Config } from 'tailwindcss';
2
+
3
+ const config: Config = {
4
+ darkMode: ['class', '[data-theme="dark"]'],
5
+ content: ['./src/**/*.{js,ts,jsx,tsx}']
6
+ };
7
+
8
+ export default config;
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2017",
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "allowJs": true,
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "noEmit": true,
9
+ "esModuleInterop": true,
10
+ "module": "esnext",
11
+ "moduleResolution": "bundler",
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "jsx": "preserve",
15
+ "incremental": true,
16
+ "experimentalDecorators": true,
17
+ "emitDecoratorMetadata": true,
18
+ "plugins": [
19
+ {
20
+ "name": "next"
21
+ }
22
+ ],
23
+ "paths": {
24
+ "@/*": ["./src/*"],
25
+ "@config/*": ["./config/*"]
26
+ }
27
+ },
28
+ "include": [
29
+ "next-env.d.ts",
30
+ "src/**/*.ts",
31
+ "src/**/*.tsx",
32
+ ".next/types/**/*.ts",
33
+ "config/**/*.ts"
34
+ ],
35
+ "exclude": ["node_modules"]
36
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qlover/create-app",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "Create a new app with a single command",
5
5
  "private": false,
6
6
  "type": "module",