Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(frontend): fix build failure due to dependency setting #7

Merged
merged 2 commits into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/frontend/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare const _PERF_PREFIX_: string;
declare const _DATA_TRANSFER_DRIVE_FILE_: string;
declare const _DATA_TRANSFER_DRIVE_FOLDER_: string;
declare const _DATA_TRANSFER_DECK_COLUMN_: string;
declare const _SENTRY_FOR_FRONTEND_DSN_: string | undefined;

// for dev-mode
declare const _LANGS_FULL_: string[][];
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@rollup/plugin-json": "6.1.0",
"@rollup/plugin-replace": "5.0.5",
"@rollup/pluginutils": "5.1.0",
"@sentry/vue": "8.7.0",
"@syuilo/aiscript": "0.18.0",
"@tabler/icons-webfont": "3.3.0",
"@twemoji/parser": "15.1.1",
Expand Down Expand Up @@ -73,7 +74,8 @@
"v-code-diff": "1.11.0",
"vite": "5.2.11",
"vue": "3.4.26",
"vuedraggable": "next"
"vuedraggable": "next",
"yaml": "2.4.2"
},
"devDependencies": {
"@misskey-dev/eslint-plugin": "1.0.0",
Expand Down
33 changes: 30 additions & 3 deletions packages/frontend/src/boot/main-boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
*/

import { createApp, defineAsyncComponent, markRaw } from 'vue';
import * as Sentry from '@sentry/vue';
import { common } from './common.js';
import { ui } from '@/config.js';
import { apiUrl, ui } from '@/config.js';
import { i18n } from '@/i18n.js';
import { alert, confirm, popup, post, toast } from '@/os.js';
import { useStream } from '@/stream.js';
Expand All @@ -23,14 +24,40 @@ import { emojiPicker } from '@/scripts/emoji-picker.js';
import { mainRouter } from '@/router/main.js';

export async function mainBoot() {
const { isClientUpdated } = await common(() => createApp(
const { isClientUpdated, app } = await common(() => createApp(
new URLSearchParams(window.location.search).has('zen') || (ui === 'deck' && deckStore.state.useSimpleUiForNonRootPages && location.pathname !== '/') ? defineAsyncComponent(() => import('@/ui/zen.vue')) :
!$i ? defineAsyncComponent(() => import('@/ui/visitor.vue')) :
ui === 'deck' ? defineAsyncComponent(() => import('@/ui/deck.vue')) :
ui === 'classic' ? defineAsyncComponent(() => import('@/ui/classic.vue')) :
defineAsyncComponent(() => import('@/ui/universal.vue')),
));

if (_SENTRY_FOR_FRONTEND_DSN_) {
Sentry.init({
app,
// @ts-expect-error なんかエラー出る
dsn: _SENTRY_FOR_FRONTEND_DSN_,
integrations: [
Sentry.browserTracingIntegration(),
// @ts-expect-error なんかエラー出る
Sentry.replayIntegration(),
],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,

// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: [apiUrl],

// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
}

reactionPicker.init();
emojiPicker.init();

Expand Down Expand Up @@ -96,7 +123,7 @@ export async function mainBoot() {
}).render();
}
}
}
}
} catch (error) {
// console.error(error);
console.error('Failed to initialise the seasonal screen effect canvas context:', error);
Expand Down
6 changes: 6 additions & 0 deletions packages/frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import fs from 'fs';
import path from 'path';
import pluginReplace from '@rollup/plugin-replace';
import pluginVue from '@vitejs/plugin-vue';
import { type UserConfig, defineConfig } from 'vite';
import { parseDocument } from 'yaml';

import locales from '../../locales/index.js';
import meta from '../../package.json';
Expand Down Expand Up @@ -116,6 +118,10 @@ export function getConfig(): UserConfig {
_DATA_TRANSFER_DRIVE_FILE_: JSON.stringify('mk_drive_file'),
_DATA_TRANSFER_DRIVE_FOLDER_: JSON.stringify('mk_drive_folder'),
_DATA_TRANSFER_DECK_COLUMN_: JSON.stringify('mk_deck_column'),
_SENTRY_FOR_FRONTEND_DSN_: JSON.stringify(
parseDocument(fs.readFileSync(path.relative(__dirname, '../../.config/default.yml'), 'utf-8'))
.getIn(['sentryForFrontend', 'options', 'dsn']),
),
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
},
Expand Down
106 changes: 106 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading