feat: 1. Update workflow.
2. Add git commit hash
This commit is contained in:
parent
a793cdd512
commit
7c75fa3f51
14
.github/workflows/deploy-pages.yml
vendored
14
.github/workflows/deploy-pages.yml
vendored
@ -47,16 +47,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
- name: Setup Pages
|
|
||||||
uses: actions/configure-pages@v3
|
- name: Deploy to gh-pages
|
||||||
- name: Upload artifact
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
uses: actions/upload-pages-artifact@v1
|
|
||||||
with:
|
with:
|
||||||
# Upload dist repository
|
deploy_key: ${{ secrets.GITHUB_TOKEN }}
|
||||||
path: './dist'
|
publish_dir: ./dist
|
||||||
- name: Deploy to GitHub Pages
|
|
||||||
id: deployment
|
|
||||||
uses: actions/deploy-pages@v1
|
|
||||||
|
|
||||||
- name: Sync to Gitee
|
- name: Sync to Gitee
|
||||||
uses: wearerequired/git-mirror-action@master
|
uses: wearerequired/git-mirror-action@master
|
||||||
|
|||||||
2
env.d.ts
vendored
2
env.d.ts
vendored
@ -1,5 +1,7 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
declare const LATEST_COMMIT_HASH: string
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Navigator {
|
interface Navigator {
|
||||||
control: any
|
control: any
|
||||||
|
|||||||
@ -65,7 +65,8 @@
|
|||||||
"vite": "^5.1.7",
|
"vite": "^5.1.7",
|
||||||
"vite-plugin-cdn-import": "0.3.5",
|
"vite-plugin-cdn-import": "0.3.5",
|
||||||
"vite-plugin-commonjs": "^0.10.1",
|
"vite-plugin-commonjs": "^0.10.1",
|
||||||
"vue-tsc": "^2.0.6"
|
"vue-tsc": "^2.0.6",
|
||||||
|
"git-last-commit": "^1.0.1"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,ts,vue,jsx,tsx}": [
|
"*.{js,ts,vue,jsx,tsx}": [
|
||||||
|
|||||||
@ -103,6 +103,9 @@ devDependencies:
|
|||||||
eslint-plugin-vue:
|
eslint-plugin-vue:
|
||||||
specifier: ^9.17.0
|
specifier: ^9.17.0
|
||||||
version: 9.24.0(eslint@8.57.0)
|
version: 9.24.0(eslint@8.57.0)
|
||||||
|
git-last-commit:
|
||||||
|
specifier: ^1.0.1
|
||||||
|
version: 1.0.1
|
||||||
husky:
|
husky:
|
||||||
specifier: ^9.0.11
|
specifier: ^9.0.11
|
||||||
version: 9.0.11
|
version: 9.0.11
|
||||||
@ -2465,6 +2468,10 @@ packages:
|
|||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/git-last-commit@1.0.1:
|
||||||
|
resolution: {integrity: sha512-FDSgeMqa7GnJDxt/q0AbrxbfeTyxp4ImxEw1e4nw6NUHA5FMhFUq33dTXI4Xdgcj1VQ1q5QLWF6WxFrJ8KCBOg==}
|
||||||
|
dev: true
|
||||||
|
|
||||||
/git-raw-commits@4.0.0:
|
/git-raw-commits@4.0.0:
|
||||||
resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==}
|
resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
|
|||||||
20
src/App.vue
20
src/App.vue
@ -6,16 +6,16 @@
|
|||||||
</keep-alive>
|
</keep-alive>
|
||||||
</transition>
|
</transition>
|
||||||
</router-view>
|
</router-view>
|
||||||
<!-- <BaseMask v-if="!isMobile" />-->
|
<BaseMask v-if="!isMobile" />
|
||||||
<!-- <div v-if="!isMobile" class="guide">-->
|
<div v-if="!isMobile" class="guide">
|
||||||
<!-- <Icon icon="mynaui:danger-triangle" />-->
|
<Icon icon="mynaui:danger-triangle" />
|
||||||
<!-- <div class="txt">-->
|
<div class="txt">
|
||||||
<!-- <h2>切换至手机模式才可正常使用</h2>-->
|
<h2>切换至手机模式才可正常使用</h2>
|
||||||
<!-- <h3>1. 按 F12 调出控制台</h3>-->
|
<h3>1. 按 F12 调出控制台</h3>
|
||||||
<!-- <h3>2. 按 Ctrl+Shift+M,或点击下面图标</h3>-->
|
<h3>2. 按 Ctrl+Shift+M,或点击下面图标</h3>
|
||||||
<!-- </div>-->
|
</div>
|
||||||
<!-- <img src="@/assets/img/guide.png" alt="" />-->
|
<img src="@/assets/img/guide.png" alt="" />
|
||||||
<!-- </div>-->
|
</div>
|
||||||
<Call />
|
<Call />
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|||||||
@ -172,18 +172,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="version">抖音 version{{ store.version }}</div>
|
<div class="version">抖音 {{ gitLastCommitHash }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useBaseStore } from '@/store/pinia'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
|
const gitLastCommitHash = ref(LATEST_COMMIT_HASH)
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'ChooseSchool'
|
name: 'ChooseSchool'
|
||||||
})
|
})
|
||||||
|
|
||||||
const store = useBaseStore()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|||||||
318
vite.config.ts
318
vite.config.ts
@ -7,6 +7,7 @@ import DefineOptions from 'unplugin-vue-define-options/vite' // 引入插件
|
|||||||
import { Plugin as importToCDN } from 'vite-plugin-cdn-import'
|
import { Plugin as importToCDN } from 'vite-plugin-cdn-import'
|
||||||
import commonjs from 'vite-plugin-commonjs'
|
import commonjs from 'vite-plugin-commonjs'
|
||||||
import { fileURLToPath, URL } from 'node:url'
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
import { getLastCommit } from 'git-last-commit'
|
||||||
|
|
||||||
// import viteImagemin from 'vite-plugin-imagemin'
|
// import viteImagemin from 'vite-plugin-imagemin'
|
||||||
// import viteCompression from 'vite-plugin-compression'
|
// import viteCompression from 'vite-plugin-compression'
|
||||||
@ -18,162 +19,173 @@ const lifecycle = process.env.npm_lifecycle_event
|
|||||||
// var: 'axios',
|
// var: 'axios',
|
||||||
// path: 'https://lib.baomitu.com/axios/1.6.8/axios.min.js'
|
// path: 'https://lib.baomitu.com/axios/1.6.8/axios.min.js'
|
||||||
// },
|
// },
|
||||||
export default defineConfig({
|
|
||||||
base: './',
|
|
||||||
envDir: 'env',
|
|
||||||
plugins: [
|
|
||||||
// VueMacros({
|
|
||||||
// plugins: {
|
|
||||||
// vue: Vue(),
|
|
||||||
// vueJsx: VueJsx(), // if needed
|
|
||||||
// },
|
|
||||||
// betterDefine: true,
|
|
||||||
// // reactivityTransform: {
|
|
||||||
// // exclude: [/node_modules/, /jQuery\.js/]
|
|
||||||
// // }
|
|
||||||
// }),
|
|
||||||
lifecycle === 'report' ? (visualizer({ open: false }) as any as PluginOption) : null,
|
|
||||||
DefineOptions(),
|
|
||||||
Vue(),
|
|
||||||
VueJsx(),
|
|
||||||
importToCDN({
|
|
||||||
modules: [
|
|
||||||
{
|
|
||||||
name: 'vue',
|
|
||||||
var: 'Vue',
|
|
||||||
path: `https://lib.baomitu.com/vue/3.4.21/vue.runtime.global.prod.min.js`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'vue-router',
|
|
||||||
var: 'VueRouter',
|
|
||||||
path: 'https://lib.baomitu.com/vue-router/4.3.0/vue-router.global.prod.min.js'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'vue-demi',
|
|
||||||
var: 'VueDemi',
|
|
||||||
path: 'https://lib.baomitu.com/vue-demi/0.14.7/index.iife.min.js'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'mockjs',
|
|
||||||
var: 'Mock',
|
|
||||||
path: 'https://lib.baomitu.com/Mock.js/1.0.1-beta3/mock-min.js'
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
export default defineConfig(async () => {
|
||||||
name: 'jquery',
|
const latestCommitHash = await new Promise<string>((resolve) => {
|
||||||
var: '$',
|
return getLastCommit((err, commit) => (err ? 'unknown' : resolve(commit.shortHash)))
|
||||||
path: 'https://lib.baomitu.com/jquery/3.6.0/jquery.min.js'
|
})
|
||||||
}
|
return {
|
||||||
]
|
base: './',
|
||||||
})
|
envDir: 'env',
|
||||||
// viteCompression({
|
plugins: [
|
||||||
// verbose: false,
|
// VueMacros({
|
||||||
// disable: false,
|
// plugins: {
|
||||||
// threshold: 10240,
|
// vue: Vue(),
|
||||||
// algorithm: 'brotliCompress',
|
// vueJsx: VueJsx(), // if needed
|
||||||
// }),
|
// },
|
||||||
// viteCompression({
|
// betterDefine: true,
|
||||||
// verbose: false,
|
// // reactivityTransform: {
|
||||||
// disable: false,
|
// // exclude: [/node_modules/, /jQuery\.js/]
|
||||||
// algorithm: 'gzip',
|
// // }
|
||||||
// threshold: 10240,
|
// }),
|
||||||
// }),
|
lifecycle === 'report' ? (visualizer({ open: false }) as any as PluginOption) : null,
|
||||||
// viteImagemin({
|
DefineOptions(),
|
||||||
// gifsicle: {
|
Vue(),
|
||||||
// optimizationLevel: 7,
|
VueJsx(),
|
||||||
// interlaced: false,
|
importToCDN({
|
||||||
// },
|
modules: [
|
||||||
// optipng: {
|
{
|
||||||
// optimizationLevel: 7,
|
name: 'vue',
|
||||||
// },
|
var: 'Vue',
|
||||||
// mozjpeg: {
|
path: `https://lib.baomitu.com/vue/3.4.21/vue.runtime.global.prod.min.js`
|
||||||
// quality: 20,
|
},
|
||||||
// },
|
{
|
||||||
// pngquant: {
|
name: 'vue-router',
|
||||||
// quality: [0.8, 0.9],
|
var: 'VueRouter',
|
||||||
// speed: 4,
|
path: 'https://lib.baomitu.com/vue-router/4.3.0/vue-router.global.prod.min.js'
|
||||||
// },
|
},
|
||||||
// svgo: {
|
{
|
||||||
// plugins: [
|
name: 'vue-demi',
|
||||||
// {
|
var: 'VueDemi',
|
||||||
// name: 'removeViewBox',
|
path: 'https://lib.baomitu.com/vue-demi/0.14.7/index.iife.min.js'
|
||||||
// },
|
},
|
||||||
// {
|
{
|
||||||
// name: 'removeEmptyAttrs',
|
name: 'mockjs',
|
||||||
// active: false,
|
var: 'Mock',
|
||||||
// },
|
path: 'https://lib.baomitu.com/Mock.js/1.0.1-beta3/mock-min.js'
|
||||||
// ],
|
},
|
||||||
// },
|
|
||||||
// }),
|
{
|
||||||
],
|
name: 'jquery',
|
||||||
resolve: {
|
var: '$',
|
||||||
alias: {
|
path: 'https://lib.baomitu.com/jquery/3.6.0/jquery.min.js'
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
||||||
},
|
|
||||||
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
|
||||||
},
|
|
||||||
build: {
|
|
||||||
sourcemap: false,
|
|
||||||
rollupOptions: {
|
|
||||||
// https://rollupjs.org/guide/en/#outputmanualchunks
|
|
||||||
output: {
|
|
||||||
manualChunks(id, { getModuleInfo }) {
|
|
||||||
const reg = /(.*)\/src\/components\/(.*)/
|
|
||||||
if (reg.test(id)) {
|
|
||||||
const importersLen = getModuleInfo(id)?.importers.length ?? 0
|
|
||||||
// 被多处引用
|
|
||||||
if (importersLen > 1) return 'common'
|
|
||||||
}
|
}
|
||||||
if (id.includes('node_modules')) return 'vendor'
|
]
|
||||||
|
})
|
||||||
if (id.includes('/src/pages/home/Publish.vue')) return 'other'
|
// viteCompression({
|
||||||
|
// verbose: false,
|
||||||
if (id.includes('/src/pages/home/Music.vue')) return 'other'
|
// disable: false,
|
||||||
if (id.includes('/src/pages/home/MusicRankList.vue')) return 'other'
|
// threshold: 10240,
|
||||||
if (id.includes('/src/pages/home/LivePage.vue')) return 'other'
|
// algorithm: 'brotliCompress',
|
||||||
if (id.includes('/src/pages/home/SearchPage.vue')) return 'other'
|
// }),
|
||||||
|
// viteCompression({
|
||||||
if (id.includes('/src/pages/shop/Shop.vue')) return 'other'
|
// verbose: false,
|
||||||
if (id.includes('/src/pages/shop/GoodsDetail.vue')) return 'other'
|
// disable: false,
|
||||||
|
// algorithm: 'gzip',
|
||||||
if (id.includes('/src/pages/message/Message.vue')) return 'other'
|
// threshold: 10240,
|
||||||
if (id.includes('/src/pages/message/Fans.vue')) return 'other'
|
// }),
|
||||||
if (id.includes('/src/pages/message/AllMessage.vue')) return 'other'
|
// viteImagemin({
|
||||||
if (id.includes('/src/pages/message/notice/DouyinHelper.vue')) return 'other'
|
// gifsicle: {
|
||||||
if (id.includes('/src/pages/message/notice/SystemNotice.vue')) return 'other'
|
// optimizationLevel: 7,
|
||||||
if (id.includes('/src/pages/message/notice/TaskNotice.vue')) return 'other'
|
// interlaced: false,
|
||||||
if (id.includes('/src/pages/message/notice/LiveNotice.vue')) return 'other'
|
// },
|
||||||
if (id.includes('/src/pages/message/notice/MoneyNotice.vue')) return 'other'
|
// optipng: {
|
||||||
|
// optimizationLevel: 7,
|
||||||
if (id.includes('/src/pages/me/Me.vue')) return 'other'
|
// },
|
||||||
if (id.includes('/src/pages/me/Visitors.vue')) return 'other'
|
// mozjpeg: {
|
||||||
if (id.includes('/src/pages/me/RequestUpdate.vue')) return 'other'
|
// quality: 20,
|
||||||
if (id.includes('/src/pages/me/userinfo/EditUserInfo.vue')) return 'other'
|
// },
|
||||||
if (id.includes('/src/pages/me/userinfo/EditUserInfoItem.vue')) return 'other'
|
// pngquant: {
|
||||||
if (id.includes('/src/pages/me/MyMusic.vue')) return 'other'
|
// quality: [0.8, 0.9],
|
||||||
|
// speed: 4,
|
||||||
if (id.includes('/src/pages/other/VideoDetail.vue')) return 'other'
|
// },
|
||||||
if (id.includes('/src/pages/other/AlbumDetail.vue')) return 'other'
|
// svgo: {
|
||||||
|
// plugins: [
|
||||||
if (id.includes('/src/pages/people/FindAcquaintance.vue')) return 'other'
|
// {
|
||||||
if (id.includes('/src/pages/people/FollowAndFans.vue')) return 'other'
|
// name: 'removeViewBox',
|
||||||
},
|
// },
|
||||||
chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称
|
// {
|
||||||
entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称
|
// name: 'removeEmptyAttrs',
|
||||||
assetFileNames: 'assets/[name]-[hash].[ext]' // 资源文件像 字体,图片等
|
// active: false,
|
||||||
}
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// }),
|
||||||
|
],
|
||||||
|
define: {
|
||||||
|
LATEST_COMMIT_HASH: JSON.stringify(
|
||||||
|
latestCommitHash + (process.env.NODE_ENV === 'production' ? '' : ' (dev)')
|
||||||
|
)
|
||||||
},
|
},
|
||||||
assetsInlineLimit: 2048
|
resolve: {
|
||||||
},
|
alias: {
|
||||||
esbuild: {
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
// drop: ['console', 'debugger']
|
},
|
||||||
},
|
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
|
||||||
server: {
|
},
|
||||||
port: 3000,
|
build: {
|
||||||
open: true,
|
sourcemap: false,
|
||||||
host: '0.0.0.0',
|
rollupOptions: {
|
||||||
fs: {
|
// https://rollupjs.org/guide/en/#outputmanualchunks
|
||||||
strict: false
|
output: {
|
||||||
|
manualChunks(id, { getModuleInfo }) {
|
||||||
|
const reg = /(.*)\/src\/components\/(.*)/
|
||||||
|
if (reg.test(id)) {
|
||||||
|
const importersLen = getModuleInfo(id)?.importers.length ?? 0
|
||||||
|
// 被多处引用
|
||||||
|
if (importersLen > 1) return 'common'
|
||||||
|
}
|
||||||
|
if (id.includes('node_modules')) return 'vendor'
|
||||||
|
|
||||||
|
if (id.includes('/src/pages/home/Publish.vue')) return 'other'
|
||||||
|
|
||||||
|
if (id.includes('/src/pages/home/Music.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/home/MusicRankList.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/home/LivePage.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/home/SearchPage.vue')) return 'other'
|
||||||
|
|
||||||
|
if (id.includes('/src/pages/shop/Shop.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/shop/GoodsDetail.vue')) return 'other'
|
||||||
|
|
||||||
|
if (id.includes('/src/pages/message/Message.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/message/Fans.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/message/AllMessage.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/message/notice/DouyinHelper.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/message/notice/SystemNotice.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/message/notice/TaskNotice.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/message/notice/LiveNotice.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/message/notice/MoneyNotice.vue')) return 'other'
|
||||||
|
|
||||||
|
if (id.includes('/src/pages/me/Me.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/me/Visitors.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/me/RequestUpdate.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/me/userinfo/EditUserInfo.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/me/userinfo/EditUserInfoItem.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/me/MyMusic.vue')) return 'other'
|
||||||
|
|
||||||
|
if (id.includes('/src/pages/other/VideoDetail.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/other/AlbumDetail.vue')) return 'other'
|
||||||
|
|
||||||
|
if (id.includes('/src/pages/people/FindAcquaintance.vue')) return 'other'
|
||||||
|
if (id.includes('/src/pages/people/FollowAndFans.vue')) return 'other'
|
||||||
|
},
|
||||||
|
chunkFileNames: 'js/[name]-[hash].js', // 引入文件名的名称
|
||||||
|
entryFileNames: 'js/[name]-[hash].js', // 包的入口文件名称
|
||||||
|
assetFileNames: 'assets/[name]-[hash].[ext]' // 资源文件像 字体,图片等
|
||||||
|
}
|
||||||
|
},
|
||||||
|
assetsInlineLimit: 2048
|
||||||
|
},
|
||||||
|
esbuild: {
|
||||||
|
// drop: ['console', 'debugger']
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 3000,
|
||||||
|
open: true,
|
||||||
|
host: '0.0.0.0',
|
||||||
|
fs: {
|
||||||
|
strict: false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user