create-secra 0.1.0 → 0.1.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/README.md +3 -5
- package/bin/index.mjs +15 -11
- package/package.json +4 -6
- package/template/apps/core/index.html +13 -0
- package/template/apps/core/package.json +18 -0
- package/template/apps/core/public/favicon.ico +1 -0
- package/template/apps/core/public/favicon.svg +1 -0
- package/template/apps/core/public/logo.svg +1 -0
- package/template/apps/core/src/assets/react.svg +1 -0
- package/template/apps/core/src/main.tsx +21 -0
- package/template/apps/core/src/pages/index.tsx +4 -0
- package/template/apps/core/src/router.ts +15 -0
- package/template/apps/core/src/types/auto-imports.d.ts +130 -0
- package/template/apps/core/tsconfig.app.json +7 -0
- package/template/apps/core/tsconfig.json +7 -0
- package/template/apps/core/tsconfig.node.json +7 -0
- package/template/apps/core/vite.config.ts +86 -0
- package/template/eslint.config.js +23 -0
- package/template/package.json +60 -0
- package/template/packages/sdk/.swcrc +18 -0
- package/template/packages/sdk/package-lock.json +1621 -0
- package/template/packages/sdk/package.json +32 -0
- package/template/packages/sdk/src/build/index.ts +33 -0
- package/template/packages/sdk/src/build/plugins/auto-import.ts +47 -0
- package/template/packages/sdk/src/build/plugins/bundle-analyzer.ts +35 -0
- package/template/packages/sdk/src/build/plugins/remove-console.ts +21 -0
- package/template/packages/sdk/src/build/plugins/unocss.ts +110 -0
- package/template/packages/sdk/src/build/plugins/unplugin-icon.ts +43 -0
- package/template/packages/sdk/src/index.ts +1 -0
- package/template/packages/sdk/src/request/index.ts +341 -0
- package/template/packages/sdk/src/styles/reset.css +111 -0
- package/template/packages/sdk/tsconfig.json +16 -0
- package/template/pnpm-lock.yaml +8055 -0
- package/template/pnpm-workspace.yaml +3 -0
- package/template/tsconfig.app.json +29 -0
- package/template/tsconfig.json +7 -0
- package/template/tsconfig.node.json +27 -0
- package/template/turbo.json +17 -0
package/README.md
CHANGED
|
@@ -12,12 +12,10 @@ or
|
|
|
12
12
|
npm create secra@latest my-app
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
By default it
|
|
15
|
+
By default it uses the local `template` directory in this package.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
You can override the template repo temporarily:
|
|
17
|
+
You can override the template directory temporarily:
|
|
20
18
|
|
|
21
19
|
```bash
|
|
22
|
-
SECRA_TEMPLATE
|
|
20
|
+
SECRA_TEMPLATE=/absolute/path/to/template pnpm create secra my-app
|
|
23
21
|
```
|
package/bin/index.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { spawn } from "node:child_process";
|
|
4
|
-
import { existsSync, readdirSync } from "node:fs";
|
|
4
|
+
import { cpSync, existsSync, readdirSync } from "node:fs";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import process from "node:process";
|
|
7
|
-
import degit from "degit";
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const DEFAULT_TEMPLATE = path.resolve(__dirname, "../template");
|
|
11
|
+
const EXCLUDED_DIRS = new Set(["node_modules", "dist", ".turbo", ".git"]);
|
|
10
12
|
const targetArg = process.argv[2];
|
|
11
13
|
const targetDir = targetArg && targetArg.trim() ? targetArg.trim() : "secra-app";
|
|
12
14
|
const targetPath = path.resolve(process.cwd(), targetDir);
|
|
@@ -59,17 +61,19 @@ async function main() {
|
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
force: true,
|
|
66
|
-
verbose: false,
|
|
67
|
-
});
|
|
64
|
+
if (!existsSync(template)) {
|
|
65
|
+
fail(`Template does not exist: ${template}`);
|
|
66
|
+
}
|
|
68
67
|
|
|
68
|
+
console.log(`[create-secra] Scaffolding from local template: ${template} ...`);
|
|
69
69
|
try {
|
|
70
|
-
|
|
70
|
+
cpSync(template, targetPath, {
|
|
71
|
+
recursive: true,
|
|
72
|
+
force: true,
|
|
73
|
+
filter: (sourcePath) => !EXCLUDED_DIRS.has(path.basename(sourcePath)),
|
|
74
|
+
});
|
|
71
75
|
} catch (error) {
|
|
72
|
-
fail(`Failed to
|
|
76
|
+
fail(`Failed to copy template. ${error instanceof Error ? error.message : String(error)}`);
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
console.log(`[create-secra] Installing dependencies with ${manager} ...`);
|
package/package.json
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-secra",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Create a Secra project from the official template.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-secra": "bin/index.mjs"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"bin"
|
|
10
|
+
"bin",
|
|
11
|
+
"template"
|
|
11
12
|
],
|
|
12
13
|
"keywords": [
|
|
13
14
|
"create",
|
|
14
15
|
"secra",
|
|
15
16
|
"scaffold"
|
|
16
17
|
],
|
|
17
|
-
"license": "MIT"
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"degit": "^2.8.4"
|
|
20
|
-
}
|
|
18
|
+
"license": "MIT"
|
|
21
19
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>core</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "core",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.1",
|
|
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
|
+
|
|
14
|
+
},
|
|
15
|
+
"overrides": {
|
|
16
|
+
"vite": "npm:rolldown-vite@7.2.5"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 109.07 100"><path fill="#24d6fe" d="M54.65 100l18.21-25.37H36.22L54.65 100z"/><path fill="#24d6fe" d="M72.86 24.94l-.07-.09L54.54 0 36.28 24.85l18.26 24.84 18.32 24.94 18.18 24.75 18.03-25.14-36.21-49.3z"/><path fill="#9e5df9" opacity=".5" d="M72.79 24.85L54.54 0 36.28 24.85l18.26 24.84 18.25-24.84z"/><path fill="#9e5df9" d="M36.22 49.69H18.03L0 74.24 18.09 99.3l18.13-24.67 18.32-24.94H36.22z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 109.07 100"><path fill="#24d6fe" d="M54.65 100l18.21-25.37H36.22L54.65 100z"/><path fill="#24d6fe" d="M72.86 24.94l-.07-.09L54.54 0 36.28 24.85l18.26 24.84 18.32 24.94 18.18 24.75 18.03-25.14-36.21-49.3z"/><path fill="#9e5df9" opacity=".5" d="M72.79 24.85L54.54 0 36.28 24.85l18.26 24.84 18.25-24.84z"/><path fill="#9e5df9" d="M36.22 49.69H18.03L0 74.24 18.09 99.3l18.13-24.67 18.32-24.94H36.22z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 109.07 100"><path fill="#24d6fe" d="M54.65 100l18.21-25.37H36.22L54.65 100z"/><path fill="#24d6fe" d="M72.86 24.94l-.07-.09L54.54 0 36.28 24.85l18.26 24.84 18.32 24.94 18.18 24.75 18.03-25.14-36.21-49.3z"/><path fill="#9e5df9" opacity=".5" d="M72.79 24.85L54.54 0 36.28 24.85l18.26 24.84 18.25-24.84z"/><path fill="#9e5df9" d="M36.22 49.69H18.03L0 74.24 18.09 99.3l18.13-24.67 18.32-24.94H36.22z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
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="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "@vlian/sdk/reset.css";
|
|
2
|
+
import { startApp } from '@vlian/framework/core';
|
|
3
|
+
import { LogLevel } from '@vlian/framework/utils';
|
|
4
|
+
import { getRoutes } from './router';
|
|
5
|
+
void startApp({
|
|
6
|
+
showSplashScreen: 'auto', // 自动判断是否显示启动页
|
|
7
|
+
loggerLevel: LogLevel.DEBUG,
|
|
8
|
+
configStrategy: {
|
|
9
|
+
//加载关键配置 这些配置必须在应用渲染前加载完成
|
|
10
|
+
loadCriticalConfig: async () => {
|
|
11
|
+
return {}
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
lifecycle: {
|
|
15
|
+
},
|
|
16
|
+
router: {
|
|
17
|
+
enabled: true,
|
|
18
|
+
routes: getRoutes,
|
|
19
|
+
mode: 'browser',
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RouteConfig } from "@vlian/framework/core"
|
|
2
|
+
|
|
3
|
+
export const getRoutes = async (): Promise<RouteConfig[]> => {
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
path: "/",
|
|
7
|
+
name: "home",
|
|
8
|
+
page: () => import('./pages/index.tsx'),
|
|
9
|
+
handle: {
|
|
10
|
+
title: "首页",
|
|
11
|
+
order: 1,
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
]
|
|
15
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
// noinspection JSUnusedGlobalSymbols
|
|
5
|
+
// Generated by unplugin-auto-import
|
|
6
|
+
export {}
|
|
7
|
+
declare global {
|
|
8
|
+
const Link: typeof import('react-router-dom')['Link']
|
|
9
|
+
const NavLink: typeof import('react-router-dom')['NavLink']
|
|
10
|
+
const Navigate: typeof import('react-router-dom')['Navigate']
|
|
11
|
+
const Outlet: typeof import('react-router-dom')['Outlet']
|
|
12
|
+
const Route: typeof import('react-router-dom')['Route']
|
|
13
|
+
const Routes: typeof import('react-router-dom')['Routes']
|
|
14
|
+
const createRef: typeof import('react')['createRef']
|
|
15
|
+
const forwardRef: typeof import('react')['forwardRef']
|
|
16
|
+
const lazy: typeof import('react')['lazy']
|
|
17
|
+
const memo: typeof import('react')['memo']
|
|
18
|
+
const startTransition: typeof import('react')['startTransition']
|
|
19
|
+
const useAntdTable: typeof import('ahooks')['useAntdTable']
|
|
20
|
+
const useAsyncEffect: typeof import('ahooks')['useAsyncEffect']
|
|
21
|
+
const useBoolean: typeof import('ahooks')['useBoolean']
|
|
22
|
+
const useCallback: typeof import('react')['useCallback']
|
|
23
|
+
const useClickAway: typeof import('ahooks')['useClickAway']
|
|
24
|
+
const useContext: typeof import('react')['useContext']
|
|
25
|
+
const useControllableValue: typeof import('ahooks')['useControllableValue']
|
|
26
|
+
const useCookieState: typeof import('ahooks')['useCookieState']
|
|
27
|
+
const useCountDown: typeof import('ahooks')['useCountDown']
|
|
28
|
+
const useCounter: typeof import('ahooks')['useCounter']
|
|
29
|
+
const useCreation: typeof import('ahooks')['useCreation']
|
|
30
|
+
const useDebounce: typeof import('ahooks')['useDebounce']
|
|
31
|
+
const useDebounceEffect: typeof import('ahooks')['useDebounceEffect']
|
|
32
|
+
const useDebounceFn: typeof import('ahooks')['useDebounceFn']
|
|
33
|
+
const useDebugValue: typeof import('react')['useDebugValue']
|
|
34
|
+
const useDeepCompareEffect: typeof import('ahooks')['useDeepCompareEffect']
|
|
35
|
+
const useDeepCompareLayoutEffect: typeof import('ahooks')['useDeepCompareLayoutEffect']
|
|
36
|
+
const useDeferredValue: typeof import('react')['useDeferredValue']
|
|
37
|
+
const useDocumentVisibility: typeof import('ahooks')['useDocumentVisibility']
|
|
38
|
+
const useDrag: typeof import('ahooks')['useDrag']
|
|
39
|
+
const useDrop: typeof import('ahooks')['useDrop']
|
|
40
|
+
const useDynamicList: typeof import('ahooks')['useDynamicList']
|
|
41
|
+
const useEffect: typeof import('react')['useEffect']
|
|
42
|
+
const useEventEmitter: typeof import('ahooks')['useEventEmitter']
|
|
43
|
+
const useEventListener: typeof import('ahooks')['useEventListener']
|
|
44
|
+
const useEventTarget: typeof import('ahooks')['useEventTarget']
|
|
45
|
+
const useExternal: typeof import('ahooks')['useExternal']
|
|
46
|
+
const useFavicon: typeof import('ahooks')['useFavicon']
|
|
47
|
+
const useFocusWithin: typeof import('ahooks')['useFocusWithin']
|
|
48
|
+
const useFullscreen: typeof import('ahooks')['useFullscreen']
|
|
49
|
+
const useFusionTable: typeof import('ahooks')['useFusionTable']
|
|
50
|
+
const useGetState: typeof import('ahooks')['useGetState']
|
|
51
|
+
const useHistoryTravel: typeof import('ahooks')['useHistoryTravel']
|
|
52
|
+
const useHover: typeof import('ahooks')['useHover']
|
|
53
|
+
const useHref: typeof import('react-router-dom')['useHref']
|
|
54
|
+
const useId: typeof import('react')['useId']
|
|
55
|
+
const useImperativeHandle: typeof import('react')['useImperativeHandle']
|
|
56
|
+
const useInRouterContext: typeof import('react-router-dom')['useInRouterContext']
|
|
57
|
+
const useInViewport: typeof import('ahooks')['useInViewport']
|
|
58
|
+
const useInfiniteScroll: typeof import('ahooks')['useInfiniteScroll']
|
|
59
|
+
const useInsertionEffect: typeof import('react')['useInsertionEffect']
|
|
60
|
+
const useInterval: typeof import('ahooks')['useInterval']
|
|
61
|
+
const useIsomorphicLayoutEffect: typeof import('ahooks')['useIsomorphicLayoutEffect']
|
|
62
|
+
const useKeyPress: typeof import('ahooks')['useKeyPress']
|
|
63
|
+
const useLatest: typeof import('ahooks')['useLatest']
|
|
64
|
+
const useLayoutEffect: typeof import('react')['useLayoutEffect']
|
|
65
|
+
const useLinkClickHandler: typeof import('react-router-dom')['useLinkClickHandler']
|
|
66
|
+
const useLocalStorageState: typeof import('ahooks')['useLocalStorageState']
|
|
67
|
+
const useLocation: typeof import('react-router-dom')['useLocation']
|
|
68
|
+
const useLockFn: typeof import('ahooks')['useLockFn']
|
|
69
|
+
const useLongPress: typeof import('ahooks')['useLongPress']
|
|
70
|
+
const useMap: typeof import('ahooks')['useMap']
|
|
71
|
+
const useMemo: typeof import('react')['useMemo']
|
|
72
|
+
const useMemoizedFn: typeof import('ahooks')['useMemoizedFn']
|
|
73
|
+
const useMount: typeof import('ahooks')['useMount']
|
|
74
|
+
const useMouse: typeof import('ahooks')['useMouse']
|
|
75
|
+
const useMutationObserver: typeof import('ahooks')['useMutationObserver']
|
|
76
|
+
const useNavigate: typeof import('react-router-dom')['useNavigate']
|
|
77
|
+
const useNavigationType: typeof import('react-router-dom')['useNavigationType']
|
|
78
|
+
const useNetwork: typeof import('ahooks')['useNetwork']
|
|
79
|
+
const useOutlet: typeof import('react-router-dom')['useOutlet']
|
|
80
|
+
const useOutletContext: typeof import('react-router-dom')['useOutletContext']
|
|
81
|
+
const usePagination: typeof import('ahooks')['usePagination']
|
|
82
|
+
const useParams: typeof import('react-router-dom')['useParams']
|
|
83
|
+
const usePrevious: typeof import('ahooks')['usePrevious']
|
|
84
|
+
const useRafInterval: typeof import('ahooks')['useRafInterval']
|
|
85
|
+
const useRafState: typeof import('ahooks')['useRafState']
|
|
86
|
+
const useRafTimeout: typeof import('ahooks')['useRafTimeout']
|
|
87
|
+
const useReactive: typeof import('ahooks')['useReactive']
|
|
88
|
+
const useReducer: typeof import('react')['useReducer']
|
|
89
|
+
const useRef: typeof import('react')['useRef']
|
|
90
|
+
const useRequest: typeof import('ahooks')['useRequest']
|
|
91
|
+
const useResetState: typeof import('ahooks')['useResetState']
|
|
92
|
+
const useResolvedPath: typeof import('react-router-dom')['useResolvedPath']
|
|
93
|
+
const useResponsive: typeof import('ahooks')['useResponsive']
|
|
94
|
+
const useRoutes: typeof import('react-router-dom')['useRoutes']
|
|
95
|
+
const useSafeState: typeof import('ahooks')['useSafeState']
|
|
96
|
+
const useScroll: typeof import('ahooks')['useScroll']
|
|
97
|
+
const useSearchParams: typeof import('react-router-dom')['useSearchParams']
|
|
98
|
+
const useSelections: typeof import('ahooks')['useSelections']
|
|
99
|
+
const useSessionStorageState: typeof import('ahooks')['useSessionStorageState']
|
|
100
|
+
const useSet: typeof import('ahooks')['useSet']
|
|
101
|
+
const useSetState: typeof import('ahooks')['useSetState']
|
|
102
|
+
const useSize: typeof import('ahooks')['useSize']
|
|
103
|
+
const useState: typeof import('react')['useState']
|
|
104
|
+
const useSyncExternalStore: typeof import('react')['useSyncExternalStore']
|
|
105
|
+
const useTextSelection: typeof import('ahooks')['useTextSelection']
|
|
106
|
+
const useTheme: typeof import('ahooks')['useTheme']
|
|
107
|
+
const useThrottle: typeof import('ahooks')['useThrottle']
|
|
108
|
+
const useThrottleEffect: typeof import('ahooks')['useThrottleEffect']
|
|
109
|
+
const useThrottleFn: typeof import('ahooks')['useThrottleFn']
|
|
110
|
+
const useTimeout: typeof import('ahooks')['useTimeout']
|
|
111
|
+
const useTitle: typeof import('ahooks')['useTitle']
|
|
112
|
+
const useToggle: typeof import('ahooks')['useToggle']
|
|
113
|
+
const useTrackedEffect: typeof import('ahooks')['useTrackedEffect']
|
|
114
|
+
const useTransition: typeof import('react')['useTransition']
|
|
115
|
+
const useTranslation: typeof import('react-i18next')['useTranslation']
|
|
116
|
+
const useUnmount: typeof import('ahooks')['useUnmount']
|
|
117
|
+
const useUnmountedRef: typeof import('ahooks')['useUnmountedRef']
|
|
118
|
+
const useUpdate: typeof import('ahooks')['useUpdate']
|
|
119
|
+
const useUpdateEffect: typeof import('ahooks')['useUpdateEffect']
|
|
120
|
+
const useUpdateLayoutEffect: typeof import('ahooks')['useUpdateLayoutEffect']
|
|
121
|
+
const useVirtualList: typeof import('ahooks')['useVirtualList']
|
|
122
|
+
const useWebSocket: typeof import('ahooks')['useWebSocket']
|
|
123
|
+
const useWhyDidYouUpdate: typeof import('ahooks')['useWhyDidYouUpdate']
|
|
124
|
+
}
|
|
125
|
+
// for type re-export
|
|
126
|
+
declare global {
|
|
127
|
+
// @ts-ignore
|
|
128
|
+
export type { FC, ReactNode, ComponentType } from 'react'
|
|
129
|
+
import('react')
|
|
130
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import react from '@vitejs/plugin-react'
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {
|
|
5
|
+
setupAutoImport,
|
|
6
|
+
setupUnocss,
|
|
7
|
+
setupUnPluginIcon,
|
|
8
|
+
setupRemoveConsole,
|
|
9
|
+
Inspect,
|
|
10
|
+
include,
|
|
11
|
+
} from '@vlian/sdk';
|
|
12
|
+
|
|
13
|
+
const api_url = 'http://127.0.0.1:9010/api';
|
|
14
|
+
|
|
15
|
+
// https://vite.dev/config/
|
|
16
|
+
export default defineConfig({
|
|
17
|
+
plugins: [
|
|
18
|
+
react(),
|
|
19
|
+
// 开发环境:打包检查工具(可选,需要 vite@^6.0.0)
|
|
20
|
+
// 注意:vite-plugin-inspect 在某些情况下可能不兼容,如遇错误请注释掉
|
|
21
|
+
Inspect(),
|
|
22
|
+
|
|
23
|
+
// 生产环境:移除 console
|
|
24
|
+
setupRemoveConsole(),
|
|
25
|
+
|
|
26
|
+
// 自动导入
|
|
27
|
+
setupAutoImport(),
|
|
28
|
+
|
|
29
|
+
// UnoCSS(需要指定本地图标路径)
|
|
30
|
+
setupUnocss(
|
|
31
|
+
path.join(process.cwd(), 'src/assets/svg-icon'),
|
|
32
|
+
{
|
|
33
|
+
// 覆盖 content 配置,扫描主应用代码
|
|
34
|
+
content: {
|
|
35
|
+
filesystem: ['./src/**/*.{tsx,ts,jsx,js}'],
|
|
36
|
+
},
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
|
|
40
|
+
// 图标插件(SVG 支持)
|
|
41
|
+
...setupUnPluginIcon(
|
|
42
|
+
path.join(process.cwd(), 'src/assets/svg-icon')
|
|
43
|
+
),
|
|
44
|
+
|
|
45
|
+
// 打包分析(可选,建议仅在需要时启用)
|
|
46
|
+
// setupBundleAnalyzer({
|
|
47
|
+
// filename: '../../dist/main/stats.html',
|
|
48
|
+
// open: true,
|
|
49
|
+
// }),
|
|
50
|
+
],
|
|
51
|
+
resolve: {
|
|
52
|
+
alias: {
|
|
53
|
+
'@': path.resolve(__dirname, './src'),
|
|
54
|
+
'@vlian/sdk/reset.css': path.resolve(__dirname, '../../packages/sdk/src/styles/reset.css'),
|
|
55
|
+
'@vlian/sdk/request': path.resolve(__dirname, '../../packages/sdk/src/request/index.ts'),
|
|
56
|
+
'@vlian/sdk': path.resolve(__dirname, '../../packages/sdk/src/index.ts'),
|
|
57
|
+
},
|
|
58
|
+
preserveSymlinks: false,
|
|
59
|
+
},
|
|
60
|
+
// 依赖优化
|
|
61
|
+
optimizeDeps: {
|
|
62
|
+
include: [...include],
|
|
63
|
+
exclude: ["@vlian/sdk", "@vlian/sdk/request"],
|
|
64
|
+
},
|
|
65
|
+
server: {
|
|
66
|
+
host: '127.0.0.1',
|
|
67
|
+
port: 5173,
|
|
68
|
+
open: true,
|
|
69
|
+
// cors: true,
|
|
70
|
+
proxy: {
|
|
71
|
+
'/api': {
|
|
72
|
+
target: api_url,
|
|
73
|
+
changeOrigin: true,
|
|
74
|
+
rewrite: (path: string) => {
|
|
75
|
+
return path.replace(/^\/api/, '');
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
build: {
|
|
81
|
+
outDir: '../../dist/core',
|
|
82
|
+
sourcemap: true,
|
|
83
|
+
// 确保 CSS 被提取到单独文件
|
|
84
|
+
cssCodeSplit: false,
|
|
85
|
+
},
|
|
86
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { defineConfig, globalIgnores } from 'eslint/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig([
|
|
9
|
+
globalIgnores(['dist']),
|
|
10
|
+
{
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
extends: [
|
|
13
|
+
js.configs.recommended,
|
|
14
|
+
tseslint.configs.recommended,
|
|
15
|
+
reactHooks.configs.flat.recommended,
|
|
16
|
+
reactRefresh.configs.vite,
|
|
17
|
+
],
|
|
18
|
+
languageOptions: {
|
|
19
|
+
ecmaVersion: 2020,
|
|
20
|
+
globals: globals.browser,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
])
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "secra-plugins-front",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"packageManager": "pnpm@9.12.3",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "turbo run build",
|
|
8
|
+
"dev": "turbo run dev",
|
|
9
|
+
"lint": "turbo run lint",
|
|
10
|
+
"test": "turbo run test",
|
|
11
|
+
"clean:node_modules": "find . -type d -name 'node_modules' -prune -exec rm -rf '{}' +"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@ant-design/icons": "^6.1.0",
|
|
15
|
+
"@vlian/framework": "^1.2.1",
|
|
16
|
+
"@vlian/infrastructure": "^0.9.11",
|
|
17
|
+
"@vlian/sdk": "workspace:*",
|
|
18
|
+
"ahooks": "^3.8.5",
|
|
19
|
+
"antd": "^5.29.3",
|
|
20
|
+
"i18next": "^25.7.4",
|
|
21
|
+
"immer": "^10.1.3",
|
|
22
|
+
"ky": "^1.14.2",
|
|
23
|
+
"lodash": "^4.17.21",
|
|
24
|
+
"react": "^19.2.0",
|
|
25
|
+
"react-dom": "^19.2.0",
|
|
26
|
+
"react-i18next": "^15.7.4",
|
|
27
|
+
"react-router-dom": "^7.8.2"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@eslint/js": "^9.39.1",
|
|
31
|
+
"@iconify/utils": "^3.1.0",
|
|
32
|
+
"@types/lodash": "^4.17.21",
|
|
33
|
+
"@types/node": "^24.10.1",
|
|
34
|
+
"@types/react": "^19.2.5",
|
|
35
|
+
"@types/react-dom": "^19.2.3",
|
|
36
|
+
"@unocss/core": "^66.6.0",
|
|
37
|
+
"@unocss/preset-attributify": "^66.6.0",
|
|
38
|
+
"@unocss/preset-icons": "^66.6.0",
|
|
39
|
+
"@unocss/preset-uno": "^66.6.0",
|
|
40
|
+
"@unocss/transformer-directives": "^66.6.0",
|
|
41
|
+
"@unocss/transformer-variant-group": "^66.6.0",
|
|
42
|
+
"@unocss/vite": "^66.6.0",
|
|
43
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
44
|
+
"eslint": "^9.39.1",
|
|
45
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
46
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
47
|
+
"globals": "^16.5.0",
|
|
48
|
+
"gogocode": "^1.0.53",
|
|
49
|
+
"rollup-plugin-visualizer": "^5.14.0",
|
|
50
|
+
"turbo": "^2.7.5",
|
|
51
|
+
"typescript": "~5.9.3",
|
|
52
|
+
"typescript-eslint": "^8.46.4",
|
|
53
|
+
"unplugin-auto-import": "^0.17.8",
|
|
54
|
+
"unplugin-icons": "^0.20.1",
|
|
55
|
+
"vite": "npm:rolldown-vite@7.2.5",
|
|
56
|
+
"vite-plugin-inspect": "^11.3.3",
|
|
57
|
+
"vite-plugin-remove-console": "^1.3.0",
|
|
58
|
+
"vite-plugin-svg-icons": "^2.0.1"
|
|
59
|
+
}
|
|
60
|
+
}
|