feat: build infrastructure for user center feature (#4806)

#### 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
```
pull/4851/head
Ryan Wang 2023-11-02 17:00:28 +08:00 committed by GitHub
parent b9c0a1f1d0
commit 8c56093ee2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 550 additions and 132 deletions

View File

View File

@ -52,6 +52,6 @@
<div id="app">
<div id="loader"></div>
</div>
<script src="/src/main.ts" type="module"></script>
<script src="<%- entry %>" type="module"></script>
</body>
</html>

View File

@ -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",

View File

@ -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

View File

@ -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,
},
});
}

View File

@ -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,
},
},
}),
];

View File

@ -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: {

View File

@ -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",

View File

@ -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,

19
console/uc-src/App.vue Normal file
View File

@ -0,0 +1,19 @@
<script lang="ts" setup>
import { useQuery } from "@tanstack/vue-query";
const { data, isLoading } = useQuery({
queryKey: ["user"],
queryFn: async () => {
const response = await fetch(`/apis/api.console.halo.run/v1alpha1/users/-`);
const data = await response.json();
return data;
},
});
</script>
<template>
<div v-if="isLoading">Loading...</div>
<div v-else>
Hi {{ data.user.spec.displayName }}, here is user center page.
</div>
</template>

8
console/uc-src/main.ts Normal file
View File

@ -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");

View File

@ -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,
},
});
};

12
console/vite.uc.config.ts Normal file
View File

@ -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,
});
};

View File

@ -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: {