chore: add build flag for change log (#1792)

This commit is contained in:
JimmFly 2023-04-03 19:13:43 +08:00 committed by GitHub
parent fcf5d5602d
commit 196b9f2dbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 17 additions and 4 deletions

View File

@ -16,6 +16,7 @@ ENABLE_BC_PROVIDER=1
EXPOSE_INTERNAL=1
ENABLE_DEBUG_PAGE=
ENABLE_SUBPAGE=
ENABLE_CHANGELOG=
# Sentry
SENTRY_AUTH_TOKEN=

View File

@ -11,5 +11,6 @@ const config = {
process.env.ENABLE_DEBUG_PAGE ?? process.env.NODE_ENV === 'development'
),
enableSubpage: Boolean(process.env.ENABLE_SUBPAGE),
enableChangeLog: Boolean(process.env.ENABLE_CHANGELOG),
};
export default config;

View File

@ -1,4 +1,5 @@
import { MuiFade, Tooltip } from '@affine/component';
import { config } from '@affine/env';
import { useTranslation } from '@affine/i18n';
import { CloseIcon, DoneIcon } from '@blocksuite/icons';
import dynamic from 'next/dynamic';
@ -12,7 +13,6 @@ import {
StyledIsland,
StyledTriggerWrapper,
} from './style';
const ContactModal = dynamic(
() =>
import('@affine/component/contact-modal').then(({ ContactModal }) => ({
@ -25,7 +25,9 @@ const ContactModal = dynamic(
export type IslandItemNames = 'whatNew' | 'contact' | 'shortcuts';
export const HelpIsland = ({
showList = ['whatNew', 'contact', 'shortcuts'],
showList = config.enableChangeLog
? ['whatNew', 'contact', 'shortcuts']
: ['contact', 'shortcuts'],
}: {
showList?: IslandItemNames[];
}) => {

View File

@ -109,7 +109,7 @@ export const WorkSpaceSliderBar: React.FC<WorkSpaceSliderBarProps> = ({
currentWorkspace={currentWorkspace}
onClick={onOpenWorkspaceListModal}
/>
<ChangeLog />
{config.enableChangeLog && <ChangeLog />}
<StyledListItem
data-testid="slider-bar-quick-search-button"
onClick={useCallback(() => {

View File

@ -1,4 +1,5 @@
import { DebugLogger } from '@affine/debug';
import { config } from '@affine/env';
import { setUpLanguage, useTranslation } from '@affine/i18n';
import { createAffineGlobalChannel } from '@affine/workspace/affine/sync';
import { jotaiWorkspacesAtom } from '@affine/workspace/atom';
@ -339,7 +340,11 @@ export const WorkspaceLayoutInner: React.FC<React.PropsWithChildren> = ({
{!isPublicWorkspace && (
<HelpIsland
showList={
router.query.pageId ? undefined : ['whatNew', 'contact']
router.query.pageId
? undefined
: config.enableChangeLog
? ['whatNew', 'contact']
: ['contact']
}
/>
)}

View File

@ -111,6 +111,7 @@ export const publicRuntimeConfigSchema = z.object({
// expose internal api to globalThis, **development only**
exposeInternal: z.boolean(),
enableSubpage: z.boolean(),
enableChangeLog: z.boolean(),
});
export type PublicRuntimeConfig = z.infer<typeof publicRuntimeConfigSchema>;

View File

@ -74,6 +74,8 @@ const config: PlaywrightTestConfig = {
env: {
COVERAGE: process.env.COVERAGE || 'false',
ENABLE_DEBUG_PAGE: '1',
ENABLE_SUBPAGE: '1',
ENABLE_CHANGELOG: '1',
NODE_API_SERVER: 'local',
},
},

View File

@ -13,6 +13,7 @@ export default function getConfig() {
prefetchWorkspace: false,
exposeInternal: true,
enableSubpage: true,
enableChangeLog: true,
},
};
}