Skip to content

Commit

Permalink
各種アセットの出力ファイル名に Misskey 本体のバージョンを含めるようにする (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
riku6460 authored Dec 29, 2023
1 parent 769830c commit 436ddb8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/backend/src/server/web/views/base.pug
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/src/scripts/code-highlighter.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
5 changes: 3 additions & 2 deletions packages/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,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,
Expand Down
10 changes: 5 additions & 5 deletions scripts/build-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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() {
Expand Down

0 comments on commit 436ddb8

Please sign in to comment.