diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d9a686c66..5380b36621 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,6 +92,7 @@ jobs: ENABLE_LEGACY_PROVIDER: true ENABLE_PRELOADING: false ENABLE_NEW_SETTING_MODAL: false + ENABLE_SQLITE_PROVIDER: false steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index b3e7fc8f97..24bc9d6d42 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -61,6 +61,7 @@ jobs: API_SERVER_PROFILE: prod ENABLE_TEST_PROPERTIES: false ENABLE_BOOKMARK_OPERATION: true + ENABLE_SQLITE_PROVIDER: false RELEASE_VERSION: ${{ needs.set-build-version.outputs.version }} - name: Upload Artifact (web-static) diff --git a/.github/workflows/release-desktop-app.yml b/.github/workflows/release-desktop-app.yml index bc0f789bc2..1b094c5525 100644 --- a/.github/workflows/release-desktop-app.yml +++ b/.github/workflows/release-desktop-app.yml @@ -57,6 +57,7 @@ jobs: API_SERVER_PROFILE: prod ENABLE_TEST_PROPERTIES: false ENABLE_BOOKMARK_OPERATION: true + ENABLE_SQLITE_PROVIDER: false RELEASE_VERSION: ${{ github.event.inputs.version }} - name: Upload Artifact (web-static) diff --git a/apps/electron/tests/workspace.spec.ts b/apps/electron/tests/workspace.spec.ts index 247e45ceaf..8621d86f08 100644 --- a/apps/electron/tests/workspace.spec.ts +++ b/apps/electron/tests/workspace.spec.ts @@ -5,7 +5,7 @@ import fs from 'fs-extra'; import { test } from './fixture'; -test('check workspace has a DB file', async ({ appInfo, workspace }) => { +test.skip('check workspace has a DB file', async ({ appInfo, workspace }) => { const w = await workspace.current(); const dbPath = path.join( appInfo.sessionData, @@ -17,7 +17,7 @@ test('check workspace has a DB file', async ({ appInfo, workspace }) => { expect(await fs.exists(dbPath)).toBe(true); }); -test('move workspace db file', async ({ page, appInfo, workspace }) => { +test.skip('move workspace db file', async ({ page, appInfo, workspace }) => { const w = await workspace.current(); const settingButton = page.getByTestId('slider-bar-workspace-setting-button'); // goto settings @@ -42,7 +42,7 @@ test('move workspace db file', async ({ page, appInfo, workspace }) => { expect(files.some(f => f.endsWith('.affine'))).toBe(true); }); -test('export then add', async ({ page, appInfo, workspace }) => { +test.skip('export then add', async ({ page, appInfo, workspace }) => { const w = await workspace.current(); const settingButton = page.getByTestId('slider-bar-workspace-setting-button'); // goto settings diff --git a/apps/web/preset.config.mjs b/apps/web/preset.config.mjs index d4d198c3d6..7350ec4bf0 100644 --- a/apps/web/preset.config.mjs +++ b/apps/web/preset.config.mjs @@ -30,21 +30,12 @@ export const buildFlags = { enableLegacyCloud: process.env.ENABLE_LEGACY_PROVIDER ? process.env.ENABLE_LEGACY_PROVIDER === 'true' : true, - enableBroadcastChannelProvider: Boolean( - process.env.ENABLE_BC_PROVIDER ?? '1' - ), - enableDebugPage: Boolean( - process.env.ENABLE_DEBUG_PAGE ?? process.env.NODE_ENV === 'development' - ), + enableBroadcastChannelProvider: process.env.ENABLE_BC_PROVIDER !== 'false', + enableDebugPage: true, changelogUrl: process.env.CHANGELOG_URL ?? 'https://affine.pro/blog/what-is-new-affine-0620', - enablePreloading: - process.env.ENABLE_PRELOADING === undefined - ? true - : process.env.ENABLE_PRELOADING === 'true', - enableNewSettingModal: - process.env.ENABLE_NEW_SETTING_MODAL === undefined - ? true - : process.env.ENABLE_PRELOADING === 'true', + enablePreloading: process.env.ENABLE_PRELOADING === 'true', + enableNewSettingModal: process.env.ENABLE_NEW_SETTING_MODAL === 'true', + enableSQLiteProvider: process.env.ENABLE_SQLITE_PROVIDER === 'true', }; diff --git a/apps/web/src/atoms/index.ts b/apps/web/src/atoms/index.ts index 02235d1416..c2c3e6787e 100644 --- a/apps/web/src/atoms/index.ts +++ b/apps/web/src/atoms/index.ts @@ -1,4 +1,5 @@ import { DebugLogger } from '@affine/debug'; +import { config } from '@affine/env'; import { WorkspaceFlavour, WorkspaceVersion } from '@affine/env/workspace'; import type { RootWorkspaceMetadataV2 } from '@affine/workspace/atom'; import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom'; @@ -52,7 +53,7 @@ rootWorkspacesMetadataAtom.onMount = setAtom => { }, 0); } - if (environment.isDesktop) { + if (environment.isDesktop && config.enableSQLiteProvider) { window.apis?.workspace .list() .then(workspaceIDs => { diff --git a/apps/web/src/components/affine/create-workspace-modal/index.tsx b/apps/web/src/components/affine/create-workspace-modal/index.tsx index 5f361f02c6..f95dd3b465 100644 --- a/apps/web/src/components/affine/create-workspace-modal/index.tsx +++ b/apps/web/src/components/affine/create-workspace-modal/index.tsx @@ -290,7 +290,11 @@ export const CreateWorkspaceModal = ({ console.error(err); }); } else if (mode === 'new') { - setStep(environment.isDesktop ? 'set-db-location' : 'name-workspace'); + setStep( + environment.isDesktop && config.enableSQLiteProvider + ? 'set-db-location' + : 'name-workspace' + ); } else { setStep(undefined); } @@ -342,7 +346,7 @@ export const CreateWorkspaceModal = ({ const onConfirmName = useCallback( (name: string) => { setWorkspaceName(name); - if (environment.isDesktop) { + if (environment.isDesktop && config.enableSQLiteProvider) { setStep('set-syncing-mode'); } else { // this will be the last step for web for now diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/export/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/export/index.tsx index 50682ee950..67f9e25c2f 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/export/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/export/index.tsx @@ -1,4 +1,5 @@ import { Button, toast, Wrapper } from '@affine/component'; +import { config } from '@affine/env'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { rootCurrentWorkspaceIdAtom } from '@affine/workspace/atom'; import { useAtomValue } from 'jotai'; @@ -12,7 +13,7 @@ export const ExportPanel = () => { - + {environment.isDesktop && config.enableSQLiteProvider ? ( + + ) : null}
@@ -201,7 +209,7 @@ function DesktopClientOnly({ workspaceId }: { workspaceId: string }) { const t = useAFFiNEI18N(); const showOpenFolder = useShowOpenDBFile(workspaceId); const onRevealDBFile = useCallback(() => { - if (environment.isDesktop) { + if (environment.isDesktop && config.enableSQLiteProvider) { window.apis?.dialog.revealDBFile(workspaceId).catch(err => { console.error(err); }); diff --git a/apps/web/src/components/pure/workspace-list-modal/index.tsx b/apps/web/src/components/pure/workspace-list-modal/index.tsx index 7ef3c40cc6..8de48fec6f 100644 --- a/apps/web/src/components/pure/workspace-list-modal/index.tsx +++ b/apps/web/src/components/pure/workspace-list-modal/index.tsx @@ -8,6 +8,7 @@ import { } from '@affine/component'; import { ScrollableContainer } from '@affine/component'; import { WorkspaceList } from '@affine/component/workspace-list'; +import { config } from '@affine/env/config'; import type { AffineLegacyCloudWorkspace, LocalWorkspace, @@ -55,6 +56,107 @@ interface WorkspaceModalProps { onMoveWorkspace: (activeId: string, overId: string) => void; } +const CreateWorkspaceCard = ({ + onNewWorkspace, + onAddWorkspace, +}: { + onNewWorkspace: () => void; + onAddWorkspace: () => void; +}) => { + const t = useAFFiNEI18N(); + const anchorEL = useRef(null); + + if (config.enableSQLiteProvider && environment.isDesktop) { + return ( + + + + +
+

{t['New Workspace']()}

+ +

{t['Create your own workspace']()}

+
+
+ + + +
+
+
+ + + +
+

{t['Add Workspace']()}

+ +

{t['Add Workspace Hint']()}

+
+
+ + + +
+
+
+ + } + > + + + + + + + {t['New Workspace']()} +

{t['Create Or Import']()}

+
+
+
+ ); + } else { + return ( +
+ + + + + + + {t['New Workspace']()} +

{t['Create Or Import']()}

+
+
+
+ ); + } +}; + export const WorkspaceListModal = ({ disabled, open, @@ -71,7 +173,6 @@ export const WorkspaceListModal = ({ onMoveWorkspace, }: WorkspaceModalProps) => { const t = useAFFiNEI18N(); - const anchorEL = useRef(null); return ( - {!environment.isDesktop && ( -
- - - - - - - - {t['New Workspace']()} - -

{t['Create Or Import']()}

-
-
-
- )} - - {environment.isDesktop && ( - - - - -
-

{t['New Workspace']()}

- -

{t['Create your own workspace']()}

-
-
- - - -
-
-
- - - -
-

{t['Add Workspace']()}

- -

{t['Add Workspace Hint']()}

-
-
- - - -
-
-
- - } - > - - - - - - - - {t['New Workspace']()} - -

{t['Create Or Import']()}

-
-
-
- )} +