2022-03-03 10:26:15 +00:00
|
|
|
{
|
2022-10-09 06:56:33 +00:00
|
|
|
"name": "@halo-dev/console",
|
2023-02-24 10:12:13 +00:00
|
|
|
"version": "2.3.0-rc.1",
|
2022-03-03 10:26:15 +00:00
|
|
|
"scripts": {
|
2022-03-04 06:57:42 +00:00
|
|
|
"prepare": "husky install",
|
2022-04-20 09:58:50 +00:00
|
|
|
"dev": "vite --host",
|
2022-03-03 10:26:15 +00:00
|
|
|
"build": "vue-tsc --noEmit && vite build",
|
2022-10-14 05:50:17 +00:00
|
|
|
"build:packages": "pnpm --filter \"./packages/**\" build",
|
2022-03-03 10:26:15 +00:00
|
|
|
"preview": "vite preview --port 5050",
|
2022-06-14 07:56:55 +00:00
|
|
|
"test:unit": "vitest --environment jsdom --run && pnpm run test:unit:packages",
|
2022-04-27 07:33:01 +00:00
|
|
|
"test:unit:watch": "vitest --environment jsdom --watch",
|
|
|
|
"test:unit:ui": "vitest --environment jsdom --watch --ui",
|
2022-03-21 06:17:22 +00:00
|
|
|
"test:unit:coverage": "vitest run --environment jsdom --coverage",
|
2022-03-03 10:26:15 +00:00
|
|
|
"test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'",
|
|
|
|
"test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'",
|
2022-06-14 07:56:55 +00:00
|
|
|
"typecheck": "vue-tsc --noEmit -p tsconfig.app.json --composite false && pnpm run typecheck:packages",
|
|
|
|
"lint": "eslint ./src --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore && pnpm run lint:packages",
|
|
|
|
"prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}' && pnpm run prettier:packages",
|
2022-10-14 05:50:17 +00:00
|
|
|
"typecheck:packages": "pnpm --parallel --filter \"./packages/**\" run typecheck",
|
|
|
|
"lint:packages": "pnpm --parallel --filter \"./packages/**\" lint",
|
|
|
|
"prettier:packages": "pnpm --parallel --filter \"./packages/**\" prettier",
|
|
|
|
"test:unit:packages": "pnpm --parallel --filter \"./packages/**\" run test:unit"
|
2022-03-03 10:26:15 +00:00
|
|
|
},
|
2022-12-13 15:38:48 +00:00
|
|
|
"lint-staged": {
|
|
|
|
"*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}": [
|
|
|
|
"prettier --write"
|
|
|
|
],
|
|
|
|
"*.{js,ts,vue,tsx,jsx}": [
|
|
|
|
"eslint --fix"
|
|
|
|
]
|
|
|
|
},
|
2022-06-14 07:56:55 +00:00
|
|
|
"workspaces": [
|
|
|
|
"packages/*"
|
|
|
|
],
|
2022-03-03 10:26:15 +00:00
|
|
|
"dependencies": {
|
2022-11-24 13:29:06 +00:00
|
|
|
"@emoji-mart/data": "^1.0.8",
|
|
|
|
"@formkit/core": "^1.0.0-beta.12",
|
|
|
|
"@formkit/i18n": "^1.0.0-beta.12",
|
|
|
|
"@formkit/inputs": "^1.0.0-beta.12",
|
|
|
|
"@formkit/themes": "^1.0.0-beta.12",
|
|
|
|
"@formkit/utils": "^1.0.0-beta.12",
|
2022-12-26 14:08:32 +00:00
|
|
|
"@formkit/validation": "1.0.0-beta.12",
|
2022-11-24 13:29:06 +00:00
|
|
|
"@formkit/vue": "^1.0.0-beta.12",
|
2023-02-17 06:30:13 +00:00
|
|
|
"@halo-dev/api-client": "workspace:*",
|
2022-06-17 06:12:15 +00:00
|
|
|
"@halo-dev/components": "workspace:*",
|
2022-10-10 07:50:18 +00:00
|
|
|
"@halo-dev/console-shared": "workspace:*",
|
2023-01-31 14:10:09 +00:00
|
|
|
"@halo-dev/richtext-editor": "0.0.0-alpha.19",
|
2023-02-22 08:00:12 +00:00
|
|
|
"@tanstack/vue-query": "^4.24.10",
|
2022-11-17 02:38:22 +00:00
|
|
|
"@tiptap/extension-character-count": "^2.0.0-beta.202",
|
2022-10-26 04:40:10 +00:00
|
|
|
"@uppy/core": "^3.0.4",
|
2022-11-17 02:38:22 +00:00
|
|
|
"@uppy/dashboard": "^3.2.0",
|
2022-10-26 04:40:10 +00:00
|
|
|
"@uppy/drag-drop": "^3.0.1",
|
|
|
|
"@uppy/file-input": "^3.0.1",
|
2022-11-17 02:38:22 +00:00
|
|
|
"@uppy/locales": "^3.0.4",
|
2022-10-26 04:40:10 +00:00
|
|
|
"@uppy/progress-bar": "^3.0.1",
|
|
|
|
"@uppy/status-bar": "^3.0.1",
|
|
|
|
"@uppy/vue": "^1.0.1",
|
|
|
|
"@uppy/xhr-upload": "^3.0.4",
|
2022-11-24 13:29:06 +00:00
|
|
|
"@vueuse/components": "^9.6.0",
|
|
|
|
"@vueuse/core": "^9.6.0",
|
|
|
|
"@vueuse/router": "^9.6.0",
|
|
|
|
"@vueuse/shared": "^9.6.0",
|
2022-07-13 07:36:21 +00:00
|
|
|
"axios": "^0.27.2",
|
2022-11-24 13:29:06 +00:00
|
|
|
"colorjs.io": "^0.4.2",
|
2022-10-26 07:32:13 +00:00
|
|
|
"dayjs": "^1.11.6",
|
2022-11-24 13:29:06 +00:00
|
|
|
"emoji-mart": "^5.3.3",
|
2023-02-01 02:50:10 +00:00
|
|
|
"fastq": "^1.15.0",
|
2022-09-09 11:04:04 +00:00
|
|
|
"floating-vue": "2.0.0-beta.20",
|
2022-09-28 06:50:16 +00:00
|
|
|
"fuse.js": "^6.6.2",
|
2022-05-27 09:28:25 +00:00
|
|
|
"lodash.clonedeep": "^4.5.0",
|
2022-11-30 07:21:47 +00:00
|
|
|
"lodash.debounce": "^4.0.8",
|
2022-07-15 08:26:27 +00:00
|
|
|
"lodash.isequal": "^4.5.0",
|
2022-09-22 08:46:32 +00:00
|
|
|
"lodash.merge": "^4.6.2",
|
refactor: router and menu generation (#651)
#### What type of PR is this?
/kind api-change
/kind improvement
/milestone 2.0
#### What this PR does / why we need it:
Ref https://github.com/halo-dev/halo/issues/2595
重构路由和侧边菜单生成的逻辑,**注意,此 PR 对插件的 Console 入口文件中的路由和菜单定义包含破坏性更新。**
1. 移除 `definePlugin` 方法的 `menus` 字段,改为在 route 的 meta 中定义。
2. 将 `RoutesMenu` 组件从 `@halo-dev/components` 包中移出。
3. 将 `BasicLayout` 组件从 `@halo-dev/console-shared` 包中移出。
定义路由的方式:
```ts
import { definePlugin } from "@halo-dev/console-shared";
import BasicLayout from "@/layouts/BasicLayout.vue";
import AttachmentList from "./AttachmentList.vue";
import AttachmentSelectorModal from "./components/AttachmentSelectorModal.vue";
import { IconFolder } from "@halo-dev/components";
import { markRaw } from "vue";
export default definePlugin({
name: "attachmentModule",
components: [AttachmentSelectorModal],
routes: [
{
path: "/attachments",
component: BasicLayout,
children: [
{
path: "",
name: "Attachments",
component: AttachmentList,
meta: {
title: "附件",
permissions: ["system:attachments:view"],
menu: {
name: "附件",
group: "内容",
icon: markRaw(IconFolder),
priority: 4,
mobile: true,
},
},
},
],
},
],
});
```
menu 字段类型:
```ts
interface RouteMeta {
title?: string;
searchable?: boolean;
permissions?: string[];
menu?: {
name: string;
group?: string;
icon?: Component;
priority: number;
mobile?: true;
};
}
```
插件适配需要做的改动:
1. 移除 `definePlugin` 中的 menus 字段。
2. 在需要添加到菜单的 route 中提供 `meta.menu` 对象,可参考上方的 menu 字段类型。
详细文档可查阅:https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation
todolist:
- [x] 完善预设的菜单分组定义。
- [x] 绑定权限,根据权限决定是否需要将路由添加到菜单。
- [x] 优化菜单排序的定义方式。
#### Which issue(s) this PR fixes:
Fixes https://github.com/halo-dev/halo/issues/2595
#### Special notes for your reviewer:
/cc @halo-dev/sig-halo-console
测试方式:
1. 需要 `pnpm build:packages`
2. 测试后台的菜单及路由是否有异常。
3. 新建角色测试路由和菜单对权限的绑定。
4. 按照 https://github.com/ruibaby/halo-console/tree/refactor/route-map-setting/docs/routes-generation 文档,创建插件,测试插件添加路由和菜单是否正常。
#### Does this PR introduce a user-facing change?
```release-note
重构路由和侧边菜单生成的逻辑。
```
2022-10-19 08:54:13 +00:00
|
|
|
"lodash.sortby": "^4.7.0",
|
2022-09-04 17:06:11 +00:00
|
|
|
"path-browserify": "^1.0.1",
|
2022-11-24 13:29:06 +00:00
|
|
|
"pinia": "^2.0.26",
|
2022-09-04 17:06:11 +00:00
|
|
|
"pretty-bytes": "^6.0.0",
|
2022-07-02 06:01:40 +00:00
|
|
|
"qs": "^6.11.0",
|
2023-01-30 06:52:11 +00:00
|
|
|
"transliteration": "^2.3.5",
|
2022-11-24 13:29:06 +00:00
|
|
|
"vue": "^3.2.45",
|
2023-02-24 11:01:47 +00:00
|
|
|
"vue-demi": "^0.13.11",
|
2022-05-27 09:28:25 +00:00
|
|
|
"vue-grid-layout": "3.0.0-beta1",
|
2023-02-21 05:16:10 +00:00
|
|
|
"vue-i18n": "^9.2.2",
|
2022-10-26 07:32:13 +00:00
|
|
|
"vue-router": "^4.1.6",
|
2022-12-26 10:36:32 +00:00
|
|
|
"vuedraggable": "^4.1.0"
|
2022-03-03 10:26:15 +00:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2022-11-17 02:38:22 +00:00
|
|
|
"@changesets/cli": "^2.25.2",
|
2022-11-24 13:29:06 +00:00
|
|
|
"@iconify-json/mdi": "^1.1.36",
|
2022-10-26 07:32:13 +00:00
|
|
|
"@iconify-json/vscode-icons": "^1.1.16",
|
2022-09-20 03:33:03 +00:00
|
|
|
"@rushstack/eslint-patch": "^1.2.0",
|
2022-09-09 11:04:04 +00:00
|
|
|
"@tailwindcss/aspect-ratio": "^0.4.2",
|
2022-11-30 14:51:49 +00:00
|
|
|
"@tailwindcss/container-queries": "^0.1.0",
|
2022-11-17 02:38:22 +00:00
|
|
|
"@types/jsdom": "^20.0.1",
|
2022-06-16 07:02:32 +00:00
|
|
|
"@types/lodash.clonedeep": "4.5.7",
|
2022-11-30 07:21:47 +00:00
|
|
|
"@types/lodash.debounce": "^4.0.7",
|
2022-07-19 07:41:39 +00:00
|
|
|
"@types/lodash.isequal": "^4.5.6",
|
2022-09-22 08:46:32 +00:00
|
|
|
"@types/lodash.merge": "^4.6.7",
|
2022-11-17 02:38:22 +00:00
|
|
|
"@types/node": "^18.11.9",
|
2022-07-02 06:01:40 +00:00
|
|
|
"@types/qs": "^6.9.7",
|
2022-09-22 13:56:12 +00:00
|
|
|
"@types/randomstring": "^1.1.8",
|
2023-01-13 05:30:11 +00:00
|
|
|
"@vitejs/plugin-vue": "^4.0.0",
|
|
|
|
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
2022-11-24 13:29:06 +00:00
|
|
|
"@vitest/ui": "^0.25.3",
|
|
|
|
"@vue/compiler-sfc": "^3.2.45",
|
2022-03-03 10:26:15 +00:00
|
|
|
"@vue/eslint-config-prettier": "^7.0.0",
|
2022-09-23 10:08:21 +00:00
|
|
|
"@vue/eslint-config-typescript": "^11.0.2",
|
2022-11-24 13:29:06 +00:00
|
|
|
"@vue/test-utils": "^2.2.4",
|
2022-03-03 10:26:15 +00:00
|
|
|
"@vue/tsconfig": "^0.1.3",
|
2022-11-17 02:38:22 +00:00
|
|
|
"autoprefixer": "^10.4.13",
|
2022-07-25 08:26:26 +00:00
|
|
|
"c8": "^7.12.0",
|
2022-10-26 07:32:13 +00:00
|
|
|
"cypress": "^10.11.0",
|
2022-11-24 13:29:06 +00:00
|
|
|
"eslint": "^8.28.0",
|
2022-03-03 10:26:15 +00:00
|
|
|
"eslint-plugin-cypress": "^2.12.1",
|
2022-11-24 13:29:06 +00:00
|
|
|
"eslint-plugin-vue": "^9.8.0",
|
2022-11-17 02:38:22 +00:00
|
|
|
"husky": "^8.0.2",
|
2022-11-24 13:29:06 +00:00
|
|
|
"jsdom": "^20.0.3",
|
2022-12-13 15:38:48 +00:00
|
|
|
"lint-staged": "^13.1.0",
|
2022-11-17 02:38:22 +00:00
|
|
|
"postcss": "^8.4.19",
|
2022-11-24 13:29:06 +00:00
|
|
|
"prettier": "^2.8.0",
|
2022-07-30 03:41:40 +00:00
|
|
|
"prettier-plugin-tailwindcss": "^0.1.13",
|
2022-10-26 07:32:13 +00:00
|
|
|
"randomstring": "^1.2.3",
|
2022-11-17 02:38:22 +00:00
|
|
|
"sass": "^1.56.1",
|
2022-03-03 10:26:15 +00:00
|
|
|
"start-server-and-test": "^1.14.0",
|
2022-11-24 13:29:06 +00:00
|
|
|
"tailwindcss": "^3.2.4",
|
2022-05-23 07:16:23 +00:00
|
|
|
"tailwindcss-safe-area": "^0.2.2",
|
2022-09-20 03:33:03 +00:00
|
|
|
"tailwindcss-themer": "^2.0.2",
|
2022-06-23 03:51:03 +00:00
|
|
|
"typescript": "~4.7.4",
|
2022-11-24 13:29:06 +00:00
|
|
|
"unplugin-icons": "^0.14.14",
|
2023-01-13 05:30:11 +00:00
|
|
|
"vite": "^4.0.4",
|
2022-06-16 07:02:32 +00:00
|
|
|
"vite-compression-plugin": "^0.0.4",
|
2022-07-18 04:35:34 +00:00
|
|
|
"vite-plugin-externals": "^0.5.1",
|
2022-07-25 03:23:46 +00:00
|
|
|
"vite-plugin-html": "^3.2.0",
|
2022-11-17 02:38:22 +00:00
|
|
|
"vite-plugin-pwa": "^0.13.3",
|
|
|
|
"vite-plugin-static-copy": "^0.11.1",
|
2022-11-24 13:29:06 +00:00
|
|
|
"vitest": "^0.25.3",
|
2023-01-13 05:30:11 +00:00
|
|
|
"vue-tsc": "^1.0.24"
|
2022-03-03 10:26:15 +00:00
|
|
|
}
|
|
|
|
}
|