-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: warjiang <[email protected]>
- Loading branch information
Showing
7 changed files
with
399 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ dist | |
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
|
||
# Sentry Config File | ||
.env.sentry-build-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,71 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import App from './App.tsx'; | ||
import i18nInstance, {getLang} from '@/utils/i18n'; | ||
import {initReactI18next} from 'react-i18next'; | ||
import {loader} from '@monaco-editor/react'; | ||
import i18nInstance, { getLang } from '@/utils/i18n'; | ||
import { initReactI18next } from 'react-i18next'; | ||
import { loader } from '@monaco-editor/react'; | ||
import * as monaco from 'monaco-editor'; | ||
import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'; | ||
// https://github.com/remcohaszing/monaco-yaml/issues/150 | ||
import yamlWorker from '@/utils/workaround-yaml.worker?worker'; | ||
import enTexts from '../locales/en-US.json'; | ||
import zhTexts from '../locales/zh-CN.json'; | ||
import {initRoute} from '@/routes/route.tsx'; | ||
import { initRoute } from '@/routes/route.tsx'; | ||
import * as Sentry from '@sentry/react'; | ||
|
||
Sentry.init({ | ||
dsn: 'https://5edc679922b621e4ea52b1f66f24f48d@o4507968956268544.ingest.us.sentry.io/4507968984711168', | ||
integrations: [ | ||
Sentry.browserTracingIntegration(), | ||
Sentry.replayIntegration(), | ||
], | ||
// Tracing | ||
tracesSampleRate: 1.0, // Capture 100% of the transactions | ||
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled | ||
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/], | ||
// Session Replay | ||
replaysSessionSampleRate: 0.1, | ||
replaysOnErrorSampleRate: 1.0, | ||
}); | ||
|
||
window.MonacoEnvironment = { | ||
getWorker(_, label) { | ||
if (label === 'yaml') { | ||
return new yamlWorker(); | ||
} | ||
return new editorWorker(); | ||
}, | ||
getWorker(_, label) { | ||
if (label === 'yaml') { | ||
return new yamlWorker(); | ||
} | ||
return new editorWorker(); | ||
}, | ||
}; | ||
loader.config({monaco}); | ||
loader.config({ monaco }); | ||
|
||
i18nInstance | ||
.use(initReactI18next) // passes i18n down to react-i18next | ||
.init({ | ||
debug: true, | ||
lng: getLang(), // if you're using a language detector, do not define the lng option | ||
fallbackLng: ['zh-CN'], | ||
resources: { | ||
zh: { | ||
translation: zhTexts, | ||
}, | ||
en: { | ||
translation: enTexts, | ||
}, | ||
}, | ||
interpolation: { | ||
escapeValue: false, // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape | ||
}, | ||
saveMissing: true, // send not translated keys to endpoint, | ||
react: { | ||
useSuspense: false, | ||
}, | ||
}) | ||
.then(() => { | ||
initRoute(); | ||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App/> | ||
</React.StrictMode>, | ||
); | ||
}) | ||
.catch(() => { | ||
|
||
}) | ||
.use(initReactI18next) // passes i18n down to react-i18next | ||
.init({ | ||
debug: true, | ||
lng: getLang(), // if you're using a language detector, do not define the lng option | ||
fallbackLng: ['zh-CN'], | ||
resources: { | ||
zh: { | ||
translation: zhTexts, | ||
}, | ||
en: { | ||
translation: enTexts, | ||
}, | ||
}, | ||
interpolation: { | ||
escapeValue: false, // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape | ||
}, | ||
saveMissing: true, // send not translated keys to endpoint, | ||
react: { | ||
useSuspense: false, | ||
}, | ||
}) | ||
.then(() => { | ||
initRoute(); | ||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<App /> | ||
</React.StrictMode>, | ||
); | ||
}) | ||
.catch(() => {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.