From 262289a398b1fb0c96838b0ac1c5fc3329edfccb Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Mon, 3 Jul 2023 15:25:14 +0800 Subject: [PATCH] chore: add affine-cloud build config (#2971) --- apps/web/preset.config.mjs | 9 +++++- .../setting-modal/setting-sidebar/index.tsx | 30 ++++++++++--------- packages/env/src/global.ts | 1 + 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/apps/web/preset.config.mjs b/apps/web/preset.config.mjs index 546aad224a..a7641c70e5 100644 --- a/apps/web/preset.config.mjs +++ b/apps/web/preset.config.mjs @@ -23,6 +23,8 @@ const buildPreset = { enableTestProperties: false, enableBroadcastChannelProvider: true, enableDebugPage: true, + // never set this to true in stable, because legacy cloud has deprecated + // and related code will be removed in the future enableLegacyCloud: false, changelogUrl: 'https://affine.pro/blog/whats-new-affine-0630', enablePreloading: true, @@ -30,6 +32,7 @@ const buildPreset = { enableNewSettingUnstableApi: false, enableSQLiteProvider: false, enableNotificationCenter: false, + enableCloud: false, }, beta: {}, internal: {}, @@ -46,6 +49,7 @@ const buildPreset = { enableNewSettingUnstableApi: false, enableSQLiteProvider: false, enableNotificationCenter: true, + enableCloud: false, }, }; @@ -56,7 +60,7 @@ buildPreset.internal = buildPreset.stable; const currentBuild = process.env.BUILD_TYPE || 'stable'; if (process.env.CI && !process.env.BUILD_TYPE) { - throw new Error('BUILD_TYPE is required in CI'); + throw new Error('BUILD_ENV is required in CI'); } const currentBuildPreset = buildPreset[currentBuild]; @@ -90,6 +94,9 @@ const environmentPreset = { enableNotificationCenter: process.env.ENABLE_NOTIFICATION_CENTER ? process.env.ENABLE_NOTIFICATION_CENTER === 'true' : currentBuildPreset.enableNotificationCenter, + enableCloud: process.env.ENABLE_CLOUD + ? process.env.ENABLE_CLOUD === 'true' + : currentBuildPreset.enableCloud, }; /** diff --git a/apps/web/src/components/affine/setting-modal/setting-sidebar/index.tsx b/apps/web/src/components/affine/setting-modal/setting-sidebar/index.tsx index 89f67b5bc1..34dd07bfef 100644 --- a/apps/web/src/components/affine/setting-modal/setting-sidebar/index.tsx +++ b/apps/web/src/components/affine/setting-modal/setting-sidebar/index.tsx @@ -89,23 +89,25 @@ export const SettingSidebar = ({ })} -
- + {runtimeConfig.enableCloud && ( +
+ -
-
- Account NameAccount Name -
-
- xxxxxxxx@gmail.comxxxxxxxx@gmail.com +
+
+ Account NameAccount Name +
+
+ xxxxxxxx@gmail.comxxxxxxxx@gmail.com +
-
+ )}
); }; diff --git a/packages/env/src/global.ts b/packages/env/src/global.ts index 248da8c26d..4f37638161 100644 --- a/packages/env/src/global.ts +++ b/packages/env/src/global.ts @@ -63,6 +63,7 @@ export const buildFlagsSchema = z.object({ enableNewSettingUnstableApi: z.boolean(), enableSQLiteProvider: z.boolean(), enableNotificationCenter: z.boolean(), + enableCloud: z.boolean(), }); export const blockSuiteFeatureFlags = z.object({