mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 18:46:19 +08:00
refactor: improve code
This commit is contained in:
@@ -12,18 +12,7 @@ type Config = {
|
||||
|
||||
const nextConfig = getConfig();
|
||||
const publicRuntimeConfig: Config = nextConfig.publicRuntimeConfig;
|
||||
const setAffineAppProperties = () => {
|
||||
const input = document.createElement('input');
|
||||
const id = 'editor-version';
|
||||
if (document.getElementById(id)) {
|
||||
return;
|
||||
}
|
||||
input.value = publicRuntimeConfig.EDITOR_VERSION;
|
||||
input.type = 'hidden';
|
||||
input.id = id;
|
||||
input.setAttribute('data-testid', 'editor-version');
|
||||
document.body.appendChild(input);
|
||||
};
|
||||
|
||||
const printBuildInfo = () => {
|
||||
console.group('Build info');
|
||||
console.log('Project:', publicRuntimeConfig.PROJECT_NAME);
|
||||
@@ -47,8 +36,14 @@ const printBuildInfo = () => {
|
||||
`https://github.com/toeverything/AFFiNE/tree/${publicRuntimeConfig.COMMIT_HASH}`
|
||||
);
|
||||
console.groupEnd();
|
||||
|
||||
setAffineAppProperties();
|
||||
};
|
||||
|
||||
export { printBuildInfo };
|
||||
function setWindowEditorVersion() {
|
||||
// when it is not SSR
|
||||
if (typeof window !== 'undefined') {
|
||||
window.__editoVersion = publicRuntimeConfig.EDITOR_VERSION;
|
||||
}
|
||||
}
|
||||
printBuildInfo();
|
||||
setWindowEditorVersion();
|
||||
export {};
|
||||
|
||||
Reference in New Issue
Block a user