From 3f85aa0827c01ef392a57b479c4ed55dfbffe027 Mon Sep 17 00:00:00 2001 From: riku6460 <17585784+riku6460@users.noreply.github.com> Date: Sat, 30 Dec 2023 00:18:03 +0900 Subject: [PATCH] =?UTF-8?q?=E5=90=84=E7=A8=AE=E3=82=A2=E3=82=BB=E3=83=83?= =?UTF-8?q?=E3=83=88=E3=81=AE=E5=87=BA=E5=8A=9B=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E5=90=8D=E3=81=AB=20Misskey=20=E6=9C=AC=E4=BD=93?= =?UTF-8?q?=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92?= =?UTF-8?q?=E5=90=AB=E3=82=81=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=99?= =?UTF-8?q?=E3=82=8B=20(MisskeyIO#305)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/server/web/views/base.pug | 2 +- packages/frontend/src/scripts/code-highlighter.ts | 5 +++-- packages/frontend/vite.config.ts | 5 +++-- scripts/build-assets.mjs | 10 +++++----- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/backend/src/server/web/views/base.pug b/packages/backend/src/server/web/views/base.pug index cba961dab9..1423d39b8a 100644 --- a/packages/backend/src/server/web/views/base.pug +++ b/packages/backend/src/server/web/views/base.pug @@ -36,7 +36,7 @@ html link(rel='prefetch' href=infoImageUrl) link(rel='prefetch' href=notFoundImageUrl) //- https://github.com/misskey-dev/misskey/issues/9842 - link(rel='stylesheet' href='/assets/tabler-icons/tabler-icons.min.css?v2.44.0') + link(rel='stylesheet' href=`/assets/tabler-icons.${version}/tabler-icons.min.css`) link(rel='modulepreload' href=`/vite/${clientEntry.file}`) if !config.clientManifestExists diff --git a/packages/frontend/src/scripts/code-highlighter.ts b/packages/frontend/src/scripts/code-highlighter.ts index 957669122e..bc5a75b5a1 100644 --- a/packages/frontend/src/scripts/code-highlighter.ts +++ b/packages/frontend/src/scripts/code-highlighter.ts @@ -1,7 +1,8 @@ import { setWasm, setCDN, Highlighter, getHighlighter as _getHighlighter } from 'shiki'; +import { version } from '@/config.js'; -setWasm('/assets/shiki/dist/onig.wasm'); -setCDN('/assets/shiki/'); +setWasm(`/assets/shiki.${version}/dist/onig.wasm`); +setCDN(`/assets/shiki.${version}/`); let _highlighter: Highlighter | null = null; diff --git a/packages/frontend/vite.config.ts b/packages/frontend/vite.config.ts index 42063dcdf8..afd124119a 100644 --- a/packages/frontend/vite.config.ts +++ b/packages/frontend/vite.config.ts @@ -123,8 +123,9 @@ export function getConfig(): UserConfig { vue: ['vue'], photoswipe: ['photoswipe', 'photoswipe/lightbox', 'photoswipe/style.css'], }, - chunkFileNames: process.env.NODE_ENV === 'production' ? '[hash:8].js' : '[name]-[hash:8].js', - assetFileNames: process.env.NODE_ENV === 'production' ? '[hash:8][extname]' : '[name]-[hash:8][extname]', + entryFileNames: `${meta.version}.[hash].js`, + chunkFileNames: `${meta.version}.[hash].js`, + assetFileNames: `${meta.version}.[hash][extname]`, }, }, cssCodeSplit: true, diff --git a/scripts/build-assets.mjs b/scripts/build-assets.mjs index a795500bf3..436b19b4af 100644 --- a/scripts/build-assets.mjs +++ b/scripts/build-assets.mjs @@ -20,7 +20,7 @@ async function copyFrontendFonts() { } async function copyFrontendTablerIcons() { - await fs.cp('./packages/frontend/node_modules/@tabler/icons-webfont', './built/_frontend_dist_/tabler-icons', { dereference: true, recursive: true }); + await fs.cp('./packages/frontend/node_modules/@tabler/icons-webfont', `./built/_frontend_dist_/tabler-icons.${meta.version}`, { dereference: true, recursive: true }); } async function copyFrontendLocales() { @@ -36,10 +36,10 @@ async function copyFrontendLocales() { } async function copyFrontendShikiAssets() { - await fs.cp('./packages/frontend/node_modules/shiki/dist', './built/_frontend_dist_/shiki/dist', { dereference: true, recursive: true }); - await fs.cp('./packages/frontend/node_modules/shiki/languages', './built/_frontend_dist_/shiki/languages', { dereference: true, recursive: true }); - await fs.cp('./packages/frontend/node_modules/aiscript-vscode/aiscript/syntaxes', './built/_frontend_dist_/shiki/languages', { dereference: true, recursive: true }); - await fs.cp('./packages/frontend/node_modules/shiki/themes', './built/_frontend_dist_/shiki/themes', { dereference: true, recursive: true }); + await fs.cp('./packages/frontend/node_modules/shiki/dist', `./built/_frontend_dist_/shiki.${meta.version}/dist`, { dereference: true, recursive: true }); + await fs.cp('./packages/frontend/node_modules/shiki/languages', `./built/_frontend_dist_/shiki.${meta.version}/languages`, { dereference: true, recursive: true }); + await fs.cp('./packages/frontend/node_modules/aiscript-vscode/aiscript/syntaxes', `./built/_frontend_dist_/shiki.${meta.version}/languages`, { dereference: true, recursive: true }); + await fs.cp('./packages/frontend/node_modules/shiki/themes', `./built/_frontend_dist_/shiki.${meta.version}/themes`, { dereference: true, recursive: true }); } async function copyBackendViews() {