Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

build: unify build flags (#2891)

Alex Yangfa45d8a71827
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 5380b36621..8ad466206d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -85,14 +85,7 @@ jobs:
runs-on: ubuntu-latest
environment: development
env:
- API_SERVER_PROFILE: local
- ENABLE_DEBUG_PAGE: 1
- ENABLE_PLUGIN: true
- ENABLE_ALL_PAGE_FILTER: true
- ENABLE_LEGACY_PROVIDER: true
- ENABLE_PRELOADING: false
- ENABLE_NEW_SETTING_MODAL: false
- ENABLE_SQLITE_PROVIDER: false
+ RELEASE_VERSION: canary
steps:
- uses: actions/checkout@v3
@@ -112,13 +105,8 @@ jobs:
runs-on: ubuntu-latest
environment: development
env:
- API_SERVER_PROFILE: affine
- ENABLE_DEBUG_PAGE: 1
- ENABLE_PLUGIN: true
- ENABLE_ALL_PAGE_FILTER: true
- ENABLE_LEGACY_PROVIDER: false
- ENABLE_PRELOADING: false
- ENABLE_NEW_SETTING_MODAL: false
+ ENABLE_BOOKMARK_OPERATION: true
+ RELEASE_VERSION: canary
steps:
- uses: actions/checkout@v3
diff --git a/.github/workflows/release-desktop-app.yml b/.github/workflows/release-desktop-app.yml
index 1b094c5525..68a5bb06ec 100644
--- a/.github/workflows/release-desktop-app.yml
+++ b/.github/workflows/release-desktop-app.yml
@@ -54,10 +54,6 @@ jobs:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- 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/web/.env.local.template b/apps/web/.env.local.template
index c4cbc43e06..4c1df08bf4 100644
--- a/apps/web/.env.local.template
+++ b/apps/web/.env.local.template
@@ -1,23 +1,5 @@
-NEXT_PUBLIC_FIREBASE_API_KEY=
-NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
-NEXT_PUBLIC_FIREBASE_PROJECT_ID=
-NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
-NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
-NEXT_PUBLIC_FIREBASE_APP_ID=
-NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=
# absolute path to the block suite directory
LOCAL_BLOCK_SUITE=
-# see next.config.js
-API_SERVER_PROFILE=
-# save workspace to idb
-ENABLE_IDB_PROVIDER=1
-PREFETCH_WORKSPACE=1
-ENABLE_BC_PROVIDER=1
-EXPOSE_INTERNAL=1
-ENABLE_DEBUG_PAGE=
-ENABLE_SUBPAGE=
-ENABLE_CHANGELOG=1
-ENABLE_LEGACY_PROVIDER=true
# Sentry
SENTRY_AUTH_TOKEN=
diff --git a/apps/web/preset.config.mjs b/apps/web/preset.config.mjs
index 7350ec4bf0..824fe20673 100644
--- a/apps/web/preset.config.mjs
+++ b/apps/web/preset.config.mjs
@@ -11,31 +11,87 @@ export const blockSuiteFeatureFlags = {
enable_drag_handle: true,
enable_surface: true,
enable_linked_page: true,
- enable_bookmark_operation: process.env.ENABLE_BOOKMARK_OPERATION === 'true',
+ enable_bookmark_operation: false,
};
/**
- * @type {import('@affine/env').BuildFlags}
+ * @type {Record<string, import('@affine/env').BuildFlags>}
*/
-export const buildFlags = {
- enablePlugin: process.env.ENABLE_PLUGIN === 'true',
- enableAllPageFilter:
- !!process.env.VERCEL ||
- (process.env.ENABLE_ALL_PAGE_FILTER
- ? process.env.ENABLE_ALL_PAGE_FILTER === 'true'
- : false),
+const buildPreset = {
+ stable: {
+ enableAllPageFilter: true,
+ enablePlugin: false,
+ enableTestProperties: false,
+ enableBroadcastChannelProvider: true,
+ enableDebugPage: true,
+ enableLegacyCloud: false,
+ changelogUrl: 'https://affine.pro/blog/what-is-new-affine-0620',
+ enablePreloading: true,
+ enableNewSettingModal: false,
+ enableSQLiteProvider: false,
+ },
+ beta: {},
+ internal: {},
+ // canary will be aggressive and enable all features
+ canary: {
+ enableAllPageFilter: true,
+ enablePlugin: true,
+ enableTestProperties: true,
+ enableBroadcastChannelProvider: true,
+ enableDebugPage: true,
+ enableLegacyCloud: false,
+ changelogUrl: 'https://github.com/toeverything/AFFiNE/releases',
+ enablePreloading: true,
+ enableNewSettingModal: true,
+ enableSQLiteProvider: true,
+ },
+};
+
+// beta and internal versions are the same as stable
+buildPreset.beta = buildPreset.stable;
+buildPreset.internal = buildPreset.stable;
+
+const currentBuild = process.env.BUILD_ENV || 'stable';
+
+const currentBuildPreset = buildPreset[currentBuild];
+
+const environmentPreset = {
+ enablePlugin: process.env.ENABLE_PLUGIN
+ ? process.env.ENABLE_PLUGIN === 'true'
+ : buildPreset.canary.enablePlugin,
+ enableAllPageFilter: process.env.ENABLE_ALL_PAGE_FILTER
+ ? process.env.ENABLE_ALL_PAGE_FILTER === 'true'
+ : buildPreset.canary.enableAllPageFilter,
enableTestProperties: process.env.ENABLE_TEST_PROPERTIES
? process.env.ENABLE_TEST_PROPERTIES === 'true'
- : true,
+ : buildPreset.canary.enableTestProperties,
enableLegacyCloud: process.env.ENABLE_LEGACY_PROVIDER
? process.env.ENABLE_LEGACY_PROVIDER === 'true'
- : true,
- 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 === 'true',
- enableNewSettingModal: process.env.ENABLE_NEW_SETTING_MODAL === 'true',
- enableSQLiteProvider: process.env.ENABLE_SQLITE_PROVIDER === 'true',
+ : buildPreset.canary.enableLegacyCloud,
+ enableBroadcastChannelProvider: process.env.ENABLE_BC_PROVIDER
+ ? process.env.ENABLE_BC_PROVIDER !== 'false'
+ : buildPreset.canary.enableBroadcastChannelProvider,
+ changelogUrl: process.env.CHANGELOG_URL ?? buildPreset.canary.changelogUrl,
+ enablePreloading: process.env.ENABLE_PRELOADING
+ ? process.env.ENABLE_PRELOADING === 'true'
+ : buildPreset.canary.enablePreloading,
+ enableNewSettingModal: process.env.ENABLE_NEW_SETTING_MODAL
+ ? process.env.ENABLE_NEW_SETTING_MODAL === 'true'
+ : buildPreset.canary.enableNewSettingModal,
+ enableSQLiteProvider: process.env.ENABLE_SQLITE_PROVIDER
+ ? process.env.ENABLE_SQLITE_PROVIDER === 'true'
+ : buildPreset.canary.enableSQLiteProvider,
};
+
+/**
+ * @type {import('@affine/env').BuildFlags}
+ */
+const buildFlags = {
+ ...currentBuildPreset,
+ // environment preset will overwrite current build preset
+ // this environment variable is for debug proposes only
+ // do not put them into CI
+ ...environmentPreset,
+};
+
+export { buildFlags };
diff --git a/packages/workspace/src/utils.ts b/packages/workspace/src/utils.ts
index 1b2d95a113..c5b91f87fb 100644
--- a/packages/workspace/src/utils.ts
+++ b/packages/workspace/src/utils.ts
@@ -32,6 +32,10 @@ function setEditorFlags(workspace: Workspace) {
value
);
});
+ workspace.awarenessStore.setFlag(
+ 'enable_bookmark_operation',
+ environment.isDesktop
+ );
}
const hashMap = new Map<string, Workspace>();
diff --git a/tests/affine-legacy/0.7.0-canary.18/tests/basic.spec.ts b/tests/affine-legacy/0.7.0-canary.18/tests/basic.spec.ts
index dd9bb207d6..2179a5636c 100644
--- a/tests/affine-legacy/0.7.0-canary.18/tests/basic.spec.ts
+++ b/tests/affine-legacy/0.7.0-canary.18/tests/basic.spec.ts
@@ -4,7 +4,9 @@ import { test } from '@playwright/test';
test('init page', async ({ page }) => {
await page.goto('http://localhost:8081/');
- await page.waitForSelector('v-line');
+ await page.waitForSelector('v-line', {
+ timeout: 10000,
+ });
const currentWorkspaceId: string = await page.evaluate(
() => (globalThis.currentWorkspace as any).id
diff --git a/tests/parallels/drag-page-to-trash-folder.spec.ts b/tests/parallels/drag-page-to-trash-folder.spec.ts
index 51a023d422..a8e69c4b16 100644
--- a/tests/parallels/drag-page-to-trash-folder.spec.ts
+++ b/tests/parallels/drag-page-to-trash-folder.spec.ts
@@ -15,9 +15,11 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
await page.getByText('All Pages').click();
}
+ const title = 'AFFiNE - not just a note taking app';
+
// Drag-and-drop
// Ref: https://playwright.dev/docs/input#dragging-manually
- await page.getByText('Untitled').hover();
+ await page.getByText(title).hover();
await page.mouse.down();
await page.waitForTimeout(1000);
await page.getByText('Trash').hover();
@@ -29,7 +31,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
).toBeVisible();
await expect(
- page.getByText('Untitled'),
+ page.getByText(title),
'The deleted post is no longer on the All Page list'
).toHaveCount(0);
@@ -37,7 +39,7 @@ test('drag a page from "All pages" list onto the "Trash" folder in the sidebar t
// Visit trash page via url
await page.getByText('Trash', { exact: true }).click();
await expect(
- page.getByText('Untitled'),
+ page.getByText(title),
'The deleted post exists in the Trash list'
).toHaveCount(1);
});