create-secra 0.1.11 → 1.0.2
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 +15 -5
- package/README.zh-CN.md +15 -4
- package/antd-adapter-template/README.md +24 -0
- package/antd-adapter-template/index.html +16 -0
- package/antd-adapter-template/package-lock.json +3420 -0
- package/antd-adapter-template/package.json +20 -47
- package/antd-adapter-template/src/app/App.tsx +7 -0
- package/antd-adapter-template/src/app/layouts/AppLayout.tsx +163 -0
- package/antd-adapter-template/src/app/router.ts +26 -0
- package/antd-adapter-template/src/app/routes/RouteTitleSync.tsx +26 -0
- package/antd-adapter-template/src/app/routes/dynamic-routes.ts +52 -0
- package/antd-adapter-template/src/app/routes/route-modules.ts +4 -0
- package/antd-adapter-template/src/app/routes/static-routes.tsx +110 -0
- package/antd-adapter-template/src/app/routes/types.ts +9 -0
- package/antd-adapter-template/src/features/auth/api/auth-api.ts +61 -0
- package/antd-adapter-template/src/features/auth/auth-store.ts +125 -0
- package/antd-adapter-template/src/features/auth/auth-types.ts +29 -0
- package/antd-adapter-template/src/features/auth/authorization.ts +46 -0
- package/antd-adapter-template/src/features/auth/use-auth.ts +10 -0
- package/antd-adapter-template/src/main.tsx +79 -0
- package/antd-adapter-template/src/pages/dashboard/DashboardPage.tsx +105 -0
- package/antd-adapter-template/src/pages/errors/ForbiddenPage.tsx +36 -0
- package/antd-adapter-template/src/pages/errors/NotFoundPage.tsx +36 -0
- package/antd-adapter-template/src/pages/home/HomePage.tsx +129 -0
- package/antd-adapter-template/src/pages/login/LoginPage.tsx +128 -0
- package/antd-adapter-template/src/pages/permission-test/PermissionTestPage.tsx +55 -0
- package/antd-adapter-template/src/pages/restricted/RestrictedDemoPage.tsx +17 -0
- package/antd-adapter-template/src/shared/kernel/app-kernel.ts +10 -0
- package/antd-adapter-template/src/shared/request/client.ts +46 -0
- package/antd-adapter-template/src/shared/request/contracts.ts +6 -0
- package/antd-adapter-template/src/shared/request/kv-adapter.ts +14 -0
- package/antd-adapter-template/src/shared/request/kv-backend.ts +244 -0
- package/antd-adapter-template/src/shared/request/ky-browser-stub.ts +6 -0
- package/antd-adapter-template/src/shared/request/undici-browser-stub.ts +4 -0
- package/antd-adapter-template/src/styles/global.css +185 -0
- package/antd-adapter-template/src/vite-env.d.ts +2 -0
- package/antd-adapter-template/tsconfig.app.json +10 -13
- package/antd-adapter-template/tsconfig.json +7 -2
- package/antd-adapter-template/tsconfig.node.json +6 -16
- package/antd-adapter-template/vite.config.ts +24 -0
- package/bin/index.mjs +32 -14
- package/package.json +2 -2
- package/{antd-adapter-template/apps/core → template}/index.html +2 -3
- package/template/package.json +14 -46
- package/template/src/App.tsx +48 -0
- package/template/src/main.tsx +36 -0
- package/template/src/styles.css +163 -0
- package/template/src/vite-env.d.ts +1 -0
- package/template/tsconfig.app.json +0 -5
- package/template/tsconfig.node.json +0 -5
- package/template/vite.config.ts +6 -0
- package/antd-adapter-template/apps/core/package.json +0 -18
- package/antd-adapter-template/apps/core/public/favicon.ico +0 -1
- package/antd-adapter-template/apps/core/public/favicon.svg +0 -1
- package/antd-adapter-template/apps/core/public/logo.svg +0 -1
- package/antd-adapter-template/apps/core/src/api/auth.ts +0 -49
- package/antd-adapter-template/apps/core/src/assets/react.svg +0 -1
- package/antd-adapter-template/apps/core/src/components/AntdGlobalProvider.tsx +0 -87
- package/antd-adapter-template/apps/core/src/components/AntdRootLayout.tsx +0 -10
- package/antd-adapter-template/apps/core/src/components/layout.tsx +0 -387
- package/antd-adapter-template/apps/core/src/guards/auth-route-guard.ts +0 -45
- package/antd-adapter-template/apps/core/src/main.tsx +0 -65
- package/antd-adapter-template/apps/core/src/pages/auth/components/account-login-fields.tsx +0 -60
- package/antd-adapter-template/apps/core/src/pages/auth/components/phone-login-fields.tsx +0 -60
- package/antd-adapter-template/apps/core/src/pages/auth/login.tsx +0 -169
- package/antd-adapter-template/apps/core/src/pages/index.tsx +0 -156
- package/antd-adapter-template/apps/core/src/router.ts +0 -42
- package/antd-adapter-template/apps/core/src/shims/use-sync-external-store-shim.ts +0 -3
- package/antd-adapter-template/apps/core/src/theme/theme.css +0 -48
- package/antd-adapter-template/apps/core/src/types/crypto-js.d.ts +0 -5
- package/antd-adapter-template/apps/core/src/utils/index.ts +0 -12
- package/antd-adapter-template/apps/core/src/utils/md5.ts +0 -6
- package/antd-adapter-template/apps/core/tsconfig.app.json +0 -11
- package/antd-adapter-template/apps/core/tsconfig.json +0 -13
- package/antd-adapter-template/apps/core/tsconfig.node.json +0 -7
- package/antd-adapter-template/apps/core/vite.config.ts +0 -118
- package/antd-adapter-template/eslint.config.js +0 -23
- package/antd-adapter-template/packages/sdk/.swcrc +0 -18
- package/antd-adapter-template/packages/sdk/package.json +0 -52
- package/antd-adapter-template/packages/sdk/src/build/index.ts +0 -28
- package/antd-adapter-template/packages/sdk/src/build/plugins/auto-import.ts +0 -46
- package/antd-adapter-template/packages/sdk/src/build/plugins/bundle-analyzer.ts +0 -33
- package/antd-adapter-template/packages/sdk/src/build/plugins/remove-console.ts +0 -23
- package/antd-adapter-template/packages/sdk/src/build/plugins/unocss.ts +0 -202
- package/antd-adapter-template/packages/sdk/src/build/plugins/unplugin-icon.ts +0 -43
- package/antd-adapter-template/packages/sdk/src/components/i18n-switch-dropdown.tsx +0 -139
- package/antd-adapter-template/packages/sdk/src/components/index.ts +0 -2
- package/antd-adapter-template/packages/sdk/src/components/theme-switch-dropdown.tsx +0 -131
- package/antd-adapter-template/packages/sdk/src/hooks/auth/core.ts +0 -101
- package/antd-adapter-template/packages/sdk/src/hooks/auth/index.ts +0 -139
- package/antd-adapter-template/packages/sdk/src/hooks/auth/with-auth.tsx +0 -41
- package/antd-adapter-template/packages/sdk/src/hooks/index.ts +0 -1
- package/antd-adapter-template/packages/sdk/src/i18n/index.ts +0 -150
- package/antd-adapter-template/packages/sdk/src/index.ts +0 -11
- package/antd-adapter-template/packages/sdk/src/request/index.ts +0 -436
- package/antd-adapter-template/packages/sdk/src/storage/README.md +0 -30
- package/antd-adapter-template/packages/sdk/src/storage/index.ts +0 -57
- package/antd-adapter-template/packages/sdk/src/styles/reset.css +0 -111
- package/antd-adapter-template/packages/sdk/src/theme/index.ts +0 -466
- package/antd-adapter-template/packages/sdk/tsconfig.json +0 -16
- package/antd-adapter-template/pnpm-workspace.yaml +0 -3
- package/antd-adapter-template/turbo.json +0 -17
- package/template/apps/core/index.html +0 -13
- package/template/apps/core/package.json +0 -18
- package/template/apps/core/public/favicon.ico +0 -1
- package/template/apps/core/public/favicon.svg +0 -1
- package/template/apps/core/public/logo.svg +0 -1
- package/template/apps/core/src/assets/react.svg +0 -1
- package/template/apps/core/src/main.tsx +0 -14
- package/template/apps/core/src/pages/index.tsx +0 -84
- package/template/apps/core/src/router.ts +0 -19
- package/template/apps/core/src/types/auto-imports.d.ts +0 -130
- package/template/apps/core/tsconfig.app.json +0 -7
- package/template/apps/core/tsconfig.json +0 -7
- package/template/apps/core/tsconfig.node.json +0 -7
- package/template/apps/core/vite.config.ts +0 -86
- package/template/eslint.config.js +0 -23
- package/template/packages/sdk/.swcrc +0 -18
- package/template/packages/sdk/package-lock.json +0 -1621
- package/template/packages/sdk/package.json +0 -32
- package/template/packages/sdk/src/build/index.ts +0 -33
- package/template/packages/sdk/src/build/plugins/auto-import.ts +0 -47
- package/template/packages/sdk/src/build/plugins/bundle-analyzer.ts +0 -35
- package/template/packages/sdk/src/build/plugins/remove-console.ts +0 -21
- package/template/packages/sdk/src/build/plugins/unocss.ts +0 -113
- package/template/packages/sdk/src/build/plugins/unplugin-icon.ts +0 -43
- package/template/packages/sdk/src/index.ts +0 -1
- package/template/packages/sdk/src/request/index.ts +0 -341
- package/template/packages/sdk/src/styles/reset.css +0 -111
- package/template/packages/sdk/tsconfig.json +0 -16
- package/template/pnpm-lock.yaml +0 -8055
- package/template/pnpm-workspace.yaml +0 -3
- package/template/turbo.json +0 -17
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# create-secra
|
|
2
2
|
|
|
3
|
-
Bootstrap a Secra frontend project from a built-in local template.
|
|
3
|
+
Bootstrap a minimal Secra frontend project from a built-in local template.
|
|
4
4
|
|
|
5
5
|
[中文文档](./README.zh-CN.md)
|
|
6
6
|
|
|
@@ -18,9 +18,14 @@ or
|
|
|
18
18
|
npm create secra@latest my-app
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## Built-in Templates
|
|
22
|
+
|
|
23
|
+
- `template/`: minimal `Vite + React + @vlian/framework` welcome page.
|
|
24
|
+
- `antd-adapter-template/`: Ant Design starter with the existing adapter example.
|
|
25
|
+
|
|
21
26
|
## Template Behavior
|
|
22
27
|
|
|
23
|
-
-
|
|
28
|
+
- You can choose between the two built-in templates in the interactive prompt.
|
|
24
29
|
- No git clone / degit is used.
|
|
25
30
|
- Template copy excludes these directories:
|
|
26
31
|
- `node_modules`
|
|
@@ -28,7 +33,6 @@ npm create secra@latest my-app
|
|
|
28
33
|
- `.turbo`
|
|
29
34
|
- `.git`
|
|
30
35
|
- The generated project's root `package.json` `name` is automatically updated from your target directory name.
|
|
31
|
-
- After scaffolding, dependencies are installed automatically with your detected package manager (`pnpm`/`yarn`/`bun`/`npm`).
|
|
32
36
|
|
|
33
37
|
## Override Template Source
|
|
34
38
|
|
|
@@ -38,7 +42,13 @@ You can temporarily point to another local template path:
|
|
|
38
42
|
SECRA_TEMPLATE=/absolute/path/to/template pnpm create secra my-app
|
|
39
43
|
```
|
|
40
44
|
|
|
41
|
-
Use the built-in
|
|
45
|
+
Use the built-in minimal template explicitly:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
SECRA_TEMPLATE_NAME=template pnpm create secra my-app
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Use the built-in antd adapter template explicitly:
|
|
42
52
|
|
|
43
53
|
```bash
|
|
44
54
|
SECRA_TEMPLATE_NAME=antd-adapter-template pnpm create secra my-app
|
|
@@ -46,7 +56,7 @@ SECRA_TEMPLATE_NAME=antd-adapter-template pnpm create secra my-app
|
|
|
46
56
|
|
|
47
57
|
## Maintain the Built-in Template
|
|
48
58
|
|
|
49
|
-
If you want to refresh `template/` from another project
|
|
59
|
+
If you want to refresh `template/` from another project, copy files with excludes:
|
|
50
60
|
|
|
51
61
|
```bash
|
|
52
62
|
rsync -a --delete \
|
package/README.zh-CN.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# create-secra
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于内置本地模板快速创建一个最简 Secra 前端项目。
|
|
4
4
|
|
|
5
5
|
[English README](./README.md)
|
|
6
6
|
|
|
@@ -18,9 +18,15 @@ pnpm create secra my-app
|
|
|
18
18
|
npm create secra@latest my-app
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
## 内置模板
|
|
22
|
+
|
|
23
|
+
- `template/`:最简 `Vite + React + @vlian/framework` 欢迎页模板。
|
|
24
|
+
- `antd-adapter-template/`:保留现有 Ant Design 适配版模板。
|
|
25
|
+
|
|
21
26
|
## Template 功能说明
|
|
22
27
|
|
|
23
28
|
- 默认模板来源:当前包内的 `template/` 目录。
|
|
29
|
+
- 交互模式下可在两个内置模板之间进行选择。
|
|
24
30
|
- 不使用 git clone / degit 拉取远程仓库。
|
|
25
31
|
- 复制模板时会自动排除以下目录:
|
|
26
32
|
- `node_modules`
|
|
@@ -28,7 +34,6 @@ npm create secra@latest my-app
|
|
|
28
34
|
- `.turbo`
|
|
29
35
|
- `.git`
|
|
30
36
|
- 创建项目时会根据目标目录名自动更新根目录 `package.json` 的 `name` 字段。
|
|
31
|
-
- 脚手架复制完成后,会自动根据当前环境识别包管理器并安装依赖(`pnpm`/`yarn`/`bun`/`npm`)。
|
|
32
37
|
|
|
33
38
|
## 临时覆盖模板目录
|
|
34
39
|
|
|
@@ -38,7 +43,13 @@ npm create secra@latest my-app
|
|
|
38
43
|
SECRA_TEMPLATE=/absolute/path/to/template pnpm create secra my-app
|
|
39
44
|
```
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
显式使用内置纯净模板:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
SECRA_TEMPLATE_NAME=template pnpm create secra my-app
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
显式使用内置 antd 模板:
|
|
42
53
|
|
|
43
54
|
```bash
|
|
44
55
|
SECRA_TEMPLATE_NAME=antd-adapter-template pnpm create secra my-app
|
|
@@ -46,7 +57,7 @@ SECRA_TEMPLATE_NAME=antd-adapter-template pnpm create secra my-app
|
|
|
46
57
|
|
|
47
58
|
## 维护内置模板
|
|
48
59
|
|
|
49
|
-
|
|
60
|
+
如果你想从其他项目更新 `template/`,可执行:
|
|
50
61
|
|
|
51
62
|
```bash
|
|
52
63
|
rsync -a --delete \
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Secra Antd Adapter Template
|
|
2
|
+
|
|
3
|
+
一个独立运行的 React + TypeScript + Ant Design 示例模板,演示:
|
|
4
|
+
|
|
5
|
+
- `@vlian/router` 静态路由 + 动态路由注入
|
|
6
|
+
- `@vlian/framework` 启动内核、日志与缓存能力
|
|
7
|
+
- `@vlian/logger` 日志输出
|
|
8
|
+
- `@vlian/request` 自定义 `kv` 适配器模拟接口
|
|
9
|
+
- `@vlian/utils` 的 `createStorage` 作为本地 KV 存储
|
|
10
|
+
|
|
11
|
+
## 启动
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm install
|
|
15
|
+
pnpm dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 默认账号
|
|
19
|
+
|
|
20
|
+
- `admin / admin123`
|
|
21
|
+
- `editor / editor123`
|
|
22
|
+
|
|
23
|
+
登录后可访问动态注入的 `/dashboard`,在“没有权限测试页”里可以模拟进入无权限资源并跳转到 `/403`。
|
|
24
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta
|
|
6
|
+
name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1.0"
|
|
8
|
+
/>
|
|
9
|
+
<title>Secra Antd Demo</title>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="root"></div>
|
|
13
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
16
|
+
|