chore: migrate to pnpm workspaces monorepo with Turborepo

- Restructure directories: apps/api, apps/admin, apps/website
- Add root pnpm-workspace.yaml, turbo.json, .prettierrc, .gitignore
- Rename packages to @inkreach/api, @inkreach/admin, @inkreach/website
- Add shared packages: packages/tsconfig, packages/shared-types
- Add pnpm.onlyBuiltDependencies for native builds
- Update docs: README.md, structs.md
- All three projects build successfully
This commit is contained in:
yeuimu
2026-07-11 16:54:05 +08:00
parent 69945b8749
commit 7e04877bb6
155 changed files with 20134 additions and 14393 deletions
+55
View File
@@ -0,0 +1,55 @@
import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const routes: RouteRecordRaw[] = [
{
path: '/login',
name: 'Login',
component: () => import('@/views/login/LoginView.vue'),
meta: { title: '登录', public: true },
},
{
path: '/',
component: () => import('@/layouts/DefaultLayout.vue'),
redirect: '/goods',
children: [
{
path: 'goods',
name: 'Goods',
component: () => import('@/views/product-management/ProductManagementView.vue'),
meta: { title: '商品管理' },
},
],
},
{
path: '/:pathMatch(.*)*',
redirect: '/goods',
},
]
const router = createRouter({
history: createWebHistory(),
routes,
})
router.beforeEach((to) => {
const authStore = useAuthStore()
const isPublic = to.meta?.public === true
if (!authStore.isLoggedIn && !isPublic) {
return { path: '/login', replace: true }
}
if (authStore.isLoggedIn && to.path === '/login') {
return { path: '/', replace: true }
}
return true
})
router.afterEach((to) => {
const title = (to.meta?.title as string) || 'Inkreach 官网后台'
document.title = `${title} | Inkreach 官网后台`
})
export default router