Skip to content

Commit 75693a9

Browse files
Merge pull request #672 from A-kirami/feat/auto-build-info
feat: Automatically inject build information
2 parents fe65546 + 5640ad2 commit 75693a9

6 files changed

Lines changed: 124 additions & 3 deletions

File tree

packages/webgal/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"prettier": "^2.6.2",
5151
"rollup-plugin-visualizer": "^5.6.0",
5252
"typescript": "^4.5.4",
53+
"unplugin-info": "^1.2.2",
5354
"vite": "^4.5.5"
5455
}
5556
}

packages/webgal/src/Core/initializeScript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // 判断是否
2323
*/
2424
export const initializeScript = (): void => {
2525
// 打印初始log信息
26-
logger.info(__INFO.version);
26+
logger.info(`WebGAL v${__INFO.version}`);
2727
logger.info('Github: https://github.com/OpenWebGAL/WebGAL ');
2828
logger.info('Made with ❤ by OpenWebGAL');
2929
// 激活强制缩放

packages/webgal/src/config/info.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import { version } from '~build/package';
2+
13
export const __INFO = {
2-
version: 'WebGAL 4.5.12',
4+
version,
35
contributors: [
46
// 现在改为跳转到 GitHub 了
57
],

packages/webgal/src/vite-env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/// <reference types="vite/client" />
2+
/// <reference types="unplugin-info/client" />

packages/webgal/vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { resolve, relative } from 'path';
55
import { visualizer } from 'rollup-plugin-visualizer';
66
import { readdirSync, watch, writeFileSync } from 'fs';
77
import { isEqual } from 'lodash';
8+
import Info from 'unplugin-info/vite';
9+
810
// https://vitejs.dev/config/
911

1012
// @ts-ignore
@@ -49,6 +51,7 @@ export default defineConfig({
4951
plugins: [
5052
react(),
5153
loadVersion(),
54+
Info(),
5255
// @ts-ignore
5356
// visualizer(),
5457
],

yarn.lock

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,18 @@
582582
"@jridgewell/resolve-uri" "^3.1.0"
583583
"@jridgewell/sourcemap-codec" "^1.4.14"
584584

585+
"@kwsites/file-exists@^1.1.1":
586+
version "1.1.1"
587+
resolved "https://registry.yarnpkg.com/@kwsites/file-exists/-/file-exists-1.1.1.tgz#ad1efcac13e1987d8dbaf235ef3be5b0d96faa99"
588+
integrity sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==
589+
dependencies:
590+
debug "^4.1.1"
591+
592+
"@kwsites/promise-deferred@^1.1.1":
593+
version "1.1.1"
594+
resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919"
595+
integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==
596+
585597
"@nodelib/fs.scandir@2.1.5":
586598
version "2.1.5"
587599
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
@@ -1150,6 +1162,11 @@
11501162
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.2.tgz#5950e50960793055845e956c427fc2b0d70c5239"
11511163
integrity sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==
11521164

1165+
"@types/parse-path@^7.0.0":
1166+
version "7.0.3"
1167+
resolved "https://registry.yarnpkg.com/@types/parse-path/-/parse-path-7.0.3.tgz#cec2da2834ab58eb2eb579122d9a1fc13bd7ef36"
1168+
integrity sha512-LriObC2+KYZD3FzCrgWGv/qufdUy4eXrxcLgQMfYXgPbLIecKIsVBaQgUPmxSSLcjmYbDTQbMgr6qr6l/eb7Bg==
1169+
11531170
"@types/prop-types@*":
11541171
version "15.7.12"
11551172
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.12.tgz#12bb1e2be27293c1406acb6af1c3f3a1481d98c6"
@@ -1379,6 +1396,11 @@ acorn@^8.10.0, acorn@^8.11.3, acorn@^8.4.1, acorn@^8.8.1, acorn@^8.8.2, acorn@^8
13791396
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a"
13801397
integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==
13811398

1399+
acorn@^8.14.1:
1400+
version "8.14.1"
1401+
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.1.tgz#721d5dc10f7d5b5609a891773d47731796935dfb"
1402+
integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==
1403+
13821404
agent-base@6:
13831405
version "6.0.2"
13841406
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-6.0.2.tgz#49fff58577cfee3f37176feab4c22e00f86d7f77"
@@ -1853,6 +1875,11 @@ chownr@^1.1.1:
18531875
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b"
18541876
integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==
18551877

1878+
ci-info@^4.2.0:
1879+
version "4.2.0"
1880+
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.2.0.tgz#cbd21386152ebfe1d56f280a3b5feccbd96764c7"
1881+
integrity sha512-cYY9mypksY8NRqgDB1XD1RiJL338v/551niynFTGkZOO2LHuB2OmOYxDIe/ttN9AHwrqdum1360G3ald0W9kCg==
1882+
18561883
clean-stack@^2.0.0:
18571884
version "2.2.0"
18581885
resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b"
@@ -2077,6 +2104,13 @@ debug@4, debug@^4.1.0, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4:
20772104
dependencies:
20782105
ms "2.1.2"
20792106

2107+
debug@^4.1.1, debug@^4.3.5:
2108+
version "4.4.0"
2109+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a"
2110+
integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==
2111+
dependencies:
2112+
ms "^2.1.3"
2113+
20802114
decompress-response@^6.0.0:
20812115
version "6.0.0"
20822116
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc"
@@ -2931,6 +2965,21 @@ gh-pages@^4.0.0:
29312965
fs-extra "^8.1.0"
29322966
globby "^6.1.0"
29332967

2968+
git-up@^8.1.0:
2969+
version "8.1.1"
2970+
resolved "https://registry.yarnpkg.com/git-up/-/git-up-8.1.1.tgz#06262adadb89a4a614d2922d803a0eda054be8c5"
2971+
integrity sha512-FDenSF3fVqBYSaJoYy1KSc2wosx0gCvKP+c+PRBht7cAaiCeQlBtfBDX9vgnNOHmdePlSFITVcn4pFfcgNvx3g==
2972+
dependencies:
2973+
is-ssh "^1.4.0"
2974+
parse-url "^9.2.0"
2975+
2976+
git-url-parse@^16.1.0:
2977+
version "16.1.0"
2978+
resolved "https://registry.yarnpkg.com/git-url-parse/-/git-url-parse-16.1.0.tgz#3bb6f378a2ba2903c4d8b1cdec004aa85a7ab66f"
2979+
integrity sha512-cPLz4HuK86wClEW7iDdeAKcCVlWXmrLpb2L+G9goW0Z1dtpNS6BXXSOckUTlJT/LDQViE1QZKstNORzHsLnobw==
2980+
dependencies:
2981+
git-up "^8.1.0"
2982+
29342983
github-from-package@0.0.0:
29352984
version "0.0.0"
29362985
resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce"
@@ -3410,6 +3459,13 @@ is-shared-array-buffer@^1.0.2, is-shared-array-buffer@^1.0.3:
34103459
dependencies:
34113460
call-bind "^1.0.7"
34123461

3462+
is-ssh@^1.4.0:
3463+
version "1.4.1"
3464+
resolved "https://registry.yarnpkg.com/is-ssh/-/is-ssh-1.4.1.tgz#76de1cdbe8f92a8b905d1a172b6bc09704c20396"
3465+
integrity sha512-JNeu1wQsHjyHgn9NcWTaXq6zWSR6hqE0++zhfZlkFBbScNkyvxCdeV8sRkSBaeLKxmbpR21brail63ACNxJ0Tg==
3466+
dependencies:
3467+
protocols "^2.0.1"
3468+
34133469
is-stream@^2.0.0:
34143470
version "2.0.1"
34153471
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077"
@@ -3873,7 +3929,7 @@ ms@2.1.2:
38733929
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
38743930
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==
38753931

3876-
ms@2.1.3:
3932+
ms@2.1.3, ms@^2.1.3:
38773933
version "2.1.3"
38783934
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
38793935
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
@@ -4115,6 +4171,21 @@ parse-json@^5.0.0:
41154171
json-parse-even-better-errors "^2.3.0"
41164172
lines-and-columns "^1.1.6"
41174173

4174+
parse-path@^7.0.0:
4175+
version "7.1.0"
4176+
resolved "https://registry.yarnpkg.com/parse-path/-/parse-path-7.1.0.tgz#41fb513cb122831807a4c7b29c8727947a09d8c6"
4177+
integrity sha512-EuCycjZtfPcjWk7KTksnJ5xPMvWGA/6i4zrLYhRG0hGvC3GPU/jGUj3Cy+ZR0v30duV3e23R95T1lE2+lsndSw==
4178+
dependencies:
4179+
protocols "^2.0.0"
4180+
4181+
parse-url@^9.2.0:
4182+
version "9.2.0"
4183+
resolved "https://registry.yarnpkg.com/parse-url/-/parse-url-9.2.0.tgz#d75da32b3bbade66e4eb0763fb4851d27526b97b"
4184+
integrity sha512-bCgsFI+GeGWPAvAiUv63ZorMeif3/U0zaXABGJbOWt5OH2KCaPHF6S+0ok4aqM9RuIPGyZdx9tR9l13PsW4AYQ==
4185+
dependencies:
4186+
"@types/parse-path" "^7.0.0"
4187+
parse-path "^7.0.0"
4188+
41184189
parseurl@~1.3.3:
41194190
version "1.3.3"
41204191
resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4"
@@ -4170,6 +4241,11 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.3.1:
41704241
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
41714242
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
41724243

4244+
picomatch@^4.0.2:
4245+
version "4.0.2"
4246+
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-4.0.2.tgz#77c742931e8f3b8820946c76cd0c1f13730d1dab"
4247+
integrity sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==
4248+
41734249
pidtree@^0.5.0:
41744250
version "0.5.0"
41754251
resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.5.0.tgz#ad5fbc1de78b8a5f99d6fbdd4f6e4eee21d1aca1"
@@ -4421,6 +4497,11 @@ prop-types@^15.8.1:
44214497
object-assign "^4.1.1"
44224498
react-is "^16.13.1"
44234499

4500+
protocols@^2.0.0, protocols@^2.0.1:
4501+
version "2.0.2"
4502+
resolved "https://registry.yarnpkg.com/protocols/-/protocols-2.0.2.tgz#822e8fcdcb3df5356538b3e91bfd890b067fd0a4"
4503+
integrity sha512-hHVTzba3wboROl0/aWRRG9dMytgH6ow//STBZh43l/wQgmMhYhOFi0EHWAPtoCz9IAUymsyP0TSBHkhgMEGNnQ==
4504+
44244505
proxy-addr@~2.0.7:
44254506
version "2.0.7"
44264507
resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025"
@@ -4936,6 +5017,15 @@ simple-get@^4.0.0:
49365017
once "^1.3.1"
49375018
simple-concat "^1.0.0"
49385019

5020+
simple-git@^3.27.0:
5021+
version "3.27.0"
5022+
resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-3.27.0.tgz#f4b09e807bda56a4a3968f635c0e4888d3decbd5"
5023+
integrity sha512-ivHoFS9Yi9GY49ogc6/YAi3Fl9ROnF4VyubNylgCkA+RVqLaKWnDSzXOVzya8csELIaWaYNutsEuAhZrtOjozA==
5024+
dependencies:
5025+
"@kwsites/file-exists" "^1.1.1"
5026+
"@kwsites/promise-deferred" "^1.1.1"
5027+
debug "^4.3.5"
5028+
49395029
slash@^3.0.0:
49405030
version "3.0.0"
49415031
resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
@@ -5447,6 +5537,25 @@ unpipe@1.0.0, unpipe@~1.0.0:
54475537
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
54485538
integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==
54495539

5540+
unplugin-info@^1.2.2:
5541+
version "1.2.2"
5542+
resolved "https://registry.yarnpkg.com/unplugin-info/-/unplugin-info-1.2.2.tgz#9ca9caad4a726c5f234570969cf1133c27788c06"
5543+
integrity sha512-GiDA/pC+qRerudmIZ9TM7eEwdg4GA0DMdNHfRDP00QWV6XEQeiKckhibubehrqJkrOZlyALBVCF7DqQvaYgC4w==
5544+
dependencies:
5545+
ci-info "^4.2.0"
5546+
git-url-parse "^16.1.0"
5547+
simple-git "^3.27.0"
5548+
unplugin "^2.3.2"
5549+
5550+
unplugin@^2.3.2:
5551+
version "2.3.2"
5552+
resolved "https://registry.yarnpkg.com/unplugin/-/unplugin-2.3.2.tgz#36c93a1662b70c97a2e2fc45c0e78fa09f7a4984"
5553+
integrity sha512-3n7YA46rROb3zSj8fFxtxC/PqoyvYQ0llwz9wtUPUutr9ig09C8gGo5CWCwHrUzlqC1LLR43kxp5vEIyH1ac1w==
5554+
dependencies:
5555+
acorn "^8.14.1"
5556+
picomatch "^4.0.2"
5557+
webpack-virtual-modules "^0.6.2"
5558+
54505559
update-browserslist-db@^1.0.13:
54515560
version "1.0.13"
54525561
resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz#3c5e4f5c083661bd38ef64b6328c26ed6c8248c4"
@@ -5579,6 +5688,11 @@ webidl-conversions@^3.0.0:
55795688
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
55805689
integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==
55815690

5691+
webpack-virtual-modules@^0.6.2:
5692+
version "0.6.2"
5693+
resolved "https://registry.yarnpkg.com/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz#057faa9065c8acf48f24cb57ac0e77739ab9a7e8"
5694+
integrity sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==
5695+
55825696
whatwg-url@^5.0.0:
55835697
version "5.0.0"
55845698
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"

0 commit comments

Comments
 (0)