@wwchao6411/create-web-ui-template 0.1.0

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 (74) hide show
  1. package/README.md +54 -0
  2. package/dist/chunk-DRNPNIJR.js +131 -0
  3. package/dist/chunk-DRNPNIJR.js.map +1 -0
  4. package/dist/chunk-HDMQ6CVP.js +22 -0
  5. package/dist/chunk-HDMQ6CVP.js.map +1 -0
  6. package/dist/chunk-N6W5XQS6.js +24 -0
  7. package/dist/chunk-N6W5XQS6.js.map +1 -0
  8. package/dist/chunk-NOZ2FVZU.js +89 -0
  9. package/dist/chunk-NOZ2FVZU.js.map +1 -0
  10. package/dist/chunk-QKC3LLVR.js +81 -0
  11. package/dist/chunk-QKC3LLVR.js.map +1 -0
  12. package/dist/chunk-VKUDWI56.js +21 -0
  13. package/dist/chunk-VKUDWI56.js.map +1 -0
  14. package/dist/chunk-ZCLQAKLB.js +93 -0
  15. package/dist/chunk-ZCLQAKLB.js.map +1 -0
  16. package/dist/chunk-ZWYKFM47.js +21 -0
  17. package/dist/chunk-ZWYKFM47.js.map +1 -0
  18. package/dist/cli.d.ts +9 -0
  19. package/dist/cli.js +16 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/index.d.ts +9 -0
  22. package/dist/index.js +49 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/modes/standalone.d.ts +10 -0
  25. package/dist/modes/standalone.js +11 -0
  26. package/dist/modes/standalone.js.map +1 -0
  27. package/dist/modes/workspace.d.ts +10 -0
  28. package/dist/modes/workspace.js +11 -0
  29. package/dist/modes/workspace.js.map +1 -0
  30. package/dist/prompts.d.ts +20 -0
  31. package/dist/prompts.js +9 -0
  32. package/dist/prompts.js.map +1 -0
  33. package/dist/render-template.d.ts +15 -0
  34. package/dist/render-template.js +10 -0
  35. package/dist/render-template.js.map +1 -0
  36. package/dist/transforms/apply-feature-flags.d.ts +5 -0
  37. package/dist/transforms/apply-feature-flags.js +7 -0
  38. package/dist/transforms/apply-feature-flags.js.map +1 -0
  39. package/dist/transforms/replace-tokens.d.ts +5 -0
  40. package/dist/transforms/replace-tokens.js +7 -0
  41. package/dist/transforms/replace-tokens.js.map +1 -0
  42. package/dist/transforms/write-package-manager-notes.d.ts +5 -0
  43. package/dist/transforms/write-package-manager-notes.js +7 -0
  44. package/dist/transforms/write-package-manager-notes.js.map +1 -0
  45. package/package.json +37 -0
  46. package/templates/web-ui-template/README.md +44 -0
  47. package/templates/web-ui-template/config/template.config.json +11 -0
  48. package/templates/web-ui-template/electron/config/config-manager.ts +9 -0
  49. package/templates/web-ui-template/electron/forwarding/forwarding-manager.ts +9 -0
  50. package/templates/web-ui-template/electron/ipc/index.ts +4 -0
  51. package/templates/web-ui-template/electron/main/index.ts +10 -0
  52. package/templates/web-ui-template/electron/preload/index.ts +7 -0
  53. package/templates/web-ui-template/electron.vite.config.ts +50 -0
  54. package/templates/web-ui-template/index.html +12 -0
  55. package/templates/web-ui-template/package.json +38 -0
  56. package/templates/web-ui-template/public/.gitkeep +1 -0
  57. package/templates/web-ui-template/scripts/post-create.mjs +1 -0
  58. package/templates/web-ui-template/src/app/App.vue +38 -0
  59. package/templates/web-ui-template/src/app/app.scss +8 -0
  60. package/templates/web-ui-template/src/app/main.ts +24 -0
  61. package/templates/web-ui-template/src/app/tailwind.css +1 -0
  62. package/templates/web-ui-template/src/business/HomePage.vue +18 -0
  63. package/templates/web-ui-template/src/business/LoginPage.vue +17 -0
  64. package/templates/web-ui-template/src/business/PreviewMicroAppPage.vue +15 -0
  65. package/templates/web-ui-template/src/business/WorkspacePage.vue +22 -0
  66. package/templates/web-ui-template/src/business/apps.ts +12 -0
  67. package/templates/web-ui-template/src/business/menu.ts +23 -0
  68. package/templates/web-ui-template/src/business/permissions.ts +1 -0
  69. package/templates/web-ui-template/src/platform/create-platform.ts +29 -0
  70. package/templates/web-ui-template/src/platform/register-microapps.ts +8 -0
  71. package/templates/web-ui-template/src/platform/register-routes.ts +32 -0
  72. package/templates/web-ui-template/src/shared/config.ts +28 -0
  73. package/templates/web-ui-template/tsconfig.json +13 -0
  74. package/templates/web-ui-template/vite.config.ts +22 -0
