mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-04 19:15:33 +08:00
build: unify build flags (#2891)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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=
|
||||
|
||||
+78
-22
@@ -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 {Record<string, import('@affine/env').BuildFlags>}
|
||||
*/
|
||||
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'
|
||||
: buildPreset.canary.enableTestProperties,
|
||||
enableLegacyCloud: process.env.ENABLE_LEGACY_PROVIDER
|
||||
? process.env.ENABLE_LEGACY_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}
|
||||
*/
|
||||
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),
|
||||
enableTestProperties: process.env.ENABLE_TEST_PROPERTIES
|
||||
? process.env.ENABLE_TEST_PROPERTIES === 'true'
|
||||
: true,
|
||||
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',
|
||||
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 };
|
||||
|
||||
@@ -32,6 +32,10 @@ function setEditorFlags(workspace: Workspace) {
|
||||
value
|
||||
);
|
||||
});
|
||||
workspace.awarenessStore.setFlag(
|
||||
'enable_bookmark_operation',
|
||||
environment.isDesktop
|
||||
);
|
||||
}
|
||||
|
||||
const hashMap = new Map<string, Workspace>();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user