mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
ci: add circular import detect (#2475)
Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -35,7 +35,9 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: ./.github/actions/setup-node
|
uses: ./.github/actions/setup-node
|
||||||
- run: yarn lint --max-warnings=0
|
- run: |
|
||||||
|
yarn lint --max-warnings=0
|
||||||
|
yarn circular
|
||||||
|
|
||||||
build-storybook:
|
build-storybook:
|
||||||
name: Build Storybook
|
name: Build Storybook
|
||||||
|
|||||||
@@ -6,8 +6,7 @@
|
|||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"export": "next export",
|
"export": "next export",
|
||||||
"start": "next start",
|
"start": "next start"
|
||||||
"lint": "next lint"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@affine-test/fixtures": "workspace:*",
|
"@affine-test/fixtures": "workspace:*",
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
"build:client": "yarn workspace @affine/client-app build:app",
|
"build:client": "yarn workspace @affine/client-app build:app",
|
||||||
"build:storybook": "yarn workspace @affine/component build-storybook",
|
"build:storybook": "yarn workspace @affine/component build-storybook",
|
||||||
"bump:nightly": "./scripts/bump-blocksuite.sh",
|
"bump:nightly": "./scripts/bump-blocksuite.sh",
|
||||||
|
"circular": "madge --circular --ts-config ./tsconfig.json ./apps/web/src/pages/**/*.tsx",
|
||||||
"export": "yarn workspace @affine/web export",
|
"export": "yarn workspace @affine/web export",
|
||||||
"start": "yarn workspace @affine/web start",
|
"start": "yarn workspace @affine/web start",
|
||||||
"start:storybook": "yarn exec serve packages/component/storybook-static -l 6006",
|
"start:storybook": "yarn exec serve packages/component/storybook-static -l 6006",
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
"happy-dom": "^9.18.3",
|
"happy-dom": "^9.18.3",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"lint-staged": "^13.2.2",
|
"lint-staged": "^13.2.2",
|
||||||
|
"madge": "^6.0.0",
|
||||||
"msw": "^1.2.1",
|
"msw": "^1.2.1",
|
||||||
"nanoid": "^4.0.2",
|
"nanoid": "^4.0.2",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import { Skeleton } from '@mui/material';
|
|
||||||
import type { ReactElement } from 'react';
|
|
||||||
|
|
||||||
import { fallbackHeaderStyle, fallbackStyle } from './fallback.css';
|
|
||||||
import { AppSidebar } from './index';
|
|
||||||
|
|
||||||
export const AppSidebarFallback = (): ReactElement | null => {
|
|
||||||
return (
|
|
||||||
<AppSidebar>
|
|
||||||
<div className={fallbackStyle}>
|
|
||||||
<div className={fallbackHeaderStyle}>
|
|
||||||
<Skeleton variant="circular" width={40} height={40} />
|
|
||||||
<Skeleton variant="rectangular" width={150} height={40} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</AppSidebar>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
import { getEnvironment } from '@affine/env';
|
import { getEnvironment } from '@affine/env';
|
||||||
|
import { Skeleton } from '@mui/material';
|
||||||
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
import { assignInlineVars } from '@vanilla-extract/dynamic';
|
||||||
import { useAtom, useAtomValue } from 'jotai';
|
import { useAtom, useAtomValue } from 'jotai';
|
||||||
import type { PropsWithChildren, ReactElement } from 'react';
|
import type { PropsWithChildren, ReactElement } from 'react';
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
|
import { fallbackHeaderStyle, fallbackStyle } from './fallback.css';
|
||||||
import {
|
import {
|
||||||
floatingMaxWidth,
|
floatingMaxWidth,
|
||||||
navBodyStyle,
|
navBodyStyle,
|
||||||
@@ -114,10 +116,22 @@ export function AppSidebar(props: AppSidebarProps): ReactElement {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const AppSidebarFallback = (): ReactElement | null => {
|
||||||
|
return (
|
||||||
|
<AppSidebar>
|
||||||
|
<div className={fallbackStyle}>
|
||||||
|
<div className={fallbackHeaderStyle}>
|
||||||
|
<Skeleton variant="circular" width={40} height={40} />
|
||||||
|
<Skeleton variant="rectangular" width={150} height={40} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</AppSidebar>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export * from './add-page-button';
|
export * from './add-page-button';
|
||||||
export * from './app-updater-button';
|
export * from './app-updater-button';
|
||||||
export * from './category-divider';
|
export * from './category-divider';
|
||||||
export { AppSidebarFallback } from './fallback';
|
|
||||||
export * from './menu-item';
|
export * from './menu-item';
|
||||||
export * from './quick-search-input';
|
export * from './quick-search-input';
|
||||||
export * from './sidebar-containers';
|
export * from './sidebar-containers';
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
TableHead,
|
TableHead,
|
||||||
TableRow,
|
TableRow,
|
||||||
} from '@affine/component';
|
} from '@affine/component';
|
||||||
import { TrashOperationCell } from '@affine/component/page-list';
|
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { ArrowDownBigIcon, ArrowUpBigIcon } from '@blocksuite/icons';
|
import { ArrowDownBigIcon, ArrowUpBigIcon } from '@blocksuite/icons';
|
||||||
import { useMediaQuery, useTheme } from '@mui/material';
|
import { useMediaQuery, useTheme } from '@mui/material';
|
||||||
@@ -15,7 +14,9 @@ import { AllPagesBody } from './all-pages-body';
|
|||||||
import { NewPageButton } from './components/new-page-buttton';
|
import { NewPageButton } from './components/new-page-buttton';
|
||||||
import { TitleCell } from './components/title-cell';
|
import { TitleCell } from './components/title-cell';
|
||||||
import { AllPageListMobileView, TrashListMobileView } from './mobile';
|
import { AllPageListMobileView, TrashListMobileView } from './mobile';
|
||||||
|
import { TrashOperationCell } from './operation-cell';
|
||||||
import { StyledTableContainer, StyledTableRow } from './styles';
|
import { StyledTableContainer, StyledTableRow } from './styles';
|
||||||
|
import type { ListData } from './type';
|
||||||
import { useSorter } from './use-sorter';
|
import { useSorter } from './use-sorter';
|
||||||
|
|
||||||
export type PageListProps = {
|
export type PageListProps = {
|
||||||
@@ -108,22 +109,6 @@ const AllPagesHead = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ListData = {
|
|
||||||
pageId: string;
|
|
||||||
icon: JSX.Element;
|
|
||||||
title: string;
|
|
||||||
favorite: boolean;
|
|
||||||
createDate: string;
|
|
||||||
updatedDate?: string;
|
|
||||||
trashDate?: string;
|
|
||||||
isPublicPage: boolean;
|
|
||||||
onClickPage: () => void;
|
|
||||||
onOpenPageInNewTab: () => void;
|
|
||||||
bookmarkPage: () => void;
|
|
||||||
removeToTrash: () => void;
|
|
||||||
onDisablePublicSharing: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const PageList = ({
|
export const PageList = ({
|
||||||
isPublicWorkspace = false,
|
isPublicWorkspace = false,
|
||||||
list,
|
list,
|
||||||
@@ -264,5 +249,3 @@ export const PageListTrashView: React.FC<{
|
|||||||
</StyledTableContainer>
|
</StyledTableContainer>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default PageList;
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { TableBody, TableCell } from '@affine/component';
|
import { TableBody, TableCell } from '@affine/component';
|
||||||
import { OperationCell } from '@affine/component/page-list';
|
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
import { useMediaQuery, useTheme } from '@mui/material';
|
import { useMediaQuery, useTheme } from '@mui/material';
|
||||||
|
|
||||||
import type { ListData } from './all-page';
|
|
||||||
import { FavoriteTag } from './components/favorite-tag';
|
import { FavoriteTag } from './components/favorite-tag';
|
||||||
import { TitleCell } from './components/title-cell';
|
import { TitleCell } from './components/title-cell';
|
||||||
|
import { OperationCell } from './operation-cell';
|
||||||
import { StyledTableRow } from './styles';
|
import { StyledTableRow } from './styles';
|
||||||
|
import type { ListData } from './type';
|
||||||
|
|
||||||
export const AllPagesBody = ({
|
export const AllPagesBody = ({
|
||||||
isPublicWorkspace,
|
isPublicWorkspace,
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ export * from './all-page';
|
|||||||
export * from './operation-cell';
|
export * from './operation-cell';
|
||||||
export * from './operation-menu-items';
|
export * from './operation-menu-items';
|
||||||
export * from './styles';
|
export * from './styles';
|
||||||
|
export * from './type';
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import {
|
|||||||
} from '@affine/component';
|
} from '@affine/component';
|
||||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||||
|
|
||||||
import type { ListData } from './all-page';
|
|
||||||
import { AllPagesBody } from './all-pages-body';
|
import { AllPagesBody } from './all-pages-body';
|
||||||
import { NewPageButton } from './components/new-page-buttton';
|
import { NewPageButton } from './components/new-page-buttton';
|
||||||
import {
|
import {
|
||||||
@@ -16,6 +15,7 @@ import {
|
|||||||
StyledTableRow,
|
StyledTableRow,
|
||||||
StyledTitleLink,
|
StyledTitleLink,
|
||||||
} from './styles';
|
} from './styles';
|
||||||
|
import type { ListData } from './type';
|
||||||
|
|
||||||
const MobileHead = ({
|
const MobileHead = ({
|
||||||
isPublicWorkspace,
|
isPublicWorkspace,
|
||||||
|
|||||||
15
packages/component/src/components/page-list/type.ts
Normal file
15
packages/component/src/components/page-list/type.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
export type ListData = {
|
||||||
|
pageId: string;
|
||||||
|
icon: JSX.Element;
|
||||||
|
title: string;
|
||||||
|
favorite: boolean;
|
||||||
|
createDate: string;
|
||||||
|
updatedDate?: string;
|
||||||
|
trashDate?: string;
|
||||||
|
isPublicPage: boolean;
|
||||||
|
onClickPage: () => void;
|
||||||
|
onOpenPageInNewTab: () => void;
|
||||||
|
bookmarkPage: () => void;
|
||||||
|
removeToTrash: () => void;
|
||||||
|
onDisablePublicSharing: () => void;
|
||||||
|
};
|
||||||
@@ -9,7 +9,7 @@ import type {
|
|||||||
TrashListData,
|
TrashListData,
|
||||||
} from '../components/page-list/all-page';
|
} from '../components/page-list/all-page';
|
||||||
import { PageListTrashView } from '../components/page-list/all-page';
|
import { PageListTrashView } from '../components/page-list/all-page';
|
||||||
import PageList from '../components/page-list/all-page';
|
import { PageList } from '../components/page-list/all-page';
|
||||||
import { NewPageButton } from '../components/page-list/components/new-page-buttton';
|
import { NewPageButton } from '../components/page-list/components/new-page-buttton';
|
||||||
import type { OperationCellProps } from '../components/page-list/operation-cell';
|
import type { OperationCellProps } from '../components/page-list/operation-cell';
|
||||||
import { OperationCell } from '../components/page-list/operation-cell';
|
import { OperationCell } from '../components/page-list/operation-cell';
|
||||||
|
|||||||
Reference in New Issue
Block a user