展示

可删除的能力目录、组件画廊与实时演示。

“展示”是一个可删除的 demo layer:能力目录、shadcn/ui 组件画廊和互动 demos。 每一处均标为 [template-demo],所以你可以先预览没有它的产品,再删除示范代码。

内置内容

src/showcase/capability-catalog.ts26 个条目,分为五类:7 个 shell、6 个 system、 5 个 data、5 个 ops、3 个 commerce。每项都指向自身的 route 与 source files。 /showcase/components 是 live components gallery;/showcase/:demoIdDemoRoute.tsx 提供。

live demos 包含 window controls、tray lifecycle、notifications、shortcuts/palette、theme/i18n、 deep links、secure storage、backup/diagnostics、file dialogs、onboarding、native menus、updates 和 Todos integration slot。没有独立互动行为的 catalog entries 会显示 integration-slot panel。它们是 很好的 manual tests,而不是应该默认保留的应用页面。

一个 flag 控制所有界面

VITE_SHOWCASE_ENABLED 默认是 true,并列在 .env.example 中。将它设为 false 会移除 展示 routes、sidebar 模板区、首页 sections 和 command-palette group。它也会移除 native “模板”菜单,因为 Tauri menu/tray 由 TypeScript 构建并读取同一个 features object。这里没有 Electron 风格的 MAIN_VITE_* 对应值,也没有 frontend-to-Rust config push。

VITE_SHOWCASE_ENABLED=false

正确删除方式

安全预览最重要:它先证明删除 folders 前其余应用仍能正常工作。

关闭 flag,运行 pnpm dev,确认“模板”侧边栏区、展示 routes、palette group、native“模板”菜单和首页 sections 均已隐藏。

删除 demo-only folders。

rm -rf src/routes/showcase src/showcase

删除标记为 [template-demo] 的 touchpoints:src/App.tsx 的 Showcase imports/route block、sidebar group、command-sources.ts、HomePage、app-menu.ts/labels.ts、Showcase config/feature-flag plumbing、NAVIGATION_ROUTES 中的 /showcase*、Showcase locale registration,以及相关 tests/labels。若产品代码不再需要演示 key,也从 Rust SecureKey enum 删除 showcase-secret

删除 src/locales/en/showcase.jsonsrc/locales/zh/showcase.json,然后注册自己的 routes 与 Workspace sidebar entries。

审计并验证。

rg "template-demo"
pnpm format:check && pnpm lint:check && pnpm typecheck && pnpm test
cargo fmt --check --manifest-path src-tauri/Cargo.toml
cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings
cargo test --manifest-path src-tauri/Cargo.toml

On this page