@@ -0,0 +1,22 @@
1
+ <script setup lang="ts">
2
+ import { PlatformWorkspacePage } from "@wwchao6411/platform-shell-ui/vue";
3
+ import { RouterLink } from "vue-router";
4
+ </script>
5
+
6
+ <template>
7
+ <PlatformWorkspacePage
8
+ eyebrow="workspace"
9
+ :title="`${'__PROJECT_NAME__'} Workspace`"
10
+ description="The generated shell starts with a single launch surface that can grow into your business workspace."
11
+ >
12
+ <template #launcher>
13
+ <RouterLink
14
+ class="rounded-3xl border border-white/10 bg-slate-950/60 px-5 py-4 text-left transition hover:border-cyan-300/40 hover:bg-slate-900/80"
15
+ to="/workspace/sample-microapp"
16
+ >
17
+ <p class="text-sm font-semibold text-white">Sample MicroApp</p>
18
+ <p class="mt-2 text-xs text-slate-400">/workspace/sample-microapp</p>
19
+ </RouterLink>
20
+ </template>
21
+ </PlatformWorkspacePage>
22
+ </template>
@@ -0,0 +1,12 @@
1
+ import type { PlatformAppDefinition } from "@wwchao6411/platform-shell-core";
2
+
3
+ import { templateRuntimeConfig } from "../shared/config";
4
+
5
+ export const templateApps: PlatformAppDefinition[] = [
6
+ {
7
+ code: "sample-microapp",
8
+ title: "Sample MicroApp",
9
+ entryUrl: "/workspace/sample-microapp",
10
+ openMode: templateRuntimeConfig.features.microapp ? "micro-app" : "auto"
11
+ }
12
+ ];
@@ -0,0 +1,23 @@
1
+ export interface TemplateMenuItem {
2
+ label: string;
3
+ to: string;
4
+ }
5
+
6
+ export const templateMenuItems: TemplateMenuItem[] = [
7
+ {
8
+ label: "Home",
9
+ to: "/"
10
+ },
11
+ {
12
+ label: "Login",
13
+ to: "/login"
14
+ },
15
+ {
16
+ label: "Workspace",
17
+ to: "/workspace"
18
+ },
19
+ {
20
+ label: "Sample MicroApp",
21
+ to: "/workspace/sample-microapp"
22
+ }
23
+ ];
@@ -0,0 +1 @@
1
+ export const templatePermissions = ["workspace.view", "workspace.launch", "workspace.configure"];
@@ -0,0 +1,29 @@
1
+ import { createPlatformContext } from "@wwchao6411/platform-shell-core";
2
+ import { createVueWebPreset } from "@wwchao6411/platform-shell-presets";
3
+
4
+ import { templateApps } from "../business/apps";
5
+ import { templateRuntimeConfig } from "../shared/config";
6
+ import { registerTemplateMicroApps } from "./register-microapps";
7
+
8
+ export interface TemplatePlatformDescriptor {
9
+ presetName: string;
10
+ runtime: "web";
11
+ appCodes: string[];
12
+ microApps: string[];
13
+ }
14
+
15
+ // 创建模板默认平台描述。
16
+ export function createTemplatePlatform(): TemplatePlatformDescriptor {
17
+ const preset = createVueWebPreset();
18
+ const platformContext = createPlatformContext({
19
+ apps: templateApps,
20
+ getConfig: () => templateRuntimeConfig
21
+ });
22
+
23
+ return {
24
+ presetName: preset.name,
25
+ runtime: preset.runtime,
26
+ appCodes: platformContext.apps.map((app) => app.code),
27
+ microApps: registerTemplateMicroApps().map((app) => app.code)
28
+ };
29
+ }
@@ -0,0 +1,8 @@
1
+ import type { PlatformAppDefinition } from "@wwchao6411/platform-shell-core";
2
+
3
+ import { templateApps } from "../business/apps";
4
+
5
+ // 提取模板中的微前端应用定义。
6
+ export function registerTemplateMicroApps(): PlatformAppDefinition[] {
7
+ return templateApps.filter((app) => app.openMode === "micro-app");
8
+ }
@@ -0,0 +1,32 @@
1
+ import type { RouteRecordRaw } from "vue-router";
2
+
3
+ import HomePage from "../business/HomePage.vue";
4
+ import LoginPage from "../business/LoginPage.vue";
5
+ import PreviewMicroAppPage from "../business/PreviewMicroAppPage.vue";
6
+ import WorkspacePage from "../business/WorkspacePage.vue";
7
+
8
+ // 注册模板默认路由,提供首页、登录页和工作区入口。
9
+ export function registerTemplateRoutes(): RouteRecordRaw[] {
10
+ return [
11
+ {
12
+ path: "/",
13
+ name: "home",
14
+ component: HomePage
15
+ },
16
+ {
17
+ path: "/login",
18
+ name: "login",
19
+ component: LoginPage
20
+ },
21
+ {
22
+ path: "/workspace",
23
+ name: "workspace",
24
+ component: WorkspacePage
25
+ },
26
+ {
27
+ path: "/workspace/sample-microapp",
28
+ name: "sample-microapp",
29
+ component: PreviewMicroAppPage
30
+ }
31
+ ];
32
+ }
@@ -0,0 +1,28 @@
1
+ export interface TemplateRuntimeConfig {
2
+ projectName: string;
3
+ packageManager: string;
4
+ features: {
5
+ desktop: boolean;
6
+ microapp: boolean;
7
+ chromeTabs: boolean;
8
+ auth: boolean;
9
+ sshForwarding: boolean;
10
+ };
11
+ }
12
+
13
+ // 解析模板中的布尔占位符,便于 CLI 渲染前后复用同一份源码。
14
+ function resolveBooleanToken(token: string): boolean {
15
+ return token === "true";
16
+ }
17
+
18
+ export const templateRuntimeConfig: TemplateRuntimeConfig = {
19
+ projectName: "__PROJECT_NAME__",
20
+ packageManager: "__PACKAGE_MANAGER__",
21
+ features: {
22
+ desktop: resolveBooleanToken("__ENABLE_DESKTOP__"),
23
+ microapp: resolveBooleanToken("__ENABLE_MICROAPP__"),
24
+ chromeTabs: resolveBooleanToken("__ENABLE_CHROME_TABS__"),
25
+ auth: resolveBooleanToken("__ENABLE_AUTH__"),
26
+ sshForwarding: resolveBooleanToken("__ENABLE_SSH_FORWARDING__")
27
+ }
28
+ };
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@wwchao6411/configs/tsconfig/vue-app.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "."
5
+ },
6
+ "include": [
7
+ "src/**/*.ts",
8
+ "src/**/*.vue",
9
+ "electron/**/*.ts",
10
+ "vite.config.ts",
11
+ "electron.vite.config.ts"
12
+ ]
13
+ }
@@ -0,0 +1,22 @@
1
+ import tailwindcss from "@tailwindcss/vite";
2
+ import { defineConfig, mergeConfig } from "vite";
3
+ import tsconfigPaths from "vite-tsconfig-paths";
4
+ import vue from "@vitejs/plugin-vue";
5
+
6
+ import { createBaseViteConfig } from "@wwchao6411/configs/vite/base.mjs";
7
+
8
+ export default defineConfig(
9
+ mergeConfig(createBaseViteConfig(__dirname), {
10
+ plugins: [
11
+ tsconfigPaths(),
12
+ tailwindcss(),
13
+ vue({
14
+ template: {
15
+ compilerOptions: {
16
+ isCustomElement: (tag) => tag === "micro-app"
17
+ }
18
+ }
19
+ })
20
+ ]
21
+ })
22
+ );