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
|
||||
run: pnpm run build
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v3
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v1
|
||||
|
||||
- name: Deploy to gh-pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
# Upload dist repository
|
||||
path: './dist'
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
deploy_key: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./dist
|
||||
|
||||
- name: Sync to Gitee
|
||||
uses: wearerequired/git-mirror-action@master
|
||||
|
||||
2
env.d.ts
vendored
2
env.d.ts
vendored
@ -1,5 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare const LATEST_COMMIT_HASH: string
|
||||
|
||||
declare global {
|
||||
interface Navigator {
|
||||
control: any
|
||||
|
||||
@ -65,7 +65,8 @@
|
||||
"vite": "^5.1.7",
|
||||
"vite-plugin-cdn-import": "0.3.5",
|
||||
"vite-plugin-commonjs": "^0.10.1",
|
||||
"vue-tsc": "^2.0.6"
|
||||
"vue-tsc": "^2.0.6",
|
||||
"git-last-commit": "^1.0.1"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,ts,vue,jsx,tsx}": [
|
||||
|
||||
@ -103,6 +103,9 @@ devDependencies:
|
||||
eslint-plugin-vue:
|
||||
specifier: ^9.17.0
|
||||
version: 9.24.0(eslint@8.57.0)
|
||||
git-last-commit:
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
husky:
|
||||
specifier: ^9.0.11
|
||||
version: 9.0.11
|
||||
@ -2465,6 +2468,10 @@ packages:
|
||||
engines: {node: '>=16'}
|
||||
dev: true
|
||||
|
||||
/git-last-commit@1.0.1:
|
||||
resolution: {integrity: sha512-FDSgeMqa7GnJDxt/q0AbrxbfeTyxp4ImxEw1e4nw6NUHA5FMhFUq33dTXI4Xdgcj1VQ1q5QLWF6WxFrJ8KCBOg==}
|
||||
dev: true
|
||||
|
||||
/git-raw-commits@4.0.0:
|
||||
resolution: {integrity: sha512-ICsMM1Wk8xSGMowkOmPrzo2Fgmfo4bMHLNX6ytHjajRJUqvHOw/TFapQ+QG75c3X/tTDDhOSRPGC52dDbNM8FQ==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
20
src/App.vue
20
src/App.vue
@ -6,16 +6,16 @@
|
||||
</keep-alive>
|
||||
</transition>
|
||||
</router-view>
|
||||
<!-- <BaseMask v-if="!isMobile" />-->
|
||||
<!-- <div v-if="!isMobile" class="guide">-->
|
||||
<!-- <Icon icon="mynaui:danger-triangle" />-->
|
||||
<!-- <div class="txt">-->
|
||||
<!-- <h2>切换至手机模式才可正常使用</h2>-->
|
||||
<!-- <h3>1. 按 F12 调出控制台</h3>-->
|
||||
<!-- <h3>2. 按 Ctrl+Shift+M,或点击下面图标</h3>-->
|
||||
<!-- </div>-->
|
||||
<!-- <img src="@/assets/img/guide.png" alt="" />-->
|
||||
<!-- </div>-->
|
||||
<BaseMask v-if="!isMobile" />
|
||||
<div v-if="!isMobile" class="guide">
|
||||
<Icon icon="mynaui:danger-triangle" />
|
||||
<div class="txt">
|
||||
<h2>切换至手机模式才可正常使用</h2>
|
||||
<h3>1. 按 F12 调出控制台</h3>
|
||||
<h3>2. 按 Ctrl+Shift+M,或点击下面图标</h3>
|
||||
</div>
|
||||
<img src="@/assets/img/guide.png" alt="" />
|
||||
</div>
|
||||
<Call />
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
@ -172,18 +172,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="version">抖音 version{{ store.version }}</div>
|
||||
<div class="version">抖音 {{ gitLastCommitHash }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useBaseStore } from '@/store/pinia'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const gitLastCommitHash = ref(LATEST_COMMIT_HASH)
|
||||
|
||||
defineOptions({
|
||||
name: 'ChooseSchool'
|
||||
})
|
||||
|
||||
const store = useBaseStore()
|
||||
</script>
|
||||
|
||||
<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 commonjs from 'vite-plugin-commonjs'
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import { getLastCommit } from 'git-last-commit'
|
||||
|
||||
// import viteImagemin from 'vite-plugin-imagemin'
|
||||
// import viteCompression from 'vite-plugin-compression'
|
||||
@ -18,162 +19,173 @@ const lifecycle = process.env.npm_lifecycle_event
|
||||
// var: 'axios',
|
||||
// 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'
|
||||
},
|
||||
|
||||
{
|
||||
name: 'jquery',
|
||||
var: '$',
|
||||
path: 'https://lib.baomitu.com/jquery/3.6.0/jquery.min.js'
|
||||
}
|
||||
]
|
||||
})
|
||||
// viteCompression({
|
||||
// verbose: false,
|
||||
// disable: false,
|
||||
// threshold: 10240,
|
||||
// algorithm: 'brotliCompress',
|
||||
// }),
|
||||
// viteCompression({
|
||||
// verbose: false,
|
||||
// disable: false,
|
||||
// algorithm: 'gzip',
|
||||
// threshold: 10240,
|
||||
// }),
|
||||
// viteImagemin({
|
||||
// gifsicle: {
|
||||
// optimizationLevel: 7,
|
||||
// interlaced: false,
|
||||
// },
|
||||
// optipng: {
|
||||
// optimizationLevel: 7,
|
||||
// },
|
||||
// mozjpeg: {
|
||||
// quality: 20,
|
||||
// },
|
||||
// pngquant: {
|
||||
// quality: [0.8, 0.9],
|
||||
// speed: 4,
|
||||
// },
|
||||
// svgo: {
|
||||
// plugins: [
|
||||
// {
|
||||
// name: 'removeViewBox',
|
||||
// },
|
||||
// {
|
||||
// name: 'removeEmptyAttrs',
|
||||
// active: false,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// }),
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': 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'
|
||||
export default defineConfig(async () => {
|
||||
const latestCommitHash = await new Promise<string>((resolve) => {
|
||||
return getLastCommit((err, commit) => (err ? 'unknown' : resolve(commit.shortHash)))
|
||||
})
|
||||
return {
|
||||
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'
|
||||
},
|
||||
|
||||
{
|
||||
name: 'jquery',
|
||||
var: '$',
|
||||
path: 'https://lib.baomitu.com/jquery/3.6.0/jquery.min.js'
|
||||
}
|
||||
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]' // 资源文件像 字体,图片等
|
||||
}
|
||||
]
|
||||
})
|
||||
// viteCompression({
|
||||
// verbose: false,
|
||||
// disable: false,
|
||||
// threshold: 10240,
|
||||
// algorithm: 'brotliCompress',
|
||||
// }),
|
||||
// viteCompression({
|
||||
// verbose: false,
|
||||
// disable: false,
|
||||
// algorithm: 'gzip',
|
||||
// threshold: 10240,
|
||||
// }),
|
||||
// viteImagemin({
|
||||
// gifsicle: {
|
||||
// optimizationLevel: 7,
|
||||
// interlaced: false,
|
||||
// },
|
||||
// optipng: {
|
||||
// optimizationLevel: 7,
|
||||
// },
|
||||
// mozjpeg: {
|
||||
// quality: 20,
|
||||
// },
|
||||
// pngquant: {
|
||||
// quality: [0.8, 0.9],
|
||||
// speed: 4,
|
||||
// },
|
||||
// svgo: {
|
||||
// plugins: [
|
||||
// {
|
||||
// name: 'removeViewBox',
|
||||
// },
|
||||
// {
|
||||
// name: 'removeEmptyAttrs',
|
||||
// active: false,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// }),
|
||||
],
|
||||
define: {
|
||||
LATEST_COMMIT_HASH: JSON.stringify(
|
||||
latestCommitHash + (process.env.NODE_ENV === 'production' ? '' : ' (dev)')
|
||||
)
|
||||
},
|
||||
assetsInlineLimit: 2048
|
||||
},
|
||||
esbuild: {
|
||||
// drop: ['console', 'debugger']
|
||||
},
|
||||
server: {
|
||||
port: 3000,
|
||||
open: true,
|
||||
host: '0.0.0.0',
|
||||
fs: {
|
||||
strict: false
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': 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'
|
||||
|
||||
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