From 8c56093ee2dff03774bf9d0414280b532c74cbb4 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 2 Nov 2023 17:00:28 +0800 Subject: [PATCH 01/54] feat: build infrastructure for user center feature (#4806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area console /kind feature /milestone 2.11.x #### What this PR does / why we need it: 添加前端部分的个人中心的基础设施,将通过改造 Console 项目的结构实现对个人中心页面的隔离。意味着 Console 项目的意义将转变为 frontend,其中包含 Console 和 UC。 #### Special notes for your reviewer: 测试方式: 1. 启动最新的 Halo 后端。 2. 在 Console 目录运行 `pnpm dev`,可以观察到同时监听了 3000 和 4000 端口,分别代理原本的 /console 和新加的 /uc 3. 访问 /console 和 /uc。 4. 测试 `pnpm build`,完成之后检查主项目的 `src/main/resources` 目录是否包含 console 和 uc 目录。 5. 使用生产环境运行 Halo,访问 /console 和 /uc #### Does this PR introduce a user-facing change? ```release-note None ``` --- console/console-src/main.ts | 0 console/index.html | 2 +- console/package.json | 13 +- console/pnpm-lock.yaml | 439 +++++++++++++++--- console/src/vite/config-builder.ts | 78 ++++ .../src/{build => vite}/library-external.ts | 6 +- console/tailwind.config.js | 2 +- console/tsconfig.app.json | 13 +- console/tsconfig.node.json | 4 +- console/uc-src/App.vue | 19 + console/uc-src/main.ts | 8 + console/vite.config.ts | 72 +-- console/vite.uc.config.ts | 12 + console/vitest.config.ts | 14 +- 14 files changed, 550 insertions(+), 132 deletions(-) create mode 100644 console/console-src/main.ts create mode 100644 console/src/vite/config-builder.ts rename console/src/{build => vite}/library-external.ts (97%) create mode 100644 console/uc-src/App.vue create mode 100644 console/uc-src/main.ts create mode 100644 console/vite.uc.config.ts diff --git a/console/console-src/main.ts b/console/console-src/main.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/console/index.html b/console/index.html index 403ef083ca..09e081a7bd 100644 --- a/console/index.html +++ b/console/index.html @@ -52,6 +52,6 @@
- + diff --git a/console/package.json b/console/package.json index b84e5620af..bf9c8383cc 100644 --- a/console/package.json +++ b/console/package.json @@ -3,8 +3,12 @@ "version": "2.11.0", "scripts": { "prepare": "cd .. && husky install console/.husky", - "dev": "vite --host", - "build": "vue-tsc --noEmit && vite build", + "dev": "run-p dev:console dev:uc", + "dev:uc": "vite --host --config ./vite.uc.config.ts", + "dev:console": "vite --host --config ./vite.config.ts", + "build": "run-s build:console build:uc", + "build:uc": "vue-tsc --noEmit && vite build --config ./vite.uc.config.ts", + "build:console": "vue-tsc --noEmit && vite build --config ./vite.config.ts", "build:packages": "pnpm --filter \"./packages/**\" build", "preview": "vite preview --port 5050", "api-client:gen": "pnpm --filter \"./packages/api-client\" gen", @@ -15,8 +19,8 @@ "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'", "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 --max-warnings=0 && pnpm run lint:packages", - "prettier": "prettier --write './src/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}' && pnpm run prettier:packages", + "lint": "eslint './src' './console-src' './uc-src' --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore --max-warnings=0 && pnpm run lint:packages", + "prettier": "prettier --write './{src,uc-src,console-src}/**/*.{vue,js,jsx,ts,tsx,css,scss,json,yml,yaml,html}' && pnpm run prettier:packages", "typecheck:packages": "pnpm --parallel --filter \"./packages/**\" run typecheck", "lint:packages": "pnpm --parallel --filter \"./packages/**\" lint", "prettier:packages": "pnpm --parallel --filter \"./packages/**\" prettier", @@ -135,6 +139,7 @@ "husky": "^8.0.3", "jsdom": "^20.0.3", "lint-staged": "^13.2.2", + "npm-run-all": "^4.1.5", "postcss": "^8.4.21", "postcss-viewport-height-correction": "^1.1.1", "prettier": "^2.8.8", diff --git a/console/pnpm-lock.yaml b/console/pnpm-lock.yaml index ac964161ca..9053b3821d 100644 --- a/console/pnpm-lock.yaml +++ b/console/pnpm-lock.yaml @@ -303,6 +303,9 @@ importers: lint-staged: specifier: ^13.2.2 version: 13.2.2 + npm-run-all: + specifier: ^4.1.5 + version: 4.1.5 postcss: specifier: ^8.4.21 version: 8.4.21 @@ -4843,6 +4846,13 @@ packages: /argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + /array-buffer-byte-length@1.0.0: + resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==} + dependencies: + call-bind: 1.0.5 + is-array-buffer: 3.0.2 + dev: true + /array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} @@ -4858,11 +4868,24 @@ packages: engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.2 - define-properties: 1.1.4 - es-abstract: 1.20.3 + define-properties: 1.2.1 + es-abstract: 1.22.3 es-shim-unscopables: 1.0.0 dev: true + /arraybuffer.prototype.slice@1.0.2: + resolution: {integrity: sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + get-intrinsic: 1.2.2 + is-array-buffer: 3.0.2 + is-shared-array-buffer: 1.0.2 + dev: true + /arrify@1.0.1: resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} engines: {node: '>=0.10.0'} @@ -4920,6 +4943,11 @@ packages: postcss-value-parser: 4.2.0 dev: true + /available-typed-arrays@1.0.5: + resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} + engines: {node: '>= 0.4'} + dev: true + /aws-sign2@0.7.0: resolution: {integrity: sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==} dev: true @@ -5149,6 +5177,14 @@ packages: function-bind: 1.1.1 get-intrinsic: 1.1.3 + /call-bind@1.0.5: + resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} + dependencies: + function-bind: 1.1.2 + get-intrinsic: 1.2.2 + set-function-length: 1.1.1 + dev: true + /call-me-maybe@1.0.2: resolution: {integrity: sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==} dev: true @@ -5600,6 +5636,17 @@ packages: which: 1.3.1 dev: true + /cross-spawn@6.0.5: + resolution: {integrity: sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==} + engines: {node: '>=4.8'} + dependencies: + nice-try: 1.0.5 + path-key: 2.0.1 + semver: 5.7.1 + shebang-command: 1.2.0 + which: 1.3.1 + dev: true + /cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} engines: {node: '>= 8'} @@ -5852,10 +5899,20 @@ packages: clone: 1.0.4 dev: true - /define-properties@1.1.4: - resolution: {integrity: sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==} + /define-data-property@1.1.1: + resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} engines: {node: '>= 0.4'} dependencies: + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.0 + dev: true + + /define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 has-property-descriptors: 1.0.0 object-keys: 1.1.1 dev: true @@ -6071,34 +6128,49 @@ packages: is-arrayish: 0.2.1 dev: true - /es-abstract@1.20.3: - resolution: {integrity: sha512-AyrnaKVpMzljIdwjzrj+LxGmj8ik2LckwXacHqrJJ/jxz6dDDBcZ7I7nlHM0FvEW8MfbWJwOd+yT2XzYW49Frw==} + /es-abstract@1.22.3: + resolution: {integrity: sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + array-buffer-byte-length: 1.0.0 + arraybuffer.prototype.slice: 1.0.2 + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + es-set-tostringtag: 2.0.2 es-to-primitive: 1.2.1 - function-bind: 1.1.1 - function.prototype.name: 1.1.5 - get-intrinsic: 1.1.3 + function.prototype.name: 1.1.6 + get-intrinsic: 1.2.2 get-symbol-description: 1.0.0 - has: 1.0.3 + globalthis: 1.0.3 + gopd: 1.0.1 has-property-descriptors: 1.0.0 + has-proto: 1.0.1 has-symbols: 1.0.3 - internal-slot: 1.0.3 + hasown: 2.0.0 + internal-slot: 1.0.6 + is-array-buffer: 3.0.2 is-callable: 1.2.7 is-negative-zero: 2.0.2 is-regex: 1.1.4 is-shared-array-buffer: 1.0.2 is-string: 1.0.7 + is-typed-array: 1.1.12 is-weakref: 1.0.2 - object-inspect: 1.12.3 + object-inspect: 1.13.1 object-keys: 1.1.1 object.assign: 4.1.4 - regexp.prototype.flags: 1.4.3 + regexp.prototype.flags: 1.5.1 + safe-array-concat: 1.0.1 safe-regex-test: 1.0.0 - string.prototype.trimend: 1.0.5 - string.prototype.trimstart: 1.0.5 + string.prototype.trim: 1.2.8 + string.prototype.trimend: 1.0.7 + string.prototype.trimstart: 1.0.7 + typed-array-buffer: 1.0.0 + typed-array-byte-length: 1.0.0 + typed-array-byte-offset: 1.0.0 + typed-array-length: 1.0.4 unbox-primitive: 1.0.2 + which-typed-array: 1.1.13 dev: true /es-module-lexer@0.4.1: @@ -6109,6 +6181,15 @@ packages: resolution: {integrity: sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ==} dev: true + /es-set-tostringtag@2.0.2: + resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + has-tostringtag: 1.0.0 + hasown: 2.0.0 + dev: true + /es-shim-unscopables@1.0.0: resolution: {integrity: sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==} dependencies: @@ -7076,6 +7157,12 @@ packages: dependencies: debug: 4.3.2 + /for-each@0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + dependencies: + is-callable: 1.2.7 + dev: true + /foreground-child@2.0.0: resolution: {integrity: sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==} engines: {node: '>=8.0.0'} @@ -7190,13 +7277,17 @@ packages: /function-bind@1.1.1: resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} - /function.prototype.name@1.1.5: - resolution: {integrity: sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==} + /function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + dev: true + + /function.prototype.name@1.1.6: + resolution: {integrity: sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.1.4 - es-abstract: 1.20.3 + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 functions-have-names: 1.2.3 dev: true @@ -7229,6 +7320,15 @@ packages: has: 1.0.3 has-symbols: 1.0.3 + /get-intrinsic@1.2.2: + resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + dependencies: + function-bind: 1.1.2 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.0 + dev: true + /get-own-enumerable-property-symbols@3.0.2: resolution: {integrity: sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==} dev: true @@ -7254,8 +7354,8 @@ packages: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.1.3 + call-bind: 1.0.5 + get-intrinsic: 1.2.2 dev: true /getos@3.2.1: @@ -7337,6 +7437,13 @@ packages: type-fest: 0.20.2 dev: true + /globalthis@1.0.3: + resolution: {integrity: sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==} + engines: {node: '>= 0.4'} + dependencies: + define-properties: 1.2.1 + dev: true + /globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -7360,6 +7467,12 @@ packages: slash: 4.0.0 dev: true + /gopd@1.0.1: + resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + dependencies: + get-intrinsic: 1.2.2 + dev: true + /graceful-fs@4.2.10: resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} dev: true @@ -7421,6 +7534,11 @@ packages: get-intrinsic: 1.1.3 dev: true + /has-proto@1.0.1: + resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} + engines: {node: '>= 0.4'} + dev: true + /has-symbols@1.0.3: resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} engines: {node: '>= 0.4'} @@ -7438,6 +7556,13 @@ packages: dependencies: function-bind: 1.1.1 + /hasown@2.0.0: + resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} + engines: {node: '>= 0.4'} + dependencies: + function-bind: 1.1.2 + dev: true + /he@1.2.0: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true @@ -7705,15 +7830,23 @@ packages: through: 2.3.8 dev: true - /internal-slot@1.0.3: - resolution: {integrity: sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==} + /internal-slot@1.0.6: + resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} engines: {node: '>= 0.4'} dependencies: - get-intrinsic: 1.1.3 - has: 1.0.3 + get-intrinsic: 1.2.2 + hasown: 2.0.0 side-channel: 1.0.4 dev: true + /is-array-buffer@3.0.2: + resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + is-typed-array: 1.1.12 + dev: true + /is-arrayish@0.2.1: resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: true @@ -7738,7 +7871,7 @@ packages: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.5 has-tostringtag: 1.0.0 dev: true @@ -7873,7 +8006,7 @@ packages: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.5 has-tostringtag: 1.0.0 dev: true @@ -7889,7 +8022,7 @@ packages: /is-shared-array-buffer@1.0.2: resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.5 dev: true /is-stream@2.0.1: @@ -7923,6 +8056,13 @@ packages: has-symbols: 1.0.3 dev: true + /is-typed-array@1.1.12: + resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} + engines: {node: '>= 0.4'} + dependencies: + which-typed-array: 1.1.13 + dev: true + /is-typedarray@1.0.0: resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} dev: true @@ -7935,7 +8075,7 @@ packages: /is-weakref@1.0.2: resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.5 dev: true /is-windows@1.0.2: @@ -7947,6 +8087,10 @@ packages: resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} dev: true + /isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + dev: true + /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true @@ -8120,6 +8264,10 @@ packages: hasBin: true dev: true + /json-parse-better-errors@1.0.2: + resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} + dev: true + /json-parse-even-better-errors@2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} dev: true @@ -8328,6 +8476,16 @@ packages: wrap-ansi: 7.0.0 dev: true + /load-json-file@4.0.0: + resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} + engines: {node: '>=4'} + dependencies: + graceful-fs: 4.2.10 + parse-json: 4.0.0 + pify: 3.0.0 + strip-bom: 3.0.0 + dev: true + /load-yaml-file@0.2.0: resolution: {integrity: sha512-OfCBkGEw4nN6JLtgRidPX6QxjBQGQf72q3si2uvqyFEMbycSFFHwAZeXx6cJgFM9wmLrf9zBwCP3Ivqa+LLZPw==} engines: {node: '>=6'} @@ -8563,6 +8721,11 @@ packages: resolution: {integrity: sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==} dev: false + /memorystream@0.3.1: + resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} + engines: {node: '>= 0.10.0'} + dev: true + /meow@6.1.1: resolution: {integrity: sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg==} engines: {node: '>=8'} @@ -8787,6 +8950,10 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true + /nice-try@1.0.5: + resolution: {integrity: sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==} + dev: true + /no-case@3.0.4: resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} dependencies: @@ -8843,6 +9010,22 @@ packages: engines: {node: '>=0.10.0'} dev: true + /npm-run-all@4.1.5: + resolution: {integrity: sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==} + engines: {node: '>= 4'} + hasBin: true + dependencies: + ansi-styles: 3.2.1 + chalk: 2.4.2 + cross-spawn: 6.0.5 + memorystream: 0.3.1 + minimatch: 3.1.2 + pidtree: 0.3.1 + read-pkg: 3.0.0 + shell-quote: 1.8.1 + string.prototype.padend: 3.1.5 + dev: true + /npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -8878,6 +9061,10 @@ packages: /object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} + /object-inspect@1.13.1: + resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + dev: true + /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} engines: {node: '>= 0.4'} @@ -8887,8 +9074,8 @@ packages: resolution: {integrity: sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.1.4 + call-bind: 1.0.5 + define-properties: 1.2.1 has-symbols: 1.0.3 object-keys: 1.1.1 dev: true @@ -9093,6 +9280,14 @@ packages: resolution: {integrity: sha512-60zvsJReQPX5/QP0Kzfd/VrpjScIQ7SHBW6bFCYfEP+fp0Eppr1SHhIO5nd1PjZtvclzSzES9D/p5nFJurwfWg==} dev: true + /parse-json@4.0.0: + resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} + engines: {node: '>=4'} + dependencies: + error-ex: 1.3.2 + json-parse-better-errors: 1.0.2 + dev: true + /parse-json@5.2.0: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} @@ -9140,6 +9335,11 @@ packages: resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} + /path-key@2.0.1: + resolution: {integrity: sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==} + engines: {node: '>=4'} + dev: true + /path-key@3.1.1: resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} engines: {node: '>=8'} @@ -9157,6 +9357,13 @@ packages: resolution: {integrity: sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==} dev: true + /path-type@3.0.0: + resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==} + engines: {node: '>=4'} + dependencies: + pify: 3.0.0 + dev: true + /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -9203,6 +9410,12 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + /pidtree@0.3.1: + resolution: {integrity: sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==} + engines: {node: '>=0.10'} + hasBin: true + dev: true + /pidtree@0.6.0: resolution: {integrity: sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==} engines: {node: '>=0.10'} @@ -9213,6 +9426,11 @@ packages: resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} engines: {node: '>=0.10.0'} + /pify@3.0.0: + resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} + engines: {node: '>=4'} + dev: true + /pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} @@ -9681,6 +9899,15 @@ packages: type-fest: 0.8.1 dev: true + /read-pkg@3.0.0: + resolution: {integrity: sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==} + engines: {node: '>=4'} + dependencies: + load-json-file: 4.0.0 + normalize-package-data: 2.5.0 + path-type: 3.0.0 + dev: true + /read-pkg@5.2.0: resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} engines: {node: '>=8'} @@ -9760,13 +9987,13 @@ packages: '@babel/runtime': 7.19.0 dev: true - /regexp.prototype.flags@1.4.3: - resolution: {integrity: sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==} + /regexp.prototype.flags@1.5.1: + resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.1.4 - functions-have-names: 1.2.3 + call-bind: 1.0.5 + define-properties: 1.2.1 + set-function-name: 2.0.1 dev: true /regexpu-core@5.2.1: @@ -9982,6 +10209,16 @@ packages: mri: 1.2.0 dev: true + /safe-array-concat@1.0.1: + resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==} + engines: {node: '>=0.4'} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + has-symbols: 1.0.3 + isarray: 2.0.5 + dev: true + /safe-buffer@5.1.2: resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} dev: true @@ -9993,8 +10230,8 @@ packages: /safe-regex-test@1.0.0: resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==} dependencies: - call-bind: 1.0.2 - get-intrinsic: 1.1.3 + call-bind: 1.0.5 + get-intrinsic: 1.2.2 is-regex: 1.1.4 dev: true @@ -10093,6 +10330,25 @@ packages: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} dev: true + /set-function-length@1.1.1: + resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.0 + dev: true + + /set-function-name@2.0.1: + resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.0 + dev: true + /shallow-equal@1.2.1: resolution: {integrity: sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==} dev: false @@ -10121,6 +10377,10 @@ packages: engines: {node: '>=8'} dev: true + /shell-quote@1.8.1: + resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} + dev: true + /shiki@0.10.1: resolution: {integrity: sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==} dependencies: @@ -10390,30 +10650,48 @@ packages: /string.prototype.matchall@4.0.7: resolution: {integrity: sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg==} dependencies: - call-bind: 1.0.2 - define-properties: 1.1.4 - es-abstract: 1.20.3 - get-intrinsic: 1.1.3 + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + get-intrinsic: 1.2.2 has-symbols: 1.0.3 - internal-slot: 1.0.3 - regexp.prototype.flags: 1.4.3 + internal-slot: 1.0.6 + regexp.prototype.flags: 1.5.1 side-channel: 1.0.4 dev: true - /string.prototype.trimend@1.0.5: - resolution: {integrity: sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==} + /string.prototype.padend@3.1.5: + resolution: {integrity: sha512-DOB27b/2UTTD+4myKUFh+/fXWcu/UDyASIXfg+7VzoCNNGOfWvoyU/x5pvVHr++ztyt/oSYI1BcWBBG/hmlNjA==} + engines: {node: '>= 0.4'} dependencies: call-bind: 1.0.2 - define-properties: 1.1.4 - es-abstract: 1.20.3 + define-properties: 1.2.1 + es-abstract: 1.22.3 dev: true - /string.prototype.trimstart@1.0.5: - resolution: {integrity: sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==} + /string.prototype.trim@1.2.8: + resolution: {integrity: sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==} + engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 - define-properties: 1.1.4 - es-abstract: 1.20.3 + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /string.prototype.trimend@1.0.7: + resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + dev: true + + /string.prototype.trimstart@1.0.7: + resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 dev: true /string_decoder@1.1.1: @@ -10916,6 +11194,44 @@ packages: engines: {node: '>=12.20'} dev: false + /typed-array-buffer@1.0.0: + resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + is-typed-array: 1.1.12 + dev: true + + /typed-array-byte-length@1.0.0: + resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.12 + dev: true + + /typed-array-byte-offset@1.0.0: + resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.12 + dev: true + + /typed-array-length@1.0.4: + resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} + dependencies: + call-bind: 1.0.5 + for-each: 0.3.3 + is-typed-array: 1.1.12 + dev: true + /typedarray@0.0.6: resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==} dev: true @@ -10945,7 +11261,7 @@ packages: /unbox-primitive@1.0.2: resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.5 has-bigints: 1.0.2 has-symbols: 1.0.3 which-boxed-primitive: 1.0.2 @@ -11783,6 +12099,17 @@ packages: path-exists: 4.0.0 dev: true + /which-typed-array@1.1.13: + resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + dev: true + /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} hasBin: true diff --git a/console/src/vite/config-builder.ts b/console/src/vite/config-builder.ts new file mode 100644 index 0000000000..75e2c5a2b2 --- /dev/null +++ b/console/src/vite/config-builder.ts @@ -0,0 +1,78 @@ +import { fileURLToPath, URL } from "url"; +import fs from "fs"; +import { defineConfig, type Plugin } from "vite"; +import Vue from "@vitejs/plugin-vue"; +import VueJsx from "@vitejs/plugin-vue-jsx"; +import { VitePWA } from "vite-plugin-pwa"; +import Icons from "unplugin-icons/vite"; +import { setupLibraryExternal } from "./library-external"; +import GzipPlugin from "rollup-plugin-gzip"; + +interface Options { + base: string; + entryFile: string; + port: number; + outDir: string; + plugins?: Plugin[]; + mode: string; +} + +export const sharedPlugins = [ + Vue({ + script: { + defineModel: true, + }, + }), + VueJsx(), + GzipPlugin() as Plugin, + Icons({ + compiler: "vue3", + customCollections: { + core: { + logo: () => fs.readFileSync("./src/assets/logo.svg", "utf-8"), + }, + }, + }), + VitePWA({ + manifest: { + name: "Halo", + short_name: "Halo", + description: "Web Client For Halo", + theme_color: "#fff", + }, + disable: true, + }), +]; + +export function createViteConfig(options: Options) { + const isProduction = options.mode === "production"; + + const { base, entryFile, port, outDir, plugins } = options; + + return defineConfig({ + base, + plugins: [ + ...sharedPlugins, + ...setupLibraryExternal(isProduction, base, entryFile), + ...(plugins || []), + ], + resolve: { + alias: { + "@": fileURLToPath(new URL("/src", import.meta.url)), + "@console": fileURLToPath(new URL("/console-src", import.meta.url)), + "@uc": fileURLToPath(new URL("/uc-src", import.meta.url)), + }, + }, + server: { + port, + fs: { + strict: isProduction ? true : false, + }, + }, + build: { + outDir: fileURLToPath(new URL(outDir, import.meta.url)), + emptyOutDir: true, + chunkSizeWarningLimit: 2048, + }, + }); +} diff --git a/console/src/build/library-external.ts b/console/src/vite/library-external.ts similarity index 97% rename from console/src/build/library-external.ts rename to console/src/vite/library-external.ts index aa8468a246..8ef1b8bab5 100644 --- a/console/src/build/library-external.ts +++ b/console/src/vite/library-external.ts @@ -16,7 +16,8 @@ import type { HtmlTagDescriptor } from "vite"; */ export const setupLibraryExternal = ( isProduction: boolean, - baseUrl: string + baseUrl: string, + entry: string ) => { const staticSuffix = randomstring.generate({ length: 8, @@ -106,6 +107,9 @@ export const setupLibraryExternal = ( minify: false, inject: { tags: injectTags, + data: { + entry: entry, + }, }, }), ]; diff --git a/console/tailwind.config.js b/console/tailwind.config.js index 0ebcdf6324..9e030c7ad5 100644 --- a/console/tailwind.config.js +++ b/console/tailwind.config.js @@ -2,7 +2,7 @@ module.exports = { content: [ "./index.html", - "./src/**/*.{vue,js,ts,jsx,tsx}", + "./{src,uc-src,console-src}/**/*.{vue,js,ts,jsx,tsx}", "./packages/shared/src/**/*.{vue,js,ts,jsx,tsx}", ], theme: { diff --git a/console/tsconfig.app.json b/console/tsconfig.app.json index 9ea30c1f10..23d630a7e0 100644 --- a/console/tsconfig.app.json +++ b/console/tsconfig.app.json @@ -1,13 +1,20 @@ { "extends": "@vue/tsconfig/tsconfig.dom.json", - "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/**/*.json"], - "exclude": ["src/**/__tests__/*", "packages/**/*"], + "include": ["env.d.ts", "src/**/*", "uc-src/**/*", "console-src/**/*"], + "exclude": [ + "src/**/__tests__/*", + "uc-src/**/__tests__/*", + "console-src/**/__tests__/*", + "packages/**/*" + ], "compilerOptions": { "baseUrl": ".", "composite": true, "noImplicitAny": false, "paths": { - "@/*": ["./src/*"] + "@/*": ["./src/*"], + "@uc/*": ["./uc-src/*"], + "@console/*": ["./console-src/*"] }, "noStrictGenericChecks": true, "ignoreDeprecations": "5.0", diff --git a/console/tsconfig.node.json b/console/tsconfig.node.json index b90692f519..1395fc5145 100644 --- a/console/tsconfig.node.json +++ b/console/tsconfig.node.json @@ -2,9 +2,11 @@ "extends": "@tsconfig/node18/tsconfig.json", "include": [ "vite.config.*", + "vite.uc.config.ts", "vitest.config.*", "cypress.config.*", - "./src/build/library-external.ts" + "src/vite/library-external.ts", + "src/vite/config-builder.ts" ], "compilerOptions": { "composite": true, diff --git a/console/uc-src/App.vue b/console/uc-src/App.vue new file mode 100644 index 0000000000..bfaaeb994c --- /dev/null +++ b/console/uc-src/App.vue @@ -0,0 +1,19 @@ + + + diff --git a/console/uc-src/main.ts b/console/uc-src/main.ts new file mode 100644 index 0000000000..e9923af3db --- /dev/null +++ b/console/uc-src/main.ts @@ -0,0 +1,8 @@ +import { createApp } from "vue"; +import App from "./App.vue"; +import { setupVueQuery } from "@/setup/setupVueQuery"; + +const app = createApp(App); +setupVueQuery(app); + +app.mount("#app"); diff --git a/console/vite.config.ts b/console/vite.config.ts index 3c7ee2a79b..8ab903b718 100644 --- a/console/vite.config.ts +++ b/console/vite.config.ts @@ -1,72 +1,20 @@ -import { fileURLToPath, URL } from "url"; -import fs from "fs"; import path from "path"; -import { defineConfig, loadEnv, Plugin } from "vite"; -import Vue from "@vitejs/plugin-vue"; -import VueJsx from "@vitejs/plugin-vue-jsx"; -import { VitePWA } from "vite-plugin-pwa"; -import Icons from "unplugin-icons/vite"; -import { setupLibraryExternal } from "./src/build/library-external"; +import { loadEnv, Plugin } from "vite"; import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite"; -import GzipPlugin from "rollup-plugin-gzip"; - -export const sharedPlugins = [ - Vue({ - script: { - defineModel: true, - }, - }), - VueJsx(), - GzipPlugin() as Plugin, - Icons({ - compiler: "vue3", - customCollections: { - core: { - logo: () => fs.readFileSync("./src/assets/logo.svg", "utf-8"), - }, - }, - }), - VitePWA({ - manifest: { - name: "Halo", - short_name: "Halo", - description: "Web Client For Halo", - theme_color: "#fff", - }, - disable: true, - }), - VueI18nPlugin({ - include: [path.resolve(__dirname, "./src/locales/*.yaml")], - }), -]; +import { createViteConfig } from "./src/vite/config-builder"; export default ({ mode }: { mode: string }) => { const env = loadEnv(mode, process.cwd(), ""); - const isProduction = mode === "production"; - - return defineConfig({ + return createViteConfig({ base: env.VITE_BASE_URL, + entryFile: "/src/main.ts", + port: 3000, + outDir: path.resolve("../application/src/main/resources/console"), + mode, plugins: [ - ...sharedPlugins, - ...setupLibraryExternal(isProduction, env.VITE_BASE_URL), + VueI18nPlugin({ + include: [path.resolve(__dirname, "./src/locales/*.yaml")], + }) as Plugin, ], - resolve: { - alias: { - "@": fileURLToPath(new URL("./src", import.meta.url)), - }, - }, - server: { - port: 3000, - fs: { - strict: isProduction ? true : false, - }, - }, - build: { - outDir: fileURLToPath( - new URL("../application/src/main/resources/console", import.meta.url) - ), - emptyOutDir: true, - chunkSizeWarningLimit: 2048, - }, }); }; diff --git a/console/vite.uc.config.ts b/console/vite.uc.config.ts new file mode 100644 index 0000000000..12e45efff1 --- /dev/null +++ b/console/vite.uc.config.ts @@ -0,0 +1,12 @@ +import path from "path"; +import { createViteConfig } from "./src/vite/config-builder"; + +export default ({ mode }: { mode: string }) => { + return createViteConfig({ + base: "/uc/", + entryFile: "/uc-src/main.ts", + port: 4000, + outDir: path.resolve("../application/src/main/resources/uc"), + mode, + }); +}; diff --git a/console/vitest.config.ts b/console/vitest.config.ts index 11569d53e0..56c6aeacc9 100644 --- a/console/vitest.config.ts +++ b/console/vitest.config.ts @@ -1,13 +1,21 @@ import { defineConfig } from "vitest/config"; import { fileURLToPath, URL } from "url"; - -import { sharedPlugins } from "./vite.config"; +import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite"; +import { sharedPlugins } from "./src/vite/config-builder"; +import path from "path"; +import type { Plugin } from "vite"; export default defineConfig({ - plugins: [sharedPlugins], + plugins: [ + sharedPlugins, + VueI18nPlugin({ + include: [path.resolve(__dirname, "./src/locales/*.yaml")], + }) as Plugin, + ], resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)), + "@console": fileURLToPath(new URL("./console-src", import.meta.url)), }, }, test: { From 52d064381f0664b2da655470558ddca3b0ce16a5 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 9 Nov 2023 14:56:06 +0800 Subject: [PATCH 02/54] refactor: improve project structure for user center feature (#4839) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area console /kind improvement /milestone 2.11.x #### What this PR does / why we need it: 重构前端的目录结构,以便在后续让个人中心的代码支持复用部分代码。 https://github.com/ruibaby/halo/tree/refactor/file-structure/console/docs/project-structure #### Special notes for your reviewer: 测试方式: 1. 启动最新的 Halo 后端。 2. 在 Console 目录运行 `pnpm dev`,可以观察到同时监听了 3000 和 4000 端口,分别代理原本的 /console 和新加的 /uc 3. 访问 /console 和 /uc。 4. 测试 `pnpm build`,完成之后检查主项目的 `src/main/resources` 目录是否包含 console 和 uc 目录。 5. 使用生产环境运行 Halo,访问 /console 和 /uc #### Does this PR introduce a user-facing change? ```release-note None ``` --- console/{src => console-src}/App.vue | 8 +- .../composables/use-auto-save-content.ts | 0 .../composables/use-content-cache.ts | 0 .../composables/use-content-snapshot.ts | 0 .../use-editor-extension-points.ts | 0 .../use-entity-extension-points.ts | 0 .../composables/use-global-info.ts | 0 .../use-operation-extension-points.ts | 0 .../composables/use-save-keybinding.ts | 0 .../composables/use-setting-form.ts | 2 +- .../composables/use-slugify.ts | 0 .../layouts/BasicLayout.vue | 2 +- .../layouts/BlankLayout.vue | 0 console/console-src/main.ts | 113 ++++++++++++++++++ .../contents/_components/ContributorList.vue | 0 .../contents/attachments/AttachmentList.vue | 0 .../components/AttachmentDetailModal.vue | 0 .../AttachmentGroupEditingModal.vue | 0 .../components/AttachmentGroupList.vue | 0 .../components/AttachmentListItem.vue | 2 +- .../components/AttachmentPermalinkList.vue | 0 .../components/AttachmentPoliciesModal.vue | 0 .../AttachmentPolicyEditingModal.vue | 2 +- .../components/AttachmentSelectorModal.vue | 0 .../components/AttachmentUploadModal.vue | 0 .../CoreSelectorProvider.vue | 0 .../composables/use-attachment-group.ts | 0 .../composables/use-attachment-policy.ts | 0 .../attachments/composables/use-attachment.ts | 0 .../modules/contents/attachments/module.ts | 2 +- .../modules/contents/comments/CommentList.vue | 0 .../comments/components/CommentListItem.vue | 0 .../components/ReplyCreationModal.vue | 0 .../comments/components/ReplyListItem.vue | 0 .../modules/contents/comments/module.ts | 2 +- .../comments/widgets/CommentStatsWidget.vue | 0 .../contents/pages/DeletedSinglePageList.vue | 0 .../contents/pages/SinglePageEditor.vue | 10 +- .../modules/contents/pages/SinglePageList.vue | 0 .../pages/components/SinglePageListItem.vue | 0 .../components/SinglePageSettingModal.vue | 4 +- .../composables/use-page-update-mutate.ts | 0 .../modules/contents/pages/module.ts | 2 +- .../pages/widgets/SinglePageStatsWidget.vue | 0 .../contents/posts/DeletedPostList.vue | 0 .../modules/contents/posts/PostEditor.vue | 10 +- .../modules/contents/posts/PostList.vue | 0 .../posts/categories/CategoryList.vue | 0 .../components/CategoryEditingModal.vue | 4 +- .../components/CategoryListItem.vue | 0 .../__tests__/CategoryEditingModal.spec.ts | 0 .../composables/use-post-category.ts | 4 +- .../contents/posts/categories/utils/index.ts | 0 .../posts/components/PostListItem.vue | 4 +- .../posts/components/PostSettingModal.vue | 4 +- .../__tests__/PostSettingModal.spec.ts | 0 .../entity-fields/ContributorsField.vue | 2 +- .../entity-fields/PublishStatusField.vue | 0 .../components/entity-fields/TitleField.vue | 0 .../components/entity-fields/VisibleField.vue | 0 .../composables/use-post-update-mutate.ts | 0 .../modules/contents/posts/module.ts | 4 +- .../modules/contents/posts/tags/TagList.vue | 0 .../posts/tags/components/PostTag.vue | 0 .../posts/tags/components/TagEditingModal.vue | 2 +- .../posts/tags/composables/use-post-tag.ts | 0 .../posts/widgets/PostStatsWidget.vue | 0 .../posts/widgets/RecentPublishedWidget.vue | 0 .../modules/dashboard/Dashboard.vue | 0 .../modules/dashboard/module.ts | 2 +- .../dashboard/widgets/QuickLinkWidget.vue | 2 +- .../dashboard/widgets/ViewsStatsWidget.vue | 0 console/{src => console-src}/modules/index.ts | 0 .../modules/interface/menus/Menus.vue | 0 .../menus/components/MenuEditingModal.vue | 0 .../menus/components/MenuItemEditingModal.vue | 0 .../menus/components/MenuItemListItem.vue | 2 +- .../interface/menus/components/MenuList.vue | 0 .../modules/interface/menus/module.ts | 2 +- .../__snapshots__/index.spec.ts.snap | 0 .../menus/utils/__tests__/index.spec.ts | 0 .../modules/interface/menus/utils/index.ts | 0 .../modules/interface/themes/ThemeDetail.vue | 0 .../modules/interface/themes/ThemeSetting.vue | 2 +- .../themes/components/ThemeListItem.vue | 2 +- .../themes/components/ThemeListModal.vue | 0 .../components/list-tabs/InstalledThemes.vue | 2 +- .../components/list-tabs/LocalUpload.vue | 2 +- .../list-tabs/NotInstalledThemes.vue | 0 .../components/list-tabs/RemoteDownload.vue | 2 +- .../operation/MoreOperationItem.vue | 0 .../operation/UninstallOperationItem.vue | 0 .../preview/ThemePreviewListItem.vue | 0 .../components/preview/ThemePreviewModal.vue | 4 +- .../interface/themes/composables/use-theme.ts | 2 +- .../interface/themes/constants/index.ts | 0 .../interface/themes/layouts/ThemeLayout.vue | 4 +- .../modules/interface/themes/module.ts | 0 .../modules/interface/themes/types/index.ts | 0 .../modules/system/actuator/Actuator.vue | 0 .../modules/system/actuator/module.ts | 2 +- .../auth-providers/AuthProviderDetail.vue | 2 +- .../system/auth-providers/AuthProviders.vue | 0 .../components/AuthProviderListItem.vue | 0 .../modules/system/auth-providers/module.ts | 2 +- .../modules/system/backup/Backups.vue | 0 .../backup/components/BackupListItem.vue | 2 +- .../system/backup/composables/use-backup.ts | 0 .../modules/system/backup/module.ts | 2 +- .../modules/system/backup/tabs/List.vue | 0 .../modules/system/backup/tabs/Restore.vue | 0 .../modules/system/plugins/PluginDetail.vue | 0 .../modules/system/plugins/PluginList.vue | 0 .../components/PluginInstallationModal.vue | 0 .../plugins/components/PluginListItem.vue | 4 +- .../components/entity-fields/AuthorField.vue | 0 .../components/entity-fields/LogoField.vue | 0 .../components/entity-fields/SwitchField.vue | 0 .../installation-tabs/LocalUpload.vue | 0 .../installation-tabs/RemoteDownload.vue | 0 .../system/plugins/composables/use-plugin.ts | 0 .../modules/system/plugins/constants/index.ts | 0 .../modules/system/plugins/module.ts | 4 +- .../modules/system/plugins/tabs/Detail.vue | 0 .../modules/system/plugins/tabs/Setting.vue | 2 +- .../modules/system/plugins/types/index.ts | 0 .../modules/system/roles/RoleDetail.vue | 2 +- .../modules/system/roles/RoleList.vue | 2 +- .../roles/components/RoleEditingModal.vue | 2 +- .../system/roles/composables/use-role.ts | 0 .../modules/system/roles/module.ts | 2 +- .../system/settings/SystemSettings.vue | 0 .../modules/system/settings/module.ts | 2 +- .../settings/tabs/NotificationSetting.vue | 0 .../system/settings/tabs/Notifications.vue | 0 .../modules/system/settings/tabs/Setting.vue | 4 +- .../modules/system/users/Binding.vue | 4 +- .../modules/system/users/Login.vue | 2 +- .../modules/system/users/Notifications.vue | 0 .../modules/system/users/UserDetail.vue | 0 .../modules/system/users/UserList.vue | 0 .../users/components/GrantPermissionModal.vue | 0 .../users/components/NotificationContent.vue | 0 .../users/components/NotificationListItem.vue | 0 .../PersonalAccessTokenCreationModal.vue | 0 .../PersonalAccessTokenListItem.vue | 0 .../system/users/components/UserAvatar.vue | 0 .../users/components/UserAvatarCropper.vue | 0 .../users/components/UserCreationModal.vue | 0 .../users/components/UserEditingModal.vue | 0 .../components/UserPasswordChangeModal.vue | 0 .../system/users/composables/use-user.ts | 0 .../modules/system/users/module.ts | 4 +- .../modules/system/users/tabs/Detail.vue | 0 .../users/tabs/NotificationPreferences.vue | 0 .../users/tabs/PersonalAccessTokens.vue | 0 .../users/widgets/NotificationWidget.vue | 0 .../users/widgets/RecentLoginWidget.vue | 2 +- .../system/users/widgets/UserStatsWidget.vue | 0 .../router/guards/auth-check.ts | 0 .../router/guards/check-states.ts | 0 .../router/guards/permission.ts | 0 console/{src => console-src}/router/index.ts | 2 +- .../router/routes.config.ts | 12 +- .../stores/system-configmap.ts | 0 console/{src => console-src}/stores/theme.ts | 0 console/{src => console-src}/styles/index.css | 0 .../{src => console-src}/styles/tailwind.css | 0 .../views/exceptions/Forbidden.vue | 0 .../views/exceptions/NotFound.vue | 0 .../exceptions/__tests__/NotFound.spec.ts | 0 .../views/exceptions/components/Exception.vue | 0 .../views/system/Redirect.vue | 0 .../views/system/Setup.vue | 0 .../views/system/SetupInitialData.vue | 0 .../views/system/setup-data/category.json | 0 .../views/system/setup-data/menu-items.json | 0 .../views/system/setup-data/menu.json | 0 .../views/system/setup-data/post.json | 0 .../views/system/setup-data/singlePage.json | 0 .../views/system/setup-data/tag.json | 0 console/docs/project-structure/README.md | 61 ++++++++++ console/docs/routes-generation/README.md | 2 +- .../EditorProviderSelector.vue | 2 +- .../src/components/editor/DefaultEditor.vue | 6 +- .../filter/CategoryFilterDropdown.vue | 2 +- .../components/filter/TagFilterDropdown.vue | 4 +- .../components/filter/UserFilterDropdown.vue | 2 +- .../src/components/form/AnnotationsForm.vue | 2 +- .../global-search/GlobalSearchModal.vue | 2 +- .../components/login/SocialAuthProviders.vue | 2 +- .../inputs/attachment/AttachmentInput.vue | 2 +- .../inputs/category-select/CategorySelect.vue | 6 +- .../components/CategoryListItem.vue | 2 +- .../components/CategoryTag.vue | 4 +- .../components/SearchResultListItem.vue | 2 +- .../formkit/inputs/tag-select/TagSelect.vue | 4 +- .../plugins/stop-implicit-submission.ts | 2 +- console/src/main.ts | 113 ------------------ console/src/setup/setupModules.ts | 4 +- console/src/setup/setupStyles.ts | 4 +- console/src/utils/api-client.ts | 2 +- console/uc-src/main.ts | 16 ++- console/vite.config.ts | 2 +- console/vite.uc.config.ts | 7 ++ 205 files changed, 304 insertions(+), 222 deletions(-) rename console/{src => console-src}/App.vue (92%) rename console/{src => console-src}/composables/use-auto-save-content.ts (100%) rename console/{src => console-src}/composables/use-content-cache.ts (100%) rename console/{src => console-src}/composables/use-content-snapshot.ts (100%) rename console/{src => console-src}/composables/use-editor-extension-points.ts (100%) rename console/{src => console-src}/composables/use-entity-extension-points.ts (100%) rename console/{src => console-src}/composables/use-global-info.ts (100%) rename console/{src => console-src}/composables/use-operation-extension-points.ts (100%) rename console/{src => console-src}/composables/use-save-keybinding.ts (100%) rename console/{src => console-src}/composables/use-setting-form.ts (99%) rename console/{src => console-src}/composables/use-slugify.ts (100%) rename console/{src => console-src}/layouts/BasicLayout.vue (99%) rename console/{src => console-src}/layouts/BlankLayout.vue (100%) rename console/{src => console-src}/modules/contents/_components/ContributorList.vue (100%) rename console/{src => console-src}/modules/contents/attachments/AttachmentList.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentDetailModal.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentGroupEditingModal.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentGroupList.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentListItem.vue (98%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentPermalinkList.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentPoliciesModal.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue (98%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentSelectorModal.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/AttachmentUploadModal.vue (100%) rename console/{src => console-src}/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue (100%) rename console/{src => console-src}/modules/contents/attachments/composables/use-attachment-group.ts (100%) rename console/{src => console-src}/modules/contents/attachments/composables/use-attachment-policy.ts (100%) rename console/{src => console-src}/modules/contents/attachments/composables/use-attachment.ts (100%) rename console/{src => console-src}/modules/contents/attachments/module.ts (93%) rename console/{src => console-src}/modules/contents/comments/CommentList.vue (100%) rename console/{src => console-src}/modules/contents/comments/components/CommentListItem.vue (100%) rename console/{src => console-src}/modules/contents/comments/components/ReplyCreationModal.vue (100%) rename console/{src => console-src}/modules/contents/comments/components/ReplyListItem.vue (100%) rename console/{src => console-src}/modules/contents/comments/module.ts (93%) rename console/{src => console-src}/modules/contents/comments/widgets/CommentStatsWidget.vue (100%) rename console/{src => console-src}/modules/contents/pages/DeletedSinglePageList.vue (100%) rename console/{src => console-src}/modules/contents/pages/SinglePageEditor.vue (96%) rename console/{src => console-src}/modules/contents/pages/SinglePageList.vue (100%) rename console/{src => console-src}/modules/contents/pages/components/SinglePageListItem.vue (100%) rename console/{src => console-src}/modules/contents/pages/components/SinglePageSettingModal.vue (98%) rename console/{src => console-src}/modules/contents/pages/composables/use-page-update-mutate.ts (100%) rename console/{src => console-src}/modules/contents/pages/module.ts (96%) rename console/{src => console-src}/modules/contents/pages/widgets/SinglePageStatsWidget.vue (100%) rename console/{src => console-src}/modules/contents/posts/DeletedPostList.vue (100%) rename console/{src => console-src}/modules/contents/posts/PostEditor.vue (96%) rename console/{src => console-src}/modules/contents/posts/PostList.vue (100%) rename console/{src => console-src}/modules/contents/posts/categories/CategoryList.vue (100%) rename console/{src => console-src}/modules/contents/posts/categories/components/CategoryEditingModal.vue (98%) rename console/{src => console-src}/modules/contents/posts/categories/components/CategoryListItem.vue (100%) rename console/{src => console-src}/modules/contents/posts/categories/components/__tests__/CategoryEditingModal.spec.ts (100%) rename console/{src => console-src}/modules/contents/posts/categories/composables/use-post-category.ts (92%) rename console/{src => console-src}/modules/contents/posts/categories/utils/index.ts (100%) rename console/{src => console-src}/modules/contents/posts/components/PostListItem.vue (96%) rename console/{src => console-src}/modules/contents/posts/components/PostSettingModal.vue (98%) rename console/{src => console-src}/modules/contents/posts/components/__tests__/PostSettingModal.spec.ts (100%) rename console/{src => console-src}/modules/contents/posts/components/entity-fields/ContributorsField.vue (80%) rename console/{src => console-src}/modules/contents/posts/components/entity-fields/PublishStatusField.vue (100%) rename console/{src => console-src}/modules/contents/posts/components/entity-fields/TitleField.vue (100%) rename console/{src => console-src}/modules/contents/posts/components/entity-fields/VisibleField.vue (100%) rename console/{src => console-src}/modules/contents/posts/composables/use-post-update-mutate.ts (100%) rename console/{src => console-src}/modules/contents/posts/module.ts (95%) rename console/{src => console-src}/modules/contents/posts/tags/TagList.vue (100%) rename console/{src => console-src}/modules/contents/posts/tags/components/PostTag.vue (100%) rename console/{src => console-src}/modules/contents/posts/tags/components/TagEditingModal.vue (99%) rename console/{src => console-src}/modules/contents/posts/tags/composables/use-post-tag.ts (100%) rename console/{src => console-src}/modules/contents/posts/widgets/PostStatsWidget.vue (100%) rename console/{src => console-src}/modules/contents/posts/widgets/RecentPublishedWidget.vue (100%) rename console/{src => console-src}/modules/dashboard/Dashboard.vue (100%) rename console/{src => console-src}/modules/dashboard/module.ts (94%) rename console/{src => console-src}/modules/dashboard/widgets/QuickLinkWidget.vue (98%) rename console/{src => console-src}/modules/dashboard/widgets/ViewsStatsWidget.vue (100%) rename console/{src => console-src}/modules/index.ts (100%) rename console/{src => console-src}/modules/interface/menus/Menus.vue (100%) rename console/{src => console-src}/modules/interface/menus/components/MenuEditingModal.vue (100%) rename console/{src => console-src}/modules/interface/menus/components/MenuItemEditingModal.vue (100%) rename console/{src => console-src}/modules/interface/menus/components/MenuItemListItem.vue (98%) rename console/{src => console-src}/modules/interface/menus/components/MenuList.vue (100%) rename console/{src => console-src}/modules/interface/menus/module.ts (92%) rename console/{src => console-src}/modules/interface/menus/utils/__tests__/__snapshots__/index.spec.ts.snap (100%) rename console/{src => console-src}/modules/interface/menus/utils/__tests__/index.spec.ts (100%) rename console/{src => console-src}/modules/interface/menus/utils/index.ts (100%) rename console/{src => console-src}/modules/interface/themes/ThemeDetail.vue (100%) rename console/{src => console-src}/modules/interface/themes/ThemeSetting.vue (97%) rename console/{src => console-src}/modules/interface/themes/components/ThemeListItem.vue (98%) rename console/{src => console-src}/modules/interface/themes/components/ThemeListModal.vue (100%) rename console/{src => console-src}/modules/interface/themes/components/list-tabs/InstalledThemes.vue (98%) rename console/{src => console-src}/modules/interface/themes/components/list-tabs/LocalUpload.vue (97%) rename console/{src => console-src}/modules/interface/themes/components/list-tabs/NotInstalledThemes.vue (100%) rename console/{src => console-src}/modules/interface/themes/components/list-tabs/RemoteDownload.vue (98%) rename console/{src => console-src}/modules/interface/themes/components/operation/MoreOperationItem.vue (100%) rename console/{src => console-src}/modules/interface/themes/components/operation/UninstallOperationItem.vue (100%) rename console/{src => console-src}/modules/interface/themes/components/preview/ThemePreviewListItem.vue (100%) rename console/{src => console-src}/modules/interface/themes/components/preview/ThemePreviewModal.vue (98%) rename console/{src => console-src}/modules/interface/themes/composables/use-theme.ts (98%) rename console/{src => console-src}/modules/interface/themes/constants/index.ts (100%) rename console/{src => console-src}/modules/interface/themes/layouts/ThemeLayout.vue (98%) rename console/{src => console-src}/modules/interface/themes/module.ts (100%) rename console/{src => console-src}/modules/interface/themes/types/index.ts (100%) rename console/{src => console-src}/modules/system/actuator/Actuator.vue (100%) rename console/{src => console-src}/modules/system/actuator/module.ts (92%) rename console/{src => console-src}/modules/system/auth-providers/AuthProviderDetail.vue (98%) rename console/{src => console-src}/modules/system/auth-providers/AuthProviders.vue (100%) rename console/{src => console-src}/modules/system/auth-providers/components/AuthProviderListItem.vue (100%) rename console/{src => console-src}/modules/system/auth-providers/module.ts (92%) rename console/{src => console-src}/modules/system/backup/Backups.vue (100%) rename console/{src => console-src}/modules/system/backup/components/BackupListItem.vue (98%) rename console/{src => console-src}/modules/system/backup/composables/use-backup.ts (100%) rename console/{src => console-src}/modules/system/backup/module.ts (92%) rename console/{src => console-src}/modules/system/backup/tabs/List.vue (100%) rename console/{src => console-src}/modules/system/backup/tabs/Restore.vue (100%) rename console/{src => console-src}/modules/system/plugins/PluginDetail.vue (100%) rename console/{src => console-src}/modules/system/plugins/PluginList.vue (100%) rename console/{src => console-src}/modules/system/plugins/components/PluginInstallationModal.vue (100%) rename console/{src => console-src}/modules/system/plugins/components/PluginListItem.vue (97%) rename console/{src => console-src}/modules/system/plugins/components/entity-fields/AuthorField.vue (100%) rename console/{src => console-src}/modules/system/plugins/components/entity-fields/LogoField.vue (100%) rename console/{src => console-src}/modules/system/plugins/components/entity-fields/SwitchField.vue (100%) rename console/{src => console-src}/modules/system/plugins/components/installation-tabs/LocalUpload.vue (100%) rename console/{src => console-src}/modules/system/plugins/components/installation-tabs/RemoteDownload.vue (100%) rename console/{src => console-src}/modules/system/plugins/composables/use-plugin.ts (100%) rename console/{src => console-src}/modules/system/plugins/constants/index.ts (100%) rename console/{src => console-src}/modules/system/plugins/module.ts (92%) rename console/{src => console-src}/modules/system/plugins/tabs/Detail.vue (100%) rename console/{src => console-src}/modules/system/plugins/tabs/Setting.vue (97%) rename console/{src => console-src}/modules/system/plugins/types/index.ts (100%) rename console/{src => console-src}/modules/system/roles/RoleDetail.vue (99%) rename console/{src => console-src}/modules/system/roles/RoleList.vue (99%) rename console/{src => console-src}/modules/system/roles/components/RoleEditingModal.vue (99%) rename console/{src => console-src}/modules/system/roles/composables/use-role.ts (100%) rename console/{src => console-src}/modules/system/roles/module.ts (92%) rename console/{src => console-src}/modules/system/settings/SystemSettings.vue (100%) rename console/{src => console-src}/modules/system/settings/module.ts (92%) rename console/{src => console-src}/modules/system/settings/tabs/NotificationSetting.vue (100%) rename console/{src => console-src}/modules/system/settings/tabs/Notifications.vue (100%) rename console/{src => console-src}/modules/system/settings/tabs/Setting.vue (94%) rename console/{src => console-src}/modules/system/users/Binding.vue (95%) rename console/{src => console-src}/modules/system/users/Login.vue (97%) rename console/{src => console-src}/modules/system/users/Notifications.vue (100%) rename console/{src => console-src}/modules/system/users/UserDetail.vue (100%) rename console/{src => console-src}/modules/system/users/UserList.vue (100%) rename console/{src => console-src}/modules/system/users/components/GrantPermissionModal.vue (100%) rename console/{src => console-src}/modules/system/users/components/NotificationContent.vue (100%) rename console/{src => console-src}/modules/system/users/components/NotificationListItem.vue (100%) rename console/{src => console-src}/modules/system/users/components/PersonalAccessTokenCreationModal.vue (100%) rename console/{src => console-src}/modules/system/users/components/PersonalAccessTokenListItem.vue (100%) rename console/{src => console-src}/modules/system/users/components/UserAvatar.vue (100%) rename console/{src => console-src}/modules/system/users/components/UserAvatarCropper.vue (100%) rename console/{src => console-src}/modules/system/users/components/UserCreationModal.vue (100%) rename console/{src => console-src}/modules/system/users/components/UserEditingModal.vue (100%) rename console/{src => console-src}/modules/system/users/components/UserPasswordChangeModal.vue (100%) rename console/{src => console-src}/modules/system/users/composables/use-user.ts (100%) rename console/{src => console-src}/modules/system/users/module.ts (95%) rename console/{src => console-src}/modules/system/users/tabs/Detail.vue (100%) rename console/{src => console-src}/modules/system/users/tabs/NotificationPreferences.vue (100%) rename console/{src => console-src}/modules/system/users/tabs/PersonalAccessTokens.vue (100%) rename console/{src => console-src}/modules/system/users/widgets/NotificationWidget.vue (100%) rename console/{src => console-src}/modules/system/users/widgets/RecentLoginWidget.vue (94%) rename console/{src => console-src}/modules/system/users/widgets/UserStatsWidget.vue (100%) rename console/{src => console-src}/router/guards/auth-check.ts (100%) rename console/{src => console-src}/router/guards/check-states.ts (100%) rename console/{src => console-src}/router/guards/permission.ts (100%) rename console/{src => console-src}/router/index.ts (92%) rename console/{src => console-src}/router/routes.config.ts (78%) rename console/{src => console-src}/stores/system-configmap.ts (100%) rename console/{src => console-src}/stores/theme.ts (100%) rename console/{src => console-src}/styles/index.css (100%) rename console/{src => console-src}/styles/tailwind.css (100%) rename console/{src => console-src}/views/exceptions/Forbidden.vue (100%) rename console/{src => console-src}/views/exceptions/NotFound.vue (100%) rename console/{src => console-src}/views/exceptions/__tests__/NotFound.spec.ts (100%) rename console/{src => console-src}/views/exceptions/components/Exception.vue (100%) rename console/{src => console-src}/views/system/Redirect.vue (100%) rename console/{src => console-src}/views/system/Setup.vue (100%) rename console/{src => console-src}/views/system/SetupInitialData.vue (100%) rename console/{src => console-src}/views/system/setup-data/category.json (100%) rename console/{src => console-src}/views/system/setup-data/menu-items.json (100%) rename console/{src => console-src}/views/system/setup-data/menu.json (100%) rename console/{src => console-src}/views/system/setup-data/post.json (100%) rename console/{src => console-src}/views/system/setup-data/singlePage.json (100%) rename console/{src => console-src}/views/system/setup-data/tag.json (100%) create mode 100644 console/docs/project-structure/README.md delete mode 100644 console/src/main.ts diff --git a/console/src/App.vue b/console/console-src/App.vue similarity index 92% rename from console/src/App.vue rename to console/console-src/App.vue index 2405a8e9b1..825aebcd70 100644 --- a/console/src/App.vue +++ b/console/console-src/App.vue @@ -3,7 +3,7 @@ import { RouterView, useRoute } from "vue-router"; import { computed, watch, reactive, onMounted, inject } from "vue"; import { useTitle } from "@vueuse/core"; import { useFavicon } from "@vueuse/core"; -import { useSystemConfigMapStore } from "./stores/system-configmap"; +import { useSystemConfigMapStore } from "@console/stores/system-configmap"; import { storeToRefs } from "pinia"; import { useI18n } from "vue-i18n"; import { @@ -11,9 +11,9 @@ import { type UseOverlayScrollbarsParams, } from "overlayscrollbars-vue"; import type { FormKitConfig } from "@formkit/core"; -import { i18n } from "./locales"; -import { AppName } from "./constants/app"; -import { useGlobalInfoStore } from "./stores/global-info"; +import { i18n } from "@/locales"; +import { AppName } from "@/constants/app"; +import { useGlobalInfoStore } from "@/stores/global-info"; const { t } = useI18n(); diff --git a/console/src/composables/use-auto-save-content.ts b/console/console-src/composables/use-auto-save-content.ts similarity index 100% rename from console/src/composables/use-auto-save-content.ts rename to console/console-src/composables/use-auto-save-content.ts diff --git a/console/src/composables/use-content-cache.ts b/console/console-src/composables/use-content-cache.ts similarity index 100% rename from console/src/composables/use-content-cache.ts rename to console/console-src/composables/use-content-cache.ts diff --git a/console/src/composables/use-content-snapshot.ts b/console/console-src/composables/use-content-snapshot.ts similarity index 100% rename from console/src/composables/use-content-snapshot.ts rename to console/console-src/composables/use-content-snapshot.ts diff --git a/console/src/composables/use-editor-extension-points.ts b/console/console-src/composables/use-editor-extension-points.ts similarity index 100% rename from console/src/composables/use-editor-extension-points.ts rename to console/console-src/composables/use-editor-extension-points.ts diff --git a/console/src/composables/use-entity-extension-points.ts b/console/console-src/composables/use-entity-extension-points.ts similarity index 100% rename from console/src/composables/use-entity-extension-points.ts rename to console/console-src/composables/use-entity-extension-points.ts diff --git a/console/src/composables/use-global-info.ts b/console/console-src/composables/use-global-info.ts similarity index 100% rename from console/src/composables/use-global-info.ts rename to console/console-src/composables/use-global-info.ts diff --git a/console/src/composables/use-operation-extension-points.ts b/console/console-src/composables/use-operation-extension-points.ts similarity index 100% rename from console/src/composables/use-operation-extension-points.ts rename to console/console-src/composables/use-operation-extension-points.ts diff --git a/console/src/composables/use-save-keybinding.ts b/console/console-src/composables/use-save-keybinding.ts similarity index 100% rename from console/src/composables/use-save-keybinding.ts rename to console/console-src/composables/use-save-keybinding.ts diff --git a/console/src/composables/use-setting-form.ts b/console/console-src/composables/use-setting-form.ts similarity index 99% rename from console/src/composables/use-setting-form.ts rename to console/console-src/composables/use-setting-form.ts index 5ca6dd0ccc..94c3c6e92a 100644 --- a/console/src/composables/use-setting-form.ts +++ b/console/console-src/composables/use-setting-form.ts @@ -2,7 +2,7 @@ // types import { computed, watch, type ComputedRef, type Ref } from "vue"; import { ref } from "vue"; -import { apiClient } from "../utils/api-client"; +import { apiClient } from "@/utils/api-client"; // libs import cloneDeep from "lodash.clonedeep"; diff --git a/console/src/composables/use-slugify.ts b/console/console-src/composables/use-slugify.ts similarity index 100% rename from console/src/composables/use-slugify.ts rename to console/console-src/composables/use-slugify.ts diff --git a/console/src/layouts/BasicLayout.vue b/console/console-src/layouts/BasicLayout.vue similarity index 99% rename from console/src/layouts/BasicLayout.vue rename to console/console-src/layouts/BasicLayout.vue index 6d26ba1c99..bbc9e2a0c2 100644 --- a/console/src/layouts/BasicLayout.vue +++ b/console/console-src/layouts/BasicLayout.vue @@ -22,7 +22,7 @@ import { onMounted, onUnmounted, reactive, ref } from "vue"; import axios from "axios"; import GlobalSearchModal from "@/components/global-search/GlobalSearchModal.vue"; import LoginModal from "@/components/login/LoginModal.vue"; -import { coreMenuGroups } from "@/router/routes.config"; +import { coreMenuGroups } from "@console/router/routes.config"; import sortBy from "lodash.sortby"; import { useRoleStore } from "@/stores/role"; import { hasPermission } from "@/utils/permission"; diff --git a/console/src/layouts/BlankLayout.vue b/console/console-src/layouts/BlankLayout.vue similarity index 100% rename from console/src/layouts/BlankLayout.vue rename to console/console-src/layouts/BlankLayout.vue diff --git a/console/console-src/main.ts b/console/console-src/main.ts index e69de29bb2..693859b175 100644 --- a/console/console-src/main.ts +++ b/console/console-src/main.ts @@ -0,0 +1,113 @@ +import { createApp } from "vue"; +import type { DirectiveBinding } from "vue"; +import { createPinia } from "pinia"; +import App from "./App.vue"; +import router from "./router"; +import { apiClient } from "@/utils/api-client"; +// setup +import "@/setup/setupStyles"; +import { setupComponents } from "@/setup/setupComponents"; +import { setupI18n, i18n, getBrowserLanguage } from "@/locales"; +// core modules +import { hasPermission } from "@/utils/permission"; +import { useRoleStore } from "@/stores/role"; +import { useThemeStore } from "@console/stores/theme"; +import { useUserStore } from "@/stores/user"; +import { useSystemConfigMapStore } from "@console/stores/system-configmap"; +import { setupVueQuery } from "@/setup/setupVueQuery"; +import { useGlobalInfoStore } from "@/stores/global-info"; +import { setupCoreModules, setupPluginModules } from "@/setup/setupModules"; + +const app = createApp(App); + +setupComponents(app); +setupI18n(app); +setupVueQuery(app); + +app.use(createPinia()); + +async function loadUserPermissions() { + const { data: currentPermissions } = await apiClient.user.getPermissions({ + name: "-", + }); + const roleStore = useRoleStore(); + roleStore.$patch({ + permissions: currentPermissions, + }); + app.directive( + "permission", + (el: HTMLElement, binding: DirectiveBinding) => { + const uiPermissions = Array.from( + currentPermissions.uiPermissions + ); + const { value } = binding; + const { any, enable } = binding.modifiers; + + if (hasPermission(uiPermissions, value, any)) { + return; + } + + if (enable) { + //TODO + return; + } + el?.remove?.(); + } + ); +} + +async function loadActivatedTheme() { + const themeStore = useThemeStore(); + await themeStore.fetchActivatedTheme(); +} + +(async function () { + await initApp(); +})(); + +async function initApp() { + // TODO 实验性 + const theme = localStorage.getItem("theme"); + if (theme) { + document.body.classList.add(theme); + } + + try { + setupCoreModules(app); + + const userStore = useUserStore(); + await userStore.fetchCurrentUser(); + + // set locale + i18n.global.locale.value = + localStorage.getItem("locale") || getBrowserLanguage(); + + const globalInfoStore = useGlobalInfoStore(); + await globalInfoStore.fetchGlobalInfo(); + + if (userStore.isAnonymous) { + return; + } + + await loadUserPermissions(); + + try { + await setupPluginModules(app); + } catch (e) { + console.error("Failed to load plugins", e); + } + + // load system configMap + const systemConfigMapStore = useSystemConfigMapStore(); + await systemConfigMapStore.fetchSystemConfigMap(); + + if (globalInfoStore.globalInfo?.userInitialized) { + await loadActivatedTheme(); + } + } catch (e) { + console.error(e); + } finally { + app.use(router); + app.mount("#app"); + } +} diff --git a/console/src/modules/contents/_components/ContributorList.vue b/console/console-src/modules/contents/_components/ContributorList.vue similarity index 100% rename from console/src/modules/contents/_components/ContributorList.vue rename to console/console-src/modules/contents/_components/ContributorList.vue diff --git a/console/src/modules/contents/attachments/AttachmentList.vue b/console/console-src/modules/contents/attachments/AttachmentList.vue similarity index 100% rename from console/src/modules/contents/attachments/AttachmentList.vue rename to console/console-src/modules/contents/attachments/AttachmentList.vue diff --git a/console/src/modules/contents/attachments/components/AttachmentDetailModal.vue b/console/console-src/modules/contents/attachments/components/AttachmentDetailModal.vue similarity index 100% rename from console/src/modules/contents/attachments/components/AttachmentDetailModal.vue rename to console/console-src/modules/contents/attachments/components/AttachmentDetailModal.vue diff --git a/console/src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue b/console/console-src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue similarity index 100% rename from console/src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue rename to console/console-src/modules/contents/attachments/components/AttachmentGroupEditingModal.vue diff --git a/console/src/modules/contents/attachments/components/AttachmentGroupList.vue b/console/console-src/modules/contents/attachments/components/AttachmentGroupList.vue similarity index 100% rename from console/src/modules/contents/attachments/components/AttachmentGroupList.vue rename to console/console-src/modules/contents/attachments/components/AttachmentGroupList.vue diff --git a/console/src/modules/contents/attachments/components/AttachmentListItem.vue b/console/console-src/modules/contents/attachments/components/AttachmentListItem.vue similarity index 98% rename from console/src/modules/contents/attachments/components/AttachmentListItem.vue rename to console/console-src/modules/contents/attachments/components/AttachmentListItem.vue index 3109f2ac3b..27aaaa08ae 100644 --- a/console/src/modules/contents/attachments/components/AttachmentListItem.vue +++ b/console/console-src/modules/contents/attachments/components/AttachmentListItem.vue @@ -19,7 +19,7 @@ import { useI18n } from "vue-i18n"; import { inject } from "vue"; import type { Ref } from "vue"; import { useQueryClient } from "@tanstack/vue-query"; -import { useOperationItemExtensionPoint } from "@/composables/use-operation-extension-points"; +import { useOperationItemExtensionPoint } from "@console/composables/use-operation-extension-points"; import { toRefs } from "vue"; import type { OperationItem } from "@halo-dev/console-shared"; import EntityDropdownItems from "@/components/entity/EntityDropdownItems.vue"; diff --git a/console/src/modules/contents/attachments/components/AttachmentPermalinkList.vue b/console/console-src/modules/contents/attachments/components/AttachmentPermalinkList.vue similarity index 100% rename from console/src/modules/contents/attachments/components/AttachmentPermalinkList.vue rename to console/console-src/modules/contents/attachments/components/AttachmentPermalinkList.vue diff --git a/console/src/modules/contents/attachments/components/AttachmentPoliciesModal.vue b/console/console-src/modules/contents/attachments/components/AttachmentPoliciesModal.vue similarity index 100% rename from console/src/modules/contents/attachments/components/AttachmentPoliciesModal.vue rename to console/console-src/modules/contents/attachments/components/AttachmentPoliciesModal.vue diff --git a/console/src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue b/console/console-src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue similarity index 98% rename from console/src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue rename to console/console-src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue index 3098987307..9cf73da936 100644 --- a/console/src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue +++ b/console/console-src/modules/contents/attachments/components/AttachmentPolicyEditingModal.vue @@ -4,7 +4,7 @@ import SubmitButton from "@/components/button/SubmitButton.vue"; import type { Policy, PolicyTemplate } from "@halo-dev/api-client"; import cloneDeep from "lodash.clonedeep"; import { computed, ref, toRaw, watch, watchEffect } from "vue"; -import { useSettingForm } from "@/composables/use-setting-form"; +import { useSettingForm } from "@console/composables/use-setting-form"; import { apiClient } from "@/utils/api-client"; import { reset, diff --git a/console/src/modules/contents/attachments/components/AttachmentSelectorModal.vue b/console/console-src/modules/contents/attachments/components/AttachmentSelectorModal.vue similarity index 100% rename from console/src/modules/contents/attachments/components/AttachmentSelectorModal.vue rename to console/console-src/modules/contents/attachments/components/AttachmentSelectorModal.vue diff --git a/console/src/modules/contents/attachments/components/AttachmentUploadModal.vue b/console/console-src/modules/contents/attachments/components/AttachmentUploadModal.vue similarity index 100% rename from console/src/modules/contents/attachments/components/AttachmentUploadModal.vue rename to console/console-src/modules/contents/attachments/components/AttachmentUploadModal.vue diff --git a/console/src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue b/console/console-src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue similarity index 100% rename from console/src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue rename to console/console-src/modules/contents/attachments/components/selector-providers/CoreSelectorProvider.vue diff --git a/console/src/modules/contents/attachments/composables/use-attachment-group.ts b/console/console-src/modules/contents/attachments/composables/use-attachment-group.ts similarity index 100% rename from console/src/modules/contents/attachments/composables/use-attachment-group.ts rename to console/console-src/modules/contents/attachments/composables/use-attachment-group.ts diff --git a/console/src/modules/contents/attachments/composables/use-attachment-policy.ts b/console/console-src/modules/contents/attachments/composables/use-attachment-policy.ts similarity index 100% rename from console/src/modules/contents/attachments/composables/use-attachment-policy.ts rename to console/console-src/modules/contents/attachments/composables/use-attachment-policy.ts diff --git a/console/src/modules/contents/attachments/composables/use-attachment.ts b/console/console-src/modules/contents/attachments/composables/use-attachment.ts similarity index 100% rename from console/src/modules/contents/attachments/composables/use-attachment.ts rename to console/console-src/modules/contents/attachments/composables/use-attachment.ts diff --git a/console/src/modules/contents/attachments/module.ts b/console/console-src/modules/contents/attachments/module.ts similarity index 93% rename from console/src/modules/contents/attachments/module.ts rename to console/console-src/modules/contents/attachments/module.ts index a376071d8f..3b7df17a3a 100644 --- a/console/src/modules/contents/attachments/module.ts +++ b/console/console-src/modules/contents/attachments/module.ts @@ -1,5 +1,5 @@ import { definePlugin } from "@halo-dev/console-shared"; -import BasicLayout from "@/layouts/BasicLayout.vue"; +import BasicLayout from "@console/layouts/BasicLayout.vue"; import AttachmentList from "./AttachmentList.vue"; import AttachmentSelectorModal from "./components/AttachmentSelectorModal.vue"; import { IconFolder } from "@halo-dev/components"; diff --git a/console/src/modules/contents/comments/CommentList.vue b/console/console-src/modules/contents/comments/CommentList.vue similarity index 100% rename from console/src/modules/contents/comments/CommentList.vue rename to console/console-src/modules/contents/comments/CommentList.vue diff --git a/console/src/modules/contents/comments/components/CommentListItem.vue b/console/console-src/modules/contents/comments/components/CommentListItem.vue similarity index 100% rename from console/src/modules/contents/comments/components/CommentListItem.vue rename to console/console-src/modules/contents/comments/components/CommentListItem.vue diff --git a/console/src/modules/contents/comments/components/ReplyCreationModal.vue b/console/console-src/modules/contents/comments/components/ReplyCreationModal.vue similarity index 100% rename from console/src/modules/contents/comments/components/ReplyCreationModal.vue rename to console/console-src/modules/contents/comments/components/ReplyCreationModal.vue diff --git a/console/src/modules/contents/comments/components/ReplyListItem.vue b/console/console-src/modules/contents/comments/components/ReplyListItem.vue similarity index 100% rename from console/src/modules/contents/comments/components/ReplyListItem.vue rename to console/console-src/modules/contents/comments/components/ReplyListItem.vue diff --git a/console/src/modules/contents/comments/module.ts b/console/console-src/modules/contents/comments/module.ts similarity index 93% rename from console/src/modules/contents/comments/module.ts rename to console/console-src/modules/contents/comments/module.ts index 5cf8e11030..2172fde2d1 100644 --- a/console/src/modules/contents/comments/module.ts +++ b/console/console-src/modules/contents/comments/module.ts @@ -1,5 +1,5 @@ import { definePlugin } from "@halo-dev/console-shared"; -import BasicLayout from "@/layouts/BasicLayout.vue"; +import BasicLayout from "@console/layouts/BasicLayout.vue"; import { IconMessage } from "@halo-dev/components"; import CommentList from "./CommentList.vue"; import CommentStatsWidget from "./widgets/CommentStatsWidget.vue"; diff --git a/console/src/modules/contents/comments/widgets/CommentStatsWidget.vue b/console/console-src/modules/contents/comments/widgets/CommentStatsWidget.vue similarity index 100% rename from console/src/modules/contents/comments/widgets/CommentStatsWidget.vue rename to console/console-src/modules/contents/comments/widgets/CommentStatsWidget.vue diff --git a/console/src/modules/contents/pages/DeletedSinglePageList.vue b/console/console-src/modules/contents/pages/DeletedSinglePageList.vue similarity index 100% rename from console/src/modules/contents/pages/DeletedSinglePageList.vue rename to console/console-src/modules/contents/pages/DeletedSinglePageList.vue diff --git a/console/src/modules/contents/pages/SinglePageEditor.vue b/console/console-src/modules/contents/pages/SinglePageEditor.vue similarity index 96% rename from console/src/modules/contents/pages/SinglePageEditor.vue rename to console/console-src/modules/contents/pages/SinglePageEditor.vue index 683a5c15ef..65742ea571 100644 --- a/console/src/modules/contents/pages/SinglePageEditor.vue +++ b/console/console-src/modules/contents/pages/SinglePageEditor.vue @@ -27,8 +27,8 @@ import { useRouteQuery } from "@vueuse/router"; import cloneDeep from "lodash.clonedeep"; import { useRouter } from "vue-router"; import { randomUUID } from "@/utils/id"; -import { useContentCache } from "@/composables/use-content-cache"; -import { useEditorExtensionPoints } from "@/composables/use-editor-extension-points"; +import { useContentCache } from "@console/composables/use-content-cache"; +import { useEditorExtensionPoints } from "@console/composables/use-editor-extension-points"; import type { EditorProvider } from "@halo-dev/console-shared"; import { useLocalStorage } from "@vueuse/core"; import EditorProviderSelector from "@/components/dropdown-selector/EditorProviderSelector.vue"; @@ -36,9 +36,9 @@ import { useI18n } from "vue-i18n"; import UrlPreviewModal from "@/components/preview/UrlPreviewModal.vue"; import { contentAnnotations } from "@/constants/annotations"; import { usePageUpdateMutate } from "./composables/use-page-update-mutate"; -import { useAutoSaveContent } from "@/composables/use-auto-save-content"; -import { useContentSnapshot } from "@/composables/use-content-snapshot"; -import { useSaveKeybinding } from "@/composables/use-save-keybinding"; +import { useAutoSaveContent } from "@console/composables/use-auto-save-content"; +import { useContentSnapshot } from "@console/composables/use-content-snapshot"; +import { useSaveKeybinding } from "@console/composables/use-save-keybinding"; const router = useRouter(); const { t } = useI18n(); diff --git a/console/src/modules/contents/pages/SinglePageList.vue b/console/console-src/modules/contents/pages/SinglePageList.vue similarity index 100% rename from console/src/modules/contents/pages/SinglePageList.vue rename to console/console-src/modules/contents/pages/SinglePageList.vue diff --git a/console/src/modules/contents/pages/components/SinglePageListItem.vue b/console/console-src/modules/contents/pages/components/SinglePageListItem.vue similarity index 100% rename from console/src/modules/contents/pages/components/SinglePageListItem.vue rename to console/console-src/modules/contents/pages/components/SinglePageListItem.vue diff --git a/console/src/modules/contents/pages/components/SinglePageSettingModal.vue b/console/console-src/modules/contents/pages/components/SinglePageSettingModal.vue similarity index 98% rename from console/src/modules/contents/pages/components/SinglePageSettingModal.vue rename to console/console-src/modules/contents/pages/components/SinglePageSettingModal.vue index e742bfddf8..a1f2bd0404 100644 --- a/console/src/modules/contents/pages/components/SinglePageSettingModal.vue +++ b/console/console-src/modules/contents/pages/components/SinglePageSettingModal.vue @@ -10,13 +10,13 @@ import { computed, nextTick, ref, watchEffect } from "vue"; import type { SinglePage } from "@halo-dev/api-client"; import cloneDeep from "lodash.clonedeep"; import { apiClient } from "@/utils/api-client"; -import { useThemeCustomTemplates } from "@/modules/interface/themes/composables/use-theme"; +import { useThemeCustomTemplates } from "@console/modules/interface/themes/composables/use-theme"; import { singlePageLabels } from "@/constants/labels"; import { randomUUID } from "@/utils/id"; import { toDatetimeLocal, toISOString } from "@/utils/date"; import { submitForm } from "@formkit/core"; import AnnotationsForm from "@/components/form/AnnotationsForm.vue"; -import useSlugify from "@/composables/use-slugify"; +import useSlugify from "@console/composables/use-slugify"; import { useI18n } from "vue-i18n"; import { usePageUpdateMutate } from "../composables/use-page-update-mutate"; import { FormType } from "@/types/slug"; diff --git a/console/src/modules/contents/pages/composables/use-page-update-mutate.ts b/console/console-src/modules/contents/pages/composables/use-page-update-mutate.ts similarity index 100% rename from console/src/modules/contents/pages/composables/use-page-update-mutate.ts rename to console/console-src/modules/contents/pages/composables/use-page-update-mutate.ts diff --git a/console/src/modules/contents/pages/module.ts b/console/console-src/modules/contents/pages/module.ts similarity index 96% rename from console/src/modules/contents/pages/module.ts rename to console/console-src/modules/contents/pages/module.ts index f88ee1192c..7df6f530ea 100644 --- a/console/src/modules/contents/pages/module.ts +++ b/console/console-src/modules/contents/pages/module.ts @@ -1,5 +1,5 @@ import { definePlugin } from "@halo-dev/console-shared"; -import BasicLayout from "@/layouts/BasicLayout.vue"; +import BasicLayout from "@console/layouts/BasicLayout.vue"; import SinglePageList from "./SinglePageList.vue"; import DeletedSinglePageList from "./DeletedSinglePageList.vue"; import SinglePageEditor from "./SinglePageEditor.vue"; diff --git a/console/src/modules/contents/pages/widgets/SinglePageStatsWidget.vue b/console/console-src/modules/contents/pages/widgets/SinglePageStatsWidget.vue similarity index 100% rename from console/src/modules/contents/pages/widgets/SinglePageStatsWidget.vue rename to console/console-src/modules/contents/pages/widgets/SinglePageStatsWidget.vue diff --git a/console/src/modules/contents/posts/DeletedPostList.vue b/console/console-src/modules/contents/posts/DeletedPostList.vue similarity index 100% rename from console/src/modules/contents/posts/DeletedPostList.vue rename to console/console-src/modules/contents/posts/DeletedPostList.vue diff --git a/console/src/modules/contents/posts/PostEditor.vue b/console/console-src/modules/contents/posts/PostEditor.vue similarity index 96% rename from console/src/modules/contents/posts/PostEditor.vue rename to console/console-src/modules/contents/posts/PostEditor.vue index 3ec956ba9f..f9f3523672 100644 --- a/console/src/modules/contents/posts/PostEditor.vue +++ b/console/console-src/modules/contents/posts/PostEditor.vue @@ -27,8 +27,8 @@ import { apiClient } from "@/utils/api-client"; import { useRouteQuery } from "@vueuse/router"; import { useRouter } from "vue-router"; import { randomUUID } from "@/utils/id"; -import { useContentCache } from "@/composables/use-content-cache"; -import { useEditorExtensionPoints } from "@/composables/use-editor-extension-points"; +import { useContentCache } from "@console/composables/use-content-cache"; +import { useEditorExtensionPoints } from "@console/composables/use-editor-extension-points"; import type { EditorProvider } from "@halo-dev/console-shared"; import { useLocalStorage } from "@vueuse/core"; import EditorProviderSelector from "@/components/dropdown-selector/EditorProviderSelector.vue"; @@ -36,9 +36,9 @@ import { useI18n } from "vue-i18n"; import UrlPreviewModal from "@/components/preview/UrlPreviewModal.vue"; import { usePostUpdateMutate } from "./composables/use-post-update-mutate"; import { contentAnnotations } from "@/constants/annotations"; -import { useAutoSaveContent } from "@/composables/use-auto-save-content"; -import { useContentSnapshot } from "@/composables/use-content-snapshot"; -import { useSaveKeybinding } from "@/composables/use-save-keybinding"; +import { useAutoSaveContent } from "@console/composables/use-auto-save-content"; +import { useContentSnapshot } from "@console/composables/use-content-snapshot"; +import { useSaveKeybinding } from "@console/composables/use-save-keybinding"; const router = useRouter(); const { t } = useI18n(); diff --git a/console/src/modules/contents/posts/PostList.vue b/console/console-src/modules/contents/posts/PostList.vue similarity index 100% rename from console/src/modules/contents/posts/PostList.vue rename to console/console-src/modules/contents/posts/PostList.vue diff --git a/console/src/modules/contents/posts/categories/CategoryList.vue b/console/console-src/modules/contents/posts/categories/CategoryList.vue similarity index 100% rename from console/src/modules/contents/posts/categories/CategoryList.vue rename to console/console-src/modules/contents/posts/categories/CategoryList.vue diff --git a/console/src/modules/contents/posts/categories/components/CategoryEditingModal.vue b/console/console-src/modules/contents/posts/categories/components/CategoryEditingModal.vue similarity index 98% rename from console/src/modules/contents/posts/categories/components/CategoryEditingModal.vue rename to console/console-src/modules/contents/posts/categories/components/CategoryEditingModal.vue index aac939259b..cec6a5167f 100644 --- a/console/src/modules/contents/posts/categories/components/CategoryEditingModal.vue +++ b/console/console-src/modules/contents/posts/categories/components/CategoryEditingModal.vue @@ -20,9 +20,9 @@ import type { Category } from "@halo-dev/api-client"; import cloneDeep from "lodash.clonedeep"; import { reset } from "@formkit/core"; import { setFocus } from "@/formkit/utils/focus"; -import { useThemeCustomTemplates } from "@/modules/interface/themes/composables/use-theme"; +import { useThemeCustomTemplates } from "@console/modules/interface/themes/composables/use-theme"; import AnnotationsForm from "@/components/form/AnnotationsForm.vue"; -import useSlugify from "@/composables/use-slugify"; +import useSlugify from "@console/composables/use-slugify"; import { useI18n } from "vue-i18n"; import { FormType } from "@/types/slug"; diff --git a/console/src/modules/contents/posts/categories/components/CategoryListItem.vue b/console/console-src/modules/contents/posts/categories/components/CategoryListItem.vue similarity index 100% rename from console/src/modules/contents/posts/categories/components/CategoryListItem.vue rename to console/console-src/modules/contents/posts/categories/components/CategoryListItem.vue diff --git a/console/src/modules/contents/posts/categories/components/__tests__/CategoryEditingModal.spec.ts b/console/console-src/modules/contents/posts/categories/components/__tests__/CategoryEditingModal.spec.ts similarity index 100% rename from console/src/modules/contents/posts/categories/components/__tests__/CategoryEditingModal.spec.ts rename to console/console-src/modules/contents/posts/categories/components/__tests__/CategoryEditingModal.spec.ts diff --git a/console/src/modules/contents/posts/categories/composables/use-post-category.ts b/console/console-src/modules/contents/posts/categories/composables/use-post-category.ts similarity index 92% rename from console/src/modules/contents/posts/categories/composables/use-post-category.ts rename to console/console-src/modules/contents/posts/categories/composables/use-post-category.ts index 0e8d90c26e..6ac4316ab3 100644 --- a/console/src/modules/contents/posts/categories/composables/use-post-category.ts +++ b/console/console-src/modules/contents/posts/categories/composables/use-post-category.ts @@ -2,8 +2,8 @@ import { apiClient } from "@/utils/api-client"; import type { Category } from "@halo-dev/api-client"; import type { Ref } from "vue"; import { ref } from "vue"; -import type { CategoryTree } from "@/modules/contents/posts/categories/utils"; -import { buildCategoriesTree } from "@/modules/contents/posts/categories/utils"; +import type { CategoryTree } from "@console/modules/contents/posts/categories/utils"; +import { buildCategoriesTree } from "@console/modules/contents/posts/categories/utils"; import { Dialog, Toast } from "@halo-dev/components"; import { useQuery } from "@tanstack/vue-query"; import { useI18n } from "vue-i18n"; diff --git a/console/src/modules/contents/posts/categories/utils/index.ts b/console/console-src/modules/contents/posts/categories/utils/index.ts similarity index 100% rename from console/src/modules/contents/posts/categories/utils/index.ts rename to console/console-src/modules/contents/posts/categories/utils/index.ts diff --git a/console/src/modules/contents/posts/components/PostListItem.vue b/console/console-src/modules/contents/posts/components/PostListItem.vue similarity index 96% rename from console/src/modules/contents/posts/components/PostListItem.vue rename to console/console-src/modules/contents/posts/components/PostListItem.vue index 16b7d67155..ea64ce3ae3 100644 --- a/console/src/modules/contents/posts/components/PostListItem.vue +++ b/console/console-src/modules/contents/posts/components/PostListItem.vue @@ -16,8 +16,8 @@ import { useQueryClient } from "@tanstack/vue-query"; import type { Ref } from "vue"; import { computed, toRefs, markRaw, ref, inject } from "vue"; import { useRouter } from "vue-router"; -import { useEntityFieldItemExtensionPoint } from "@/composables/use-entity-extension-points"; -import { useOperationItemExtensionPoint } from "@/composables/use-operation-extension-points"; +import { useEntityFieldItemExtensionPoint } from "@console/composables/use-entity-extension-points"; +import { useOperationItemExtensionPoint } from "@console/composables/use-operation-extension-points"; import EntityDropdownItems from "@/components/entity/EntityDropdownItems.vue"; import type { EntityFieldItem, OperationItem } from "@halo-dev/console-shared"; import TitleField from "./entity-fields/TitleField.vue"; diff --git a/console/src/modules/contents/posts/components/PostSettingModal.vue b/console/console-src/modules/contents/posts/components/PostSettingModal.vue similarity index 98% rename from console/src/modules/contents/posts/components/PostSettingModal.vue rename to console/console-src/modules/contents/posts/components/PostSettingModal.vue index a7f37fa9d1..1af6215cb6 100644 --- a/console/src/modules/contents/posts/components/PostSettingModal.vue +++ b/console/console-src/modules/contents/posts/components/PostSettingModal.vue @@ -10,13 +10,13 @@ import { computed, nextTick, ref, watchEffect } from "vue"; import type { Post } from "@halo-dev/api-client"; import cloneDeep from "lodash.clonedeep"; import { apiClient } from "@/utils/api-client"; -import { useThemeCustomTemplates } from "@/modules/interface/themes/composables/use-theme"; +import { useThemeCustomTemplates } from "@console/modules/interface/themes/composables/use-theme"; import { postLabels } from "@/constants/labels"; import { randomUUID } from "@/utils/id"; import { toDatetimeLocal, toISOString } from "@/utils/date"; import AnnotationsForm from "@/components/form/AnnotationsForm.vue"; import { submitForm } from "@formkit/core"; -import useSlugify from "@/composables/use-slugify"; +import useSlugify from "@console/composables/use-slugify"; import { useI18n } from "vue-i18n"; import { usePostUpdateMutate } from "../composables/use-post-update-mutate"; import { FormType } from "@/types/slug"; diff --git a/console/src/modules/contents/posts/components/__tests__/PostSettingModal.spec.ts b/console/console-src/modules/contents/posts/components/__tests__/PostSettingModal.spec.ts similarity index 100% rename from console/src/modules/contents/posts/components/__tests__/PostSettingModal.spec.ts rename to console/console-src/modules/contents/posts/components/__tests__/PostSettingModal.spec.ts diff --git a/console/src/modules/contents/posts/components/entity-fields/ContributorsField.vue b/console/console-src/modules/contents/posts/components/entity-fields/ContributorsField.vue similarity index 80% rename from console/src/modules/contents/posts/components/entity-fields/ContributorsField.vue rename to console/console-src/modules/contents/posts/components/entity-fields/ContributorsField.vue index 148ce8f9af..87b609032a 100644 --- a/console/src/modules/contents/posts/components/entity-fields/ContributorsField.vue +++ b/console/console-src/modules/contents/posts/components/entity-fields/ContributorsField.vue @@ -1,7 +1,7 @@ diff --git a/console/src/modules/system/users/widgets/UserStatsWidget.vue b/console/console-src/modules/system/users/widgets/UserStatsWidget.vue similarity index 100% rename from console/src/modules/system/users/widgets/UserStatsWidget.vue rename to console/console-src/modules/system/users/widgets/UserStatsWidget.vue diff --git a/console/src/router/guards/auth-check.ts b/console/console-src/router/guards/auth-check.ts similarity index 100% rename from console/src/router/guards/auth-check.ts rename to console/console-src/router/guards/auth-check.ts diff --git a/console/src/router/guards/check-states.ts b/console/console-src/router/guards/check-states.ts similarity index 100% rename from console/src/router/guards/check-states.ts rename to console/console-src/router/guards/check-states.ts diff --git a/console/src/router/guards/permission.ts b/console/console-src/router/guards/permission.ts similarity index 100% rename from console/src/router/guards/permission.ts rename to console/console-src/router/guards/permission.ts diff --git a/console/src/router/index.ts b/console/console-src/router/index.ts similarity index 92% rename from console/src/router/index.ts rename to console/console-src/router/index.ts index 20d397cb05..50ad60ae0e 100644 --- a/console/src/router/index.ts +++ b/console/console-src/router/index.ts @@ -4,7 +4,7 @@ import { type RouteLocationNormalized, type RouteLocationNormalizedLoaded, } from "vue-router"; -import routesConfig from "@/router/routes.config"; +import routesConfig from "@console/router/routes.config"; import { setupPermissionGuard } from "./guards/permission"; import { setupCheckStatesGuard } from "./guards/check-states"; import { setupAuthCheckGuard } from "./guards/auth-check"; diff --git a/console/src/router/routes.config.ts b/console/console-src/router/routes.config.ts similarity index 78% rename from console/src/router/routes.config.ts rename to console/console-src/router/routes.config.ts index 18704b7920..9d0c755a37 100644 --- a/console/src/router/routes.config.ts +++ b/console/console-src/router/routes.config.ts @@ -1,11 +1,11 @@ import type { RouteRecordRaw } from "vue-router"; -import NotFound from "@/views/exceptions/NotFound.vue"; -import Forbidden from "@/views/exceptions/Forbidden.vue"; -import BasicLayout from "@/layouts/BasicLayout.vue"; -import Setup from "@/views/system/Setup.vue"; -import Redirect from "@/views/system/Redirect.vue"; +import NotFound from "@console/views/exceptions/NotFound.vue"; +import Forbidden from "@console/views/exceptions/Forbidden.vue"; +import BasicLayout from "@console/layouts/BasicLayout.vue"; +import Setup from "@console/views/system/Setup.vue"; +import Redirect from "@console/views/system/Redirect.vue"; import type { MenuGroupType } from "@halo-dev/console-shared"; -import SetupInitialData from "@/views/system/SetupInitialData.vue"; +import SetupInitialData from "@console/views/system/SetupInitialData.vue"; export const routes: Array = [ { diff --git a/console/src/stores/system-configmap.ts b/console/console-src/stores/system-configmap.ts similarity index 100% rename from console/src/stores/system-configmap.ts rename to console/console-src/stores/system-configmap.ts diff --git a/console/src/stores/theme.ts b/console/console-src/stores/theme.ts similarity index 100% rename from console/src/stores/theme.ts rename to console/console-src/stores/theme.ts diff --git a/console/src/styles/index.css b/console/console-src/styles/index.css similarity index 100% rename from console/src/styles/index.css rename to console/console-src/styles/index.css diff --git a/console/src/styles/tailwind.css b/console/console-src/styles/tailwind.css similarity index 100% rename from console/src/styles/tailwind.css rename to console/console-src/styles/tailwind.css diff --git a/console/src/views/exceptions/Forbidden.vue b/console/console-src/views/exceptions/Forbidden.vue similarity index 100% rename from console/src/views/exceptions/Forbidden.vue rename to console/console-src/views/exceptions/Forbidden.vue diff --git a/console/src/views/exceptions/NotFound.vue b/console/console-src/views/exceptions/NotFound.vue similarity index 100% rename from console/src/views/exceptions/NotFound.vue rename to console/console-src/views/exceptions/NotFound.vue diff --git a/console/src/views/exceptions/__tests__/NotFound.spec.ts b/console/console-src/views/exceptions/__tests__/NotFound.spec.ts similarity index 100% rename from console/src/views/exceptions/__tests__/NotFound.spec.ts rename to console/console-src/views/exceptions/__tests__/NotFound.spec.ts diff --git a/console/src/views/exceptions/components/Exception.vue b/console/console-src/views/exceptions/components/Exception.vue similarity index 100% rename from console/src/views/exceptions/components/Exception.vue rename to console/console-src/views/exceptions/components/Exception.vue diff --git a/console/src/views/system/Redirect.vue b/console/console-src/views/system/Redirect.vue similarity index 100% rename from console/src/views/system/Redirect.vue rename to console/console-src/views/system/Redirect.vue diff --git a/console/src/views/system/Setup.vue b/console/console-src/views/system/Setup.vue similarity index 100% rename from console/src/views/system/Setup.vue rename to console/console-src/views/system/Setup.vue diff --git a/console/src/views/system/SetupInitialData.vue b/console/console-src/views/system/SetupInitialData.vue similarity index 100% rename from console/src/views/system/SetupInitialData.vue rename to console/console-src/views/system/SetupInitialData.vue diff --git a/console/src/views/system/setup-data/category.json b/console/console-src/views/system/setup-data/category.json similarity index 100% rename from console/src/views/system/setup-data/category.json rename to console/console-src/views/system/setup-data/category.json diff --git a/console/src/views/system/setup-data/menu-items.json b/console/console-src/views/system/setup-data/menu-items.json similarity index 100% rename from console/src/views/system/setup-data/menu-items.json rename to console/console-src/views/system/setup-data/menu-items.json diff --git a/console/src/views/system/setup-data/menu.json b/console/console-src/views/system/setup-data/menu.json similarity index 100% rename from console/src/views/system/setup-data/menu.json rename to console/console-src/views/system/setup-data/menu.json diff --git a/console/src/views/system/setup-data/post.json b/console/console-src/views/system/setup-data/post.json similarity index 100% rename from console/src/views/system/setup-data/post.json rename to console/console-src/views/system/setup-data/post.json diff --git a/console/src/views/system/setup-data/singlePage.json b/console/console-src/views/system/setup-data/singlePage.json similarity index 100% rename from console/src/views/system/setup-data/singlePage.json rename to console/console-src/views/system/setup-data/singlePage.json diff --git a/console/src/views/system/setup-data/tag.json b/console/console-src/views/system/setup-data/tag.json similarity index 100% rename from console/src/views/system/setup-data/tag.json rename to console/console-src/views/system/setup-data/tag.json diff --git a/console/docs/project-structure/README.md b/console/docs/project-structure/README.md new file mode 100644 index 0000000000..63984b8933 --- /dev/null +++ b/console/docs/project-structure/README.md @@ -0,0 +1,61 @@ +# 项目结构 + +此目录为 Halo 前端项目的根目录,包含 Console 和 User Center 两部分。 + +## 名词解释 + +- Console:管理控制台,主要包含内容管理、系统管理、插件、主题等面向管理员的功能。 +- User Center:用户中心,主要面向单个用户。 + +## 目录结构 + +```bash +├── console-src # Console 部分的源码 +│ ├── composables +│ ├── layouts +│ ├── modules +│ ├── router +│ ├── stores +│ ├── styles +│ ├── views +│ ├── App.vue +│ └── main.ts +├── packages # 公共库,会在 Halo 发布版本的时候发布到 npmjs.com +│ ├── api-client # 根据 OpenAPI 生成的 API 客户端 +│ ├── components # 基础组件库 +│ └── shared # 共享库,主要提供给插件使用 +├── src # Console 和 User Center 共享的源码 +│ ├── assets +│ ├── components +│ ├── constants +│ ├── formkit +│ ├── locales +│ ├── setup +│ ├── stores +│ ├── types +│ ├── utils +│ └── vite +├── uc-src # User Center 部分的源码 +│ ├── router +│ ├── App.vue +│ └── main.ts +├── env.d.ts +├── index.html +├── package.json +├── pnpm-lock.yaml +├── pnpm-workspace.yaml +├── postcss.config.js +├── prettier.config.js +├── tailwind.config.js +├── tsconfig.app.json +├── tsconfig.json +├── tsconfig.node.json +├── tsconfig.vitest.json +├── vite.config.ts # Console 的 Vite 配置,使用 `--config` 指定 +├── vite.uc.config.ts # User Center 的 Vite 配置,使用 `--config` 指定 +└── vitest.config.ts +``` + +可以注意到 Console 和 User Center 仅仅只是使用了目录和 Vite 配置进行区分,本质上还是同一个项目,启动 Dev Server 的时候会同时启动两个 Vite 服务,路径分别为 `/console` 和 `/uc`。 + +同时,在构建时,会将 Console 和 User Center 两部分分别构建为两个独立的项目,构建后的文件会分别放在后端的 `application/src/main/resources/console` 和 `application/src/main/resources/uc` 目录下,最终通过 Halo 本身进行托管。 diff --git a/console/docs/routes-generation/README.md b/console/docs/routes-generation/README.md index cbec57be53..966c2ea259 100644 --- a/console/docs/routes-generation/README.md +++ b/console/docs/routes-generation/README.md @@ -15,7 +15,7 @@ ```ts import { definePlugin } from "@halo-dev/console-shared"; -import BasicLayout from "@/layouts/BasicLayout.vue"; +import BasicLayout from "@console/layouts/BasicLayout.vue"; import AttachmentList from "./AttachmentList.vue"; import AttachmentSelectorModal from "./components/AttachmentSelectorModal.vue"; import { IconFolder } from "@halo-dev/components"; diff --git a/console/src/components/dropdown-selector/EditorProviderSelector.vue b/console/src/components/dropdown-selector/EditorProviderSelector.vue index 12b6dbc00f..733ce07c28 100644 --- a/console/src/components/dropdown-selector/EditorProviderSelector.vue +++ b/console/src/components/dropdown-selector/EditorProviderSelector.vue @@ -1,5 +1,5 @@