@qlover/create-app 0.1.3 → 0.1.5
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 -0
- package/bin/create-app.js +44 -4
- package/{templates/pack-app → configs/_common}/.env.template +8 -1
- package/{templates/pack-app → configs/_common}/.github/workflows/general-check.yml +9 -9
- package/{templates/pack-app → configs/_common}/.github/workflows/release.yml.template +18 -18
- package/configs/_common/.prettierrc.js +7 -0
- package/configs/_common/.release-it.json.template +42 -0
- package/configs/_common/.vscode/extensions.json +9 -0
- package/configs/_common/.vscode/react.code-snippets +19 -0
- package/configs/_common/.vscode/settings.json +11 -0
- package/configs/_common/package.json +61 -0
- package/configs/node-lib/eslint.config.js +50 -0
- package/configs/react-app/eslint.config.js +66 -0
- package/dist/cjs/index.d.ts +52 -37
- package/dist/cjs/index.js +1 -1
- package/dist/es/index.d.ts +52 -37
- package/dist/es/index.js +1 -1
- package/package.json +5 -2
- package/templates/node-lib/.release-it.json +42 -0
- package/templates/node-lib/__tests__/readJson.test.ts +1 -0
- package/templates/node-lib/bin/test.js +30 -0
- package/templates/node-lib/package.json +23 -6
- package/templates/node-lib/rollup.config.js +15 -24
- package/templates/node-lib/src/readJson.ts +9 -3
- package/templates/node-lib/tsconfig.json +19 -1
- package/templates/pack-app/eslint.config.js +81 -61
- package/templates/pack-app/fe-config.json +1 -5
- package/templates/pack-app/package.json +19 -11
- package/templates/pack-app/tsconfig.json +1 -1
- package/templates/pack-app/vite.config.ts +14 -0
- package/templates/react-app/README.md +177 -40
- package/templates/react-app/config/i18n.ts +1 -1
- package/templates/react-app/lib/fe-react-controller/FeController.ts +7 -3
- package/templates/react-app/lib/fe-react-theme/ThemeController.ts +1 -1
- package/templates/react-app/package.json +53 -8
- package/templates/react-app/src/App.tsx +4 -5
- package/templates/react-app/src/{services → base/apis}/feApi/FeApiMockPlugin.ts +1 -1
- package/templates/react-app/src/base/cases/UserToken.ts +47 -0
- package/templates/react-app/src/base/port/IOCInterface.ts +53 -0
- package/templates/react-app/src/base/port/StorageTokenInterface.ts +5 -0
- package/templates/react-app/src/{types → base/port}/UIDependenciesInterface.ts +6 -0
- package/templates/react-app/src/{types → base/types}/global.d.ts +1 -1
- package/templates/react-app/src/components/ThemeSwitcher.tsx +3 -2
- package/templates/react-app/src/core/bootstrap.ts +21 -0
- package/templates/react-app/src/core/feIOC/FeIOC.ts +32 -0
- package/templates/react-app/src/core/feIOC/RegisterApi.ts +41 -0
- package/templates/react-app/src/core/feIOC/RegisterCommon.ts +20 -0
- package/templates/react-app/src/core/feIOC/RegisterControllers.ts +53 -0
- package/templates/react-app/src/core/index.ts +31 -0
- package/templates/react-app/src/main.tsx +8 -10
- package/templates/react-app/src/pages/404.tsx +2 -2
- package/templates/react-app/src/pages/500.tsx +1 -1
- package/templates/react-app/src/pages/auth/Layout.tsx +3 -2
- package/templates/react-app/src/pages/auth/Login.tsx +6 -4
- package/templates/react-app/src/pages/base/About.tsx +1 -1
- package/templates/react-app/src/pages/base/Executor.tsx +8 -4
- package/templates/react-app/src/pages/base/Home.tsx +1 -1
- package/templates/react-app/src/pages/base/JSONStorage.tsx +6 -4
- package/templates/react-app/src/pages/base/Layout.tsx +1 -1
- package/templates/react-app/src/pages/base/RedirectPathname.tsx +1 -1
- package/templates/react-app/src/pages/base/Request.tsx +8 -3
- package/templates/react-app/src/pages/index.tsx +7 -2
- package/templates/react-app/src/services/{pageProcesser/PageProcesser.ts → processer/ProcesserService.ts} +3 -3
- package/templates/react-app/src/{containers/context → uikit/contexts}/BaseRouteContext.ts +4 -4
- package/templates/react-app/src/{services → uikit}/controllers/ExecutorController.ts +5 -5
- package/templates/react-app/src/{services → uikit}/controllers/JSONStorageController.ts +2 -2
- package/templates/react-app/src/{services → uikit}/controllers/RequestController.ts +3 -3
- package/templates/react-app/src/{services → uikit}/controllers/RouterController.ts +2 -2
- package/templates/react-app/src/{services → uikit}/controllers/UserController.ts +25 -51
- package/templates/react-app/src/{containers/context → uikit/providers}/BaseRouteProvider.tsx +2 -2
- package/templates/react-app/src/{components → uikit/providers}/ProcessProvider.tsx +13 -7
- package/templates/react-app/tsconfig.json +27 -5
- package/templates/react-app/tsconfig.node.json +3 -15
- package/templates/react-app/vite.config.ts +17 -14
- package/templates/pack-app/.env +0 -5
- package/templates/pack-app/.gitignore.template +0 -50
- package/templates/pack-app/.prettierrc.js +0 -3
- package/templates/pack-app/CHANGELOG.md +0 -0
- package/templates/pack-app/jest.config.js +0 -31
- package/templates/react-app/eslint.config.js +0 -31
- package/templates/react-app/src/containers/index.ts +0 -71
- package/templates/react-app/src/services/pageProcesser/index.ts +0 -1
- package/templates/react-app/tsconfig.app.json +0 -29
- package/templates/react-vite-lib/.gitignore.template +0 -27
- package/templates/react-vite-lib/README.md +0 -50
- package/templates/react-vite-lib/__tests__/Sum.test.ts +0 -9
- package/templates/react-vite-lib/__tests__/Text.test.tsx +0 -11
- package/templates/react-vite-lib/eslint.config.js +0 -28
- package/templates/react-vite-lib/index.html +0 -13
- package/templates/react-vite-lib/package.json +0 -30
- package/templates/react-vite-lib/public/vite.svg +0 -1
- package/templates/react-vite-lib/src/calc.ts +0 -3
- package/templates/react-vite-lib/src/commponents/Text.tsx +0 -7
- package/templates/react-vite-lib/src/index.ts +0 -2
- package/templates/react-vite-lib/src/vite-env.d.ts +0 -1
- package/templates/react-vite-lib/tsconfig.json +0 -25
- package/templates/react-vite-lib/vite.config.ts +0 -24
- /package/{templates/pack-app → configs/_common}/.editorconfig +0 -0
- /package/{templates/pack-app → configs/_common}/.gitattributes +0 -0
- /package/{templates/react-app → configs/_common}/.gitignore.template +0 -0
- /package/{templates/pack-app → configs/_common}/.prettierignore +0 -0
- /package/templates/react-app/src/{services → base/apis}/feApi/FeApi.ts +0 -0
- /package/templates/react-app/src/{services → base/apis}/feApi/FeApiType.ts +0 -0
- /package/templates/react-app/src/{services → base/apis}/feApi/index.ts +0 -0
- /package/templates/react-app/src/{types → base/types}/Page.ts +0 -0
- /package/templates/react-app/src/{containers → core}/globals.ts +0 -0
- /package/templates/react-app/src/{hooks → uikit/hooks}/useLanguageGuard.ts +0 -0
- /package/templates/react-app/src/{hooks → uikit/hooks}/useStrictEffect.ts +0 -0
- /package/templates/react-app/src/{styles → uikit/styles}/css/index.css +0 -0
- /package/templates/react-app/src/{styles → uikit/styles}/css/page.css +0 -0
- /package/templates/react-app/src/{styles → uikit/styles}/css/tailwind.css +0 -0
- /package/templates/react-app/src/{utils → uikit/utils}/RequestLogger.ts +0 -0
- /package/templates/react-app/src/{utils → uikit/utils}/datetime.ts +0 -0
- /package/templates/react-app/src/{utils → uikit/utils}/thread.ts +0 -0
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"module": "ESNext",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"moduleResolution": "bundler",
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noUnusedLocals": true,
|
|
16
|
+
"noUnusedParameters": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"allowJs": true,
|
|
20
|
+
"types": ["vite/client"],
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": ["./src/*"],
|
|
23
|
+
"@lib/*": ["./lib/*"],
|
|
24
|
+
"@config/*": ["./config/*"]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"include": ["src"],
|
|
28
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
7
29
|
}
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"lib": ["ES2023"],
|
|
5
|
-
"module": "ESNext",
|
|
3
|
+
"composite": true,
|
|
6
4
|
"skipLibCheck": true,
|
|
7
|
-
|
|
8
|
-
/* Bundler mode */
|
|
5
|
+
"module": "ESNext",
|
|
9
6
|
"moduleResolution": "bundler",
|
|
10
|
-
"
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"moduleDetection": "force",
|
|
13
|
-
"noEmit": true,
|
|
14
|
-
|
|
15
|
-
/* Linting */
|
|
16
|
-
"strict": true,
|
|
17
|
-
"noUnusedLocals": true,
|
|
18
|
-
"noUnusedParameters": true,
|
|
19
|
-
"noFallthroughCasesInSwitch": true
|
|
7
|
+
"allowSyntheticDefaultImports": true
|
|
20
8
|
},
|
|
21
9
|
"include": ["vite.config.ts"]
|
|
22
10
|
}
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { defineConfig } from '
|
|
2
|
-
import alias from '@rollup/plugin-alias';
|
|
3
|
-
// import react from '@vitejs/plugin-react-swc';
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
4
2
|
import react from '@vitejs/plugin-react';
|
|
5
|
-
import
|
|
6
|
-
import tsappconfig from './tsconfig.
|
|
7
|
-
import {
|
|
3
|
+
import alias from '@rollup/plugin-alias';
|
|
4
|
+
import tsappconfig from './tsconfig.json';
|
|
5
|
+
import { resolve } from 'path';
|
|
6
|
+
import { Env } from '@qlover/env-loader';
|
|
8
7
|
|
|
9
|
-
searchEnv(
|
|
8
|
+
Env.searchEnv();
|
|
10
9
|
|
|
11
10
|
const tsAppPaths = tsappconfig.compilerOptions.paths || {};
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
12
|
+
// convert tsconfig paths to vite alias
|
|
13
|
+
const entries = Object.entries(tsAppPaths).reduce((acc, [key, value]) => {
|
|
14
|
+
acc[key.replace('/*', '')] = resolve(__dirname, value[0].replace('/*', ''));
|
|
15
|
+
return acc;
|
|
16
|
+
}, {});
|
|
19
17
|
|
|
20
18
|
// https://vite.dev/config/
|
|
21
19
|
export default defineConfig({
|
|
@@ -27,6 +25,11 @@ export default defineConfig({
|
|
|
27
25
|
],
|
|
28
26
|
publicDir: 'public',
|
|
29
27
|
server: {
|
|
30
|
-
port: Number(process.env.VITE_SERVER_PORT ||
|
|
28
|
+
port: Number(process.env.VITE_SERVER_PORT || 3200)
|
|
29
|
+
},
|
|
30
|
+
test: {
|
|
31
|
+
environment: 'jsdom',
|
|
32
|
+
globals: true,
|
|
33
|
+
setupFiles: ['./src/setupTests.ts']
|
|
31
34
|
}
|
|
32
35
|
});
|
package/templates/pack-app/.env
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
node_modules
|
|
5
|
-
/.pnp
|
|
6
|
-
.pnp.js
|
|
7
|
-
|
|
8
|
-
# testing
|
|
9
|
-
/coverage
|
|
10
|
-
|
|
11
|
-
# next.js
|
|
12
|
-
/.next/
|
|
13
|
-
/out/
|
|
14
|
-
|
|
15
|
-
# production
|
|
16
|
-
/build
|
|
17
|
-
|
|
18
|
-
# misc
|
|
19
|
-
.DS_Store
|
|
20
|
-
*.pem
|
|
21
|
-
|
|
22
|
-
# debug
|
|
23
|
-
npm-debug.log*
|
|
24
|
-
yarn-debug.log*
|
|
25
|
-
yarn-error.log*
|
|
26
|
-
.pnpm-debug.log*
|
|
27
|
-
|
|
28
|
-
# local env files
|
|
29
|
-
.env*.local
|
|
30
|
-
|
|
31
|
-
# vercel
|
|
32
|
-
.vercel
|
|
33
|
-
|
|
34
|
-
# typescript
|
|
35
|
-
*.tsbuildinfo
|
|
36
|
-
next-env.d.ts
|
|
37
|
-
|
|
38
|
-
/package-lock.json
|
|
39
|
-
/yarn.lock
|
|
40
|
-
.husky
|
|
41
|
-
/pnpm-lock.yaml
|
|
42
|
-
public/robots.txt
|
|
43
|
-
public/sitemap*.xml
|
|
44
|
-
dist
|
|
45
|
-
.eslintcache
|
|
46
|
-
.npmrc
|
|
47
|
-
.secrets
|
|
48
|
-
|
|
49
|
-
# local output dir
|
|
50
|
-
*.output/
|
|
File without changes
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import tsJestConfig from '@qlover/fe-standard/config/jest.esm.js';
|
|
2
|
-
|
|
3
|
-
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
4
|
-
export default {
|
|
5
|
-
// ...tsJestConfig,
|
|
6
|
-
testEnvironment: 'jest-environment-jsdom',
|
|
7
|
-
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
8
|
-
projects: [
|
|
9
|
-
{
|
|
10
|
-
...tsJestConfig,
|
|
11
|
-
displayName: 'pack-app-node',
|
|
12
|
-
testMatch: tsJestConfig.testMatch.map(
|
|
13
|
-
(item) => '<rootDir>/packages/node/' + item
|
|
14
|
-
)
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
...tsJestConfig,
|
|
18
|
-
displayName: 'pack-app-browser',
|
|
19
|
-
testMatch: tsJestConfig.testMatch.map(
|
|
20
|
-
(item) => '<rootDir>/packages/browser/' + item
|
|
21
|
-
)
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
...tsJestConfig,
|
|
25
|
-
displayName: 'pack-app-react',
|
|
26
|
-
testEnvironment: 'jest-environment-jsdom',
|
|
27
|
-
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
28
|
-
testMatch: ['<rootDir>/packages/react-vite-lib/__tests__/**/*.test.tsx']
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import globals from 'globals';
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks';
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
5
|
-
import tseslint from 'typescript-eslint';
|
|
6
|
-
import * as feDev from '@qlover/eslint-plugin-fe-dev';
|
|
7
|
-
|
|
8
|
-
export default tseslint.config(
|
|
9
|
-
{ ignores: ['dist', 'node_modules'] },
|
|
10
|
-
{
|
|
11
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
12
|
-
files: ['src/**/*.{ts,tsx}'],
|
|
13
|
-
languageOptions: {
|
|
14
|
-
ecmaVersion: 2020,
|
|
15
|
-
globals: globals.browser
|
|
16
|
-
},
|
|
17
|
-
plugins: {
|
|
18
|
-
'react-hooks': reactHooks,
|
|
19
|
-
'react-refresh': reactRefresh,
|
|
20
|
-
'fe-dev': feDev
|
|
21
|
-
},
|
|
22
|
-
rules: {
|
|
23
|
-
...reactHooks.configs.recommended.rules,
|
|
24
|
-
'react-refresh/only-export-components': [
|
|
25
|
-
'warn',
|
|
26
|
-
{ allowConstantExport: true }
|
|
27
|
-
],
|
|
28
|
-
'fe-dev/ts-class-method-return': 'error'
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// ! dont't import tsx, only ts file
|
|
2
|
-
import { FetchAbortPlugin, FetchURLPlugin } from '@qlover/fe-utils';
|
|
3
|
-
import { OpenAIClient } from '@lib/openAiApi';
|
|
4
|
-
import { ThemeController } from '@lib/fe-react-theme/ThemeController';
|
|
5
|
-
import { ExecutorController } from '@/services/controllers/ExecutorController';
|
|
6
|
-
import { JSONStorageController } from '@/services/controllers/JSONStorageController';
|
|
7
|
-
import { RequestController } from '@/services/controllers/RequestController';
|
|
8
|
-
import { UserController } from '@/services/controllers/UserController';
|
|
9
|
-
import { RouterController } from '@/services/controllers/RouterController';
|
|
10
|
-
import { FeApi, FeApiMockPlugin } from '@/services/feApi';
|
|
11
|
-
import { defaultFeApiConfig, openAiConfig } from '@config/app.common';
|
|
12
|
-
import themeConfigJson from '@config/theme.json';
|
|
13
|
-
import appRouterConfig from '@config/app.router.json';
|
|
14
|
-
import mockDataJson from '@config/feapi.mock.json';
|
|
15
|
-
import { RequestCommonPlugin } from '@lib/request-common-plugin';
|
|
16
|
-
import { localJsonStorage, logger } from './globals';
|
|
17
|
-
import { RequestLogger } from '@/utils/RequestLogger';
|
|
18
|
-
import { RouteConfig } from '@/types/Page';
|
|
19
|
-
import { PageProcesser } from '@/services/pageProcesser';
|
|
20
|
-
|
|
21
|
-
// common plugins
|
|
22
|
-
const requestLogger = new RequestLogger(logger);
|
|
23
|
-
export const feApiAbort = new FetchAbortPlugin();
|
|
24
|
-
|
|
25
|
-
// open ai api
|
|
26
|
-
openAiConfig.commonPluginConfig.requestDataSerializer = (data) =>
|
|
27
|
-
JSON.stringify(data);
|
|
28
|
-
export const openAiApi = new OpenAIClient(openAiConfig).usePlugin(
|
|
29
|
-
requestLogger
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
export const feApi = new FeApi({
|
|
33
|
-
abortPlugin: feApiAbort,
|
|
34
|
-
config: defaultFeApiConfig.adapter
|
|
35
|
-
})
|
|
36
|
-
.usePlugin(new FetchURLPlugin())
|
|
37
|
-
.usePlugin(
|
|
38
|
-
new RequestCommonPlugin({
|
|
39
|
-
...defaultFeApiConfig.commonPluginConfig,
|
|
40
|
-
token: () => localJsonStorage.getItem('fe_user_token')
|
|
41
|
-
})
|
|
42
|
-
)
|
|
43
|
-
.usePlugin(new FeApiMockPlugin(mockDataJson))
|
|
44
|
-
.usePlugin(requestLogger)
|
|
45
|
-
.usePlugin(feApiAbort);
|
|
46
|
-
|
|
47
|
-
// ui layer controller
|
|
48
|
-
export const routerController = new RouterController({
|
|
49
|
-
config: appRouterConfig.base as RouteConfig,
|
|
50
|
-
logger
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export const jsonStorageController = new JSONStorageController(
|
|
54
|
-
localJsonStorage
|
|
55
|
-
);
|
|
56
|
-
export const requestController = new RequestController(openAiApi, feApi);
|
|
57
|
-
export const executorController = new ExecutorController(feApi);
|
|
58
|
-
export const userController = new UserController({
|
|
59
|
-
storageKey: 'fe_user_token',
|
|
60
|
-
storage: localJsonStorage,
|
|
61
|
-
feApi,
|
|
62
|
-
routerController
|
|
63
|
-
});
|
|
64
|
-
export const themeController = new ThemeController({
|
|
65
|
-
...themeConfigJson.override,
|
|
66
|
-
storage: localJsonStorage
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
export const pageProcesser = new PageProcesser({
|
|
70
|
-
logger
|
|
71
|
-
}).usePlugin(userController);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './PageProcesser';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
-
"module": "ESNext",
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
"moduleResolution": "bundler",
|
|
10
|
-
"allowImportingTsExtensions": true,
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"moduleDetection": "force",
|
|
13
|
-
"noEmit": true,
|
|
14
|
-
"jsx": "react-jsx",
|
|
15
|
-
|
|
16
|
-
"strict": true,
|
|
17
|
-
"noUnusedLocals": true,
|
|
18
|
-
"noUnusedParameters": true,
|
|
19
|
-
"noFallthroughCasesInSwitch": true,
|
|
20
|
-
"baseUrl": ".",
|
|
21
|
-
"paths": {
|
|
22
|
-
"@/*": ["./src/*"],
|
|
23
|
-
"@lib/*": ["./lib/*"],
|
|
24
|
-
"@config/*": ["./config/*"],
|
|
25
|
-
"packages/*": ["../../packages/*"]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"include": ["src", "config", "lib"]
|
|
29
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
pnpm-debug.log*
|
|
8
|
-
lerna-debug.log*
|
|
9
|
-
|
|
10
|
-
node_modules
|
|
11
|
-
dist
|
|
12
|
-
dist-ssr
|
|
13
|
-
*.local
|
|
14
|
-
|
|
15
|
-
# Editor directories and files
|
|
16
|
-
.vscode/*
|
|
17
|
-
!.vscode/extensions.json
|
|
18
|
-
.idea
|
|
19
|
-
.DS_Store
|
|
20
|
-
*.suo
|
|
21
|
-
*.ntvs*
|
|
22
|
-
*.njsproj
|
|
23
|
-
*.sln
|
|
24
|
-
*.sw?
|
|
25
|
-
|
|
26
|
-
tsconfig.app.json
|
|
27
|
-
tsconfig.node.json
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# React + TypeScript + Vite
|
|
2
|
-
|
|
3
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
-
|
|
10
|
-
## Expanding the ESLint configuration
|
|
11
|
-
|
|
12
|
-
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
13
|
-
|
|
14
|
-
- Configure the top-level `parserOptions` property like this:
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
export default tseslint.config({
|
|
18
|
-
languageOptions: {
|
|
19
|
-
// other options...
|
|
20
|
-
parserOptions: {
|
|
21
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
22
|
-
tsconfigRootDir: import.meta.dirname,
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
|
29
|
-
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
|
30
|
-
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
// eslint.config.js
|
|
34
|
-
import react from 'eslint-plugin-react'
|
|
35
|
-
|
|
36
|
-
export default tseslint.config({
|
|
37
|
-
// Set the react version
|
|
38
|
-
settings: { react: { version: '18.3' } },
|
|
39
|
-
plugins: {
|
|
40
|
-
// Add the react plugin
|
|
41
|
-
react,
|
|
42
|
-
},
|
|
43
|
-
rules: {
|
|
44
|
-
// other rules...
|
|
45
|
-
// Enable its recommended rules
|
|
46
|
-
...react.configs.recommended.rules,
|
|
47
|
-
...react.configs['jsx-runtime'].rules,
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { Text } from '../src/commponents/Text';
|
|
4
|
-
|
|
5
|
-
describe('Text Component', () => {
|
|
6
|
-
test('renders the text prop', () => {
|
|
7
|
-
render(<Text text="Hello, World!" />);
|
|
8
|
-
const textElement = screen.getByText(/Hello, World!/i);
|
|
9
|
-
expect(textElement).toBeInTheDocument();
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import globals from 'globals';
|
|
3
|
-
import reactHooks from 'eslint-plugin-react-hooks';
|
|
4
|
-
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
5
|
-
import tseslint from 'typescript-eslint';
|
|
6
|
-
|
|
7
|
-
export default tseslint.config(
|
|
8
|
-
{ ignores: ['dist'] },
|
|
9
|
-
{
|
|
10
|
-
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
|
-
files: ['**/*.{ts,tsx}'],
|
|
12
|
-
languageOptions: {
|
|
13
|
-
ecmaVersion: 2020,
|
|
14
|
-
globals: globals.browser
|
|
15
|
-
},
|
|
16
|
-
plugins: {
|
|
17
|
-
'react-hooks': reactHooks,
|
|
18
|
-
'react-refresh': reactRefresh
|
|
19
|
-
},
|
|
20
|
-
rules: {
|
|
21
|
-
...reactHooks.configs.recommended.rules,
|
|
22
|
-
'react-refresh/only-export-components': [
|
|
23
|
-
'warn',
|
|
24
|
-
{ allowConstantExport: true }
|
|
25
|
-
]
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Vite + React + TS</title>
|
|
8
|
-
</head>
|
|
9
|
-
<body>
|
|
10
|
-
<div id="root"></div>
|
|
11
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
-
</body>
|
|
13
|
-
</html>
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-vite-lib",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.0.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "vite",
|
|
8
|
-
"build": "tsc -b && vite build",
|
|
9
|
-
"lint": "eslint .",
|
|
10
|
-
"preview": "vite preview"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"react": "^18.3.1",
|
|
14
|
-
"react-dom": "^18.3.1"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@eslint/js": "^9.17.0",
|
|
18
|
-
"@types/react": "^18.3.18",
|
|
19
|
-
"@types/react-dom": "^18.3.5",
|
|
20
|
-
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
21
|
-
"eslint": "^9.17.0",
|
|
22
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
23
|
-
"eslint-plugin-react-refresh": "^0.4.16",
|
|
24
|
-
"globals": "^15.14.0",
|
|
25
|
-
"jest": "^29.7.0",
|
|
26
|
-
"typescript": "~5.6.2",
|
|
27
|
-
"typescript-eslint": "^8.18.2",
|
|
28
|
-
"vite": "^6.0.5"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// / <reference types="vite/client" />
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ESNext",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
-
"allowJs": false,
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"esModuleInterop": false,
|
|
9
|
-
"allowSyntheticDefaultImports": true,
|
|
10
|
-
"strict": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"module": "ESNext",
|
|
13
|
-
"moduleResolution": "Node",
|
|
14
|
-
"resolveJsonModule": true,
|
|
15
|
-
"isolatedModules": true,
|
|
16
|
-
"noEmit": true,
|
|
17
|
-
"jsx": "react-jsx",
|
|
18
|
-
"types": ["vite/client"],
|
|
19
|
-
"baseUrl": ".",
|
|
20
|
-
"paths": {
|
|
21
|
-
"@/*": ["src/*"]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"include": ["src", "vite.config.ts", "__tests__"]
|
|
25
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite';
|
|
2
|
-
import react from '@vitejs/plugin-react-swc';
|
|
3
|
-
import pkg from './package.json' assert { type: 'json' };
|
|
4
|
-
|
|
5
|
-
// https://vite.dev/config/
|
|
6
|
-
export default defineConfig({
|
|
7
|
-
plugins: [react()],
|
|
8
|
-
build: {
|
|
9
|
-
lib: {
|
|
10
|
-
entry: 'src/index.ts',
|
|
11
|
-
name: pkg.name,
|
|
12
|
-
fileName: (format) => `index.${format}.js`
|
|
13
|
-
},
|
|
14
|
-
rollupOptions: {
|
|
15
|
-
external: ['react', 'react-dom'],
|
|
16
|
-
output: {
|
|
17
|
-
globals: {
|
|
18
|
-
react: 'React',
|
|
19
|
-
'react-dom': 'ReactDOM'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|