From 94769dcba86574a7b2bc3e504964b843d803cbb0 Mon Sep 17 00:00:00 2001 From: Benny Guo Date: Sat, 9 Sep 2023 22:41:34 +0800 Subject: [PATCH 1/5] feat: replace prismjs with shiki --- _config.yml | 7 + package.json | 2 +- src/components/PageContent.vue | 8 +- src/components/ToggleSwitch/Toggle.vue | 4 +- src/pages/about.vue | 6 +- src/pages/index.vue | 2 +- src/pages/links.vue | 27 +- src/pages/page/[slug].vue | 6 +- src/pages/post/[slug].vue | 6 +- src/styles/components/article.scss | 39 ++- src/styles/prism-aurora-future.css | 400 ------------------------- templates/index.html | 32 +- vite.config.js | 6 +- 13 files changed, 66 insertions(+), 479 deletions(-) delete mode 100644 src/styles/prism-aurora-future.css diff --git a/_config.yml b/_config.yml index 3291442d..fac13dab 100644 --- a/_config.yml +++ b/_config.yml @@ -211,3 +211,10 @@ footer_links: - title: Friends # link of friends mode / 友链模式 mode: 'links' +#! --------------------------------------------------------------- +#! Highlighter Shiki +#! --------------------------------------------------------------- +shiki: + enable: true + backgroundColor: "#1a1a1a" + diff --git a/package.json b/package.json index e4100572..d2e41374 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "script-ext-html-webpack-plugin": "^2.1.5", "semantic-release": "^21.1.1", "tailwindcss": "3.3.3", - "typescript": "~5.2.2", + "typescript": "^5.1.0", "vite": "^4.4.9", "vite-plugin-html-transformer": "^4.0.0", "vite-plugin-pages": "^0.31.0", diff --git a/src/components/PageContent.vue b/src/components/PageContent.vue index 55f76268..699c2a19 100644 --- a/src/components/PageContent.vue +++ b/src/components/PageContent.vue @@ -73,26 +73,26 @@ - - - - - - - + { if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) { extType = 'img' } - return `static/${extType}/[hash][extname]` + return `static/${extType}/[name]-[hash][extname]` }, - chunkFileNames: 'static/js/[hash].js', - entryFileNames: 'static/js/[hash].js' + chunkFileNames: 'static/js/[name]-[hash].js', + entryFileNames: 'static/js/[name]-[hash].js' }, plugins: [] } From b4f8e9bc36f0138d851e8e6a9ddb8b41f3d8a566 Mon Sep 17 00:00:00 2001 From: Benny Guo Date: Sat, 9 Sep 2023 22:42:02 +0800 Subject: [PATCH 2/5] chore: update the workflow actions --- .github/workflows/pr.yml | 4 ++++ .github/workflows/release.yml | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6f25bf9e..af15eeba 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -48,5 +48,9 @@ jobs: - name: Install dependencies run: pnpm install + - name: ESLint check + run: pnpm lint + - name: Build run: pnpm build + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6f158090..37d59e00 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,16 +50,20 @@ jobs: - name: Build run: pnpm build - # - name: Obtain a GitHub App Installation Access Token - # id: githubAppAuth - # run: | - # echo "GITHUB_APP_TOKEN=$(npx obtain-github-app-installation-access-token ci ${{ secrets.GH_APP_CREDENTIALS_TOKEN }})" >> $GITHUB_OUTPUT + - name: Generate a token + id: generate_token + uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} - name: Release env: # GITHUB_TOKEN: ${{ steps.githubAppAuth.outputs.GITHUB_APP_TOKEN }} - GH_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.NPM_TOKEN }} +# GH_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }} +# GITHUB_TOKEN: ${{ secrets.NPM_TOKEN }} + GH_TOKEN: ${{ steps.generate_token.outputs.token }} + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GIT_CREDENTIALS: ${{ secrets.GIT_CREDENTIALS }} GIT_AUTHOR_NAME: ${{ secrets. GIT_AUTHOR_NAME }} From 44b2e5166eea758a62a15ede6aed655625df7895 Mon Sep 17 00:00:00 2001 From: Benny Guo Date: Sat, 9 Sep 2023 22:47:43 +0800 Subject: [PATCH 3/5] chore: updated pnpm-lock --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe2222f0..1031fe7e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,7 +116,7 @@ devDependencies: specifier: 3.3.3 version: 3.3.3(ts-node@10.9.1) typescript: - specifier: ~5.2.2 + specifier: ^5.1.0 version: 5.2.2 vite: specifier: ^4.4.9 From c190c293f79dfee5d689f2cc890777cab371179c Mon Sep 17 00:00:00 2001 From: Benny Guo Date: Sun, 10 Sep 2023 00:08:12 +0800 Subject: [PATCH 4/5] chore: fix all eslint issues --- src/App.vue | 2 +- src/components/ArticleCard/index.ts | 2 +- .../src/{Article.vue => ArticleCard.vue} | 2 +- .../ArticleCard/src/HorizontalArticle.vue | 2 +- src/components/Breadcrumbs.vue | 2 +- src/components/Comment.vue | 6 +- src/components/Dia.vue | 61 ++++++++------- src/components/Dropdown/src/Dropdown.vue | 2 +- src/components/Dropdown/src/DropdownItem.vue | 2 +- src/components/Feature/src/Feature.vue | 4 +- src/components/Feature/src/FeatureList.vue | 8 +- src/components/Footer/FooterLink.vue | 17 +++- src/components/Header/src/Controls.vue | 2 +- src/components/Header/src/Header.vue | 9 +-- src/components/Header/src/Logo.vue | 2 +- src/components/Header/src/Navigation.vue | 2 +- src/components/Link/LinkBox.vue | 16 ++-- src/components/Link/LinkCategoryList.vue | 12 +-- src/components/Link/LinkList.vue | 8 +- src/components/LoadingSkeleton/Skeleton.vue | 2 +- src/components/Navigator.vue | 12 ++- src/components/Sidebar/src/Navigator.vue | 2 +- src/components/Sidebar/src/RecentComment.vue | 77 ++++++++++--------- src/components/Sidebar/src/Toc.vue | 4 +- src/components/Social.vue | 11 +-- src/components/Sticky.vue | 8 +- src/components/Title/index.ts | 2 +- .../Title/src/{Title.vue => MainTitle.vue} | 2 +- src/components/ToggleSwitch/ThemeToggle.vue | 2 +- src/pages/[...all].vue | 10 ++- src/pages/about.vue | 2 +- src/pages/archives.vue | 6 +- src/pages/category.vue | 4 +- src/pages/index.vue | 16 ++-- src/pages/page/[slug].vue | 9 +-- src/pages/post/[slug].vue | 10 ++- src/pages/post/search/index.vue | 14 ++-- src/pages/tags.vue | 2 +- templates/index.html | 1 + 39 files changed, 184 insertions(+), 173 deletions(-) rename src/components/ArticleCard/src/{Article.vue => ArticleCard.vue} (99%) rename src/components/Title/src/{Title.vue => MainTitle.vue} (98%) diff --git a/src/App.vue b/src/App.vue index e588fc4e..29243f81 100644 --- a/src/App.vue +++ b/src/App.vue @@ -182,7 +182,7 @@ export default defineComponent({ onMounted(() => { let wrapperHeight = screen.height const footerEl = document.getElementById('footer') - const footerHeight = footerEl?.getBoundingClientRect().height + const footerHeight = footerEl?.getBoundingClientRect().height ?? 0 wrapperHeight = wrapperHeight - footerHeight * 2 wrapperStyle.value = { 'min-height': wrapperHeight + 'px' diff --git a/src/components/ArticleCard/index.ts b/src/components/ArticleCard/index.ts index bee8510f..57040f23 100644 --- a/src/components/ArticleCard/index.ts +++ b/src/components/ArticleCard/index.ts @@ -1,2 +1,2 @@ export { default as HorizontalArticle } from './src/HorizontalArticle.vue' -export { default as Article } from './src/Article.vue' +export { default as ArticleCard } from './src/ArticleCard.vue' diff --git a/src/components/ArticleCard/src/Article.vue b/src/components/ArticleCard/src/ArticleCard.vue similarity index 99% rename from src/components/ArticleCard/src/Article.vue rename to src/components/ArticleCard/src/ArticleCard.vue index 8f5a2476..9423cb81 100644 --- a/src/components/ArticleCard/src/Article.vue +++ b/src/components/ArticleCard/src/ArticleCard.vue @@ -128,7 +128,7 @@ import SvgIcon from '@/components/SvgIcon/index.vue' import { useRouter } from 'vue-router' export default defineComponent({ - name: 'ObFeatureList', + name: 'ARArticleCard', components: { SvgIcon }, props: { data: { diff --git a/src/components/ArticleCard/src/HorizontalArticle.vue b/src/components/ArticleCard/src/HorizontalArticle.vue index 7da39e91..c690ee0f 100644 --- a/src/components/ArticleCard/src/HorizontalArticle.vue +++ b/src/components/ArticleCard/src/HorizontalArticle.vue @@ -141,7 +141,7 @@ export default defineComponent({ props: { data: { type: Object, - default: {} + default: () => ({}) } }, setup(props) { diff --git a/src/components/Breadcrumbs.vue b/src/components/Breadcrumbs.vue index 8905052b..cb5726a8 100644 --- a/src/components/Breadcrumbs.vue +++ b/src/components/Breadcrumbs.vue @@ -12,7 +12,7 @@ import { defineComponent } from 'vue' import { useI18n } from 'vue-i18n' export default defineComponent({ - name: 'Breadcrumb', + name: 'ArBreadcrumbBar', props: { current: String }, diff --git a/src/components/Comment.vue b/src/components/Comment.vue index 75406a47..8749422f 100644 --- a/src/components/Comment.vue +++ b/src/components/Comment.vue @@ -1,6 +1,6 @@