mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 15:16:28 +08:00
refactor: avoid runtime config object (#8202)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import type { RuntimeConfig } from '@affine/env/global';
|
||||
import type { BUILD_CONFIG_TYPE } from '@affine/env/global';
|
||||
|
||||
import packageJson from '../../package.json' assert { type: 'json' };
|
||||
import type { BuildFlags } from '../config';
|
||||
|
||||
export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
|
||||
const buildPreset: Record<BuildFlags['channel'], RuntimeConfig> = {
|
||||
export function getRuntimeConfig(buildFlags: BuildFlags): BUILD_CONFIG_TYPE {
|
||||
const buildPreset: Record<BuildFlags['channel'], BUILD_CONFIG_TYPE> = {
|
||||
get stable() {
|
||||
return {
|
||||
distribution: buildFlags.distribution,
|
||||
@@ -21,13 +21,10 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
|
||||
enableExperimentalFeature: true,
|
||||
allowLocalWorkspace:
|
||||
buildFlags.distribution === 'desktop' ? true : false,
|
||||
enableOrganize: true,
|
||||
enableInfoModal: true,
|
||||
enableThemeEditor: false,
|
||||
|
||||
// CAUTION(@forehalo): product not ready, do not enable it
|
||||
enableNewSettingUnstableApi: false,
|
||||
enableEnhanceShareMode: false,
|
||||
enableThemeEditor: false,
|
||||
};
|
||||
},
|
||||
get beta() {
|
||||
@@ -53,8 +50,6 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
|
||||
appBuildType: 'canary' as const,
|
||||
serverUrlPrefix: 'https://affine.fail',
|
||||
changelogUrl: 'https://github.com/toeverything/AFFiNE/releases',
|
||||
enableInfoModal: true,
|
||||
enableOrganize: true,
|
||||
enableThemeEditor: true,
|
||||
};
|
||||
},
|
||||
@@ -76,9 +71,6 @@ export function getRuntimeConfig(buildFlags: BuildFlags): RuntimeConfig {
|
||||
enableNewSettingUnstableApi: process.env.ENABLE_NEW_SETTING_UNSTABLE_API
|
||||
? process.env.ENABLE_NEW_SETTING_UNSTABLE_API === 'true'
|
||||
: currentBuildPreset.enableNewSettingUnstableApi,
|
||||
enableEnhanceShareMode: process.env.ENABLE_ENHANCE_SHARE_MODE
|
||||
? process.env.ENABLE_ENHANCE_SHARE_MODE === 'true'
|
||||
: currentBuildPreset.enableEnhanceShareMode,
|
||||
allowLocalWorkspace: process.env.ALLOW_LOCAL_WORKSPACE
|
||||
? process.env.ALLOW_LOCAL_WORKSPACE === 'true'
|
||||
: buildFlags.mode === 'development'
|
||||
|
||||
Reference in New Issue
Block a user