Files
AFFiNE/packages/frontend/core/src/bootstrap/setup.ts
T
Lye Hongtao 4641bc422b feat: move templates into AFFiNE (#5750)
Related to https://github.com/toeverything/blocksuite/pull/6156

### Change
Move the edgeless templates to AFFiNE. All templates are stored as zip files. Run `node build-edgeless.mjs` in `@affine/templates` to generate JSON-format templates and importing script. The template will be generated automatically during building and dev (`yarn dev`).
2024-02-21 06:26:01 +00:00

61 lines
1.7 KiB
TypeScript

import './register-blocksuite-components';
import './edgeless-template';
import { setupGlobal } from '@affine/env/global';
import * as Sentry from '@sentry/react';
import { useEffect } from 'react';
import {
createRoutesFromChildren,
matchRoutes,
useLocation,
useNavigationType,
} from 'react-router-dom';
import { appConfigProxy } from '../hooks/use-app-config-storage';
import { performanceLogger } from '../shared';
const performanceSetupLogger = performanceLogger.namespace('setup');
export function setup() {
performanceSetupLogger.info('start');
performanceSetupLogger.info('setup global');
setupGlobal();
if (window.SENTRY_RELEASE || environment.isDebug) {
// https://docs.sentry.io/platforms/javascript/guides/react/#configure
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.BUILD_TYPE ?? 'development',
integrations: [
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.reactRouterV6Instrumentation(
useEffect,
useLocation,
useNavigationType,
createRoutesFromChildren,
matchRoutes
),
}),
new Sentry.Replay(),
],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
tracesSampleRate: 1.0,
});
Sentry.setTags({
appVersion: runtimeConfig.appVersion,
editorVersion: runtimeConfig.editorVersion,
});
}
// load persistent config for electron
// TODO: should be sync, but it's not necessary for now
environment.isDesktop &&
appConfigProxy
.getSync()
.catch(() => console.error('failed to load app config'));
performanceSetupLogger.info('done');
}