enhance(dev): 開発モード時にlocaleと型定義が自動的に再生成されるように (#12481)
* enhance: localeを任意のタイミングでリビルドできるように * enhance: localeも監視し、必要であればlocaleをリビルドするように * feat: devモードの時のみナビゲーションバーからキャッシュクリアができるように * refactor: キャッシュクリア部分を共通化 * fix: localesのファイル変更イベントが取れないのを修正 * fix: replaceAllでコケるのを修正 * change: 開発モードに関係なくナビゲーションバーからキャッシュクリアできるように * refactor: 必要のないリビルドをしないように * update: CHANGELOG.md --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
@@ -12,6 +12,7 @@ import * as os from '@/os.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { ui } from '@/config.js';
|
||||
import { unisonReload } from '@/scripts/unison-reload.js';
|
||||
import { clearCache } from './scripts/clear-cache.js';
|
||||
|
||||
export const navbarItemDef = reactive({
|
||||
notifications: {
|
||||
@@ -171,4 +172,11 @@ export const navbarItemDef = reactive({
|
||||
show: computed(() => $i != null),
|
||||
to: `/@${$i?.username}`,
|
||||
},
|
||||
cacheClear: {
|
||||
title: i18n.ts.cacheClear,
|
||||
icon: 'ti ti-trash',
|
||||
action: (ev) => {
|
||||
clearCache();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@@ -33,13 +33,11 @@ import { i18n } from '@/i18n.js';
|
||||
import MkInfo from '@/components/MkInfo.vue';
|
||||
import MkSuperMenu from '@/components/MkSuperMenu.vue';
|
||||
import { signout, $i } from '@/account.js';
|
||||
import { unisonReload } from '@/scripts/unison-reload.js';
|
||||
import { clearCache } from '@/scripts/clear-cache.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import { useRouter } from '@/router.js';
|
||||
import { definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
|
||||
import * as os from '@/os.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
import { fetchCustomEmojis } from '@/custom-emojis.js';
|
||||
|
||||
const indexInfo = {
|
||||
title: i18n.ts.settings,
|
||||
@@ -182,13 +180,7 @@ const menuDef = computed(() => [{
|
||||
icon: 'ti ti-trash',
|
||||
text: i18n.ts.clearCache,
|
||||
action: async () => {
|
||||
os.waiting();
|
||||
miLocalStorage.removeItem('locale');
|
||||
miLocalStorage.removeItem('theme');
|
||||
miLocalStorage.removeItem('emojis');
|
||||
miLocalStorage.removeItem('lastEmojisFetchedAt');
|
||||
await fetchCustomEmojis(true);
|
||||
unisonReload();
|
||||
await clearCache();
|
||||
},
|
||||
}, {
|
||||
type: 'button',
|
||||
|
14
packages/frontend/src/scripts/clear-cache.ts
Normal file
14
packages/frontend/src/scripts/clear-cache.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { unisonReload } from '@/scripts/unison-reload.js';
|
||||
import * as os from '@/os.js';
|
||||
import { miLocalStorage } from '@/local-storage.js';
|
||||
import { fetchCustomEmojis } from '@/custom-emojis.js';
|
||||
|
||||
export async function clearCache() {
|
||||
os.waiting();
|
||||
miLocalStorage.removeItem('locale');
|
||||
miLocalStorage.removeItem('theme');
|
||||
miLocalStorage.removeItem('emojis');
|
||||
miLocalStorage.removeItem('lastEmojisFetchedAt');
|
||||
await fetchCustomEmojis(true);
|
||||
unisonReload();
|
||||
}
|
Reference in New Issue
Block a user