diff --git a/.dumirc.ts b/.dumirc.ts
index ebd40b0d..03f4625b 100644
--- a/.dumirc.ts
+++ b/.dumirc.ts
@@ -1,17 +1,19 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';
+const basePath = process.env.GH_PAGES ? '/menu/' : '/';
+const publicPath = process.env.GH_PAGES ? '/menu/' : '/';
+
export default defineConfig({
themeConfig: {
- name: 'rc-menu',
+ name: 'Menu',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
- nav: [
- { title: 'Demo', link: '/demo/antd'}
- ],
+ nav: [{ title: 'Demo', link: '/demo/antd' }],
},
- favicons:
- ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
- outputPath: '.doc',
+ favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
+ outputPath: 'docs-dist',
+ base: basePath,
+ publicPath,
exportStatic: {},
mfsu: {},
styles: [
@@ -20,5 +22,5 @@ export default defineConfig({
width: auto !important;
}
`,
- ]
+ ],
});
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 33b1999c..758659af 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,15 +1,2 @@
-# These are supported funding model platforms
-
-github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
-patreon: # Replace with a single Patreon username
-open_collective: ant-design # Replace with a single Open Collective username
-ko_fi: # Replace with a single Ko-fi username
-tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
-community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
-liberapay: # Replace with a single Liberapay username
-issuehunt: # Replace with a single IssueHunt username
-lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
-polar: # Replace with a single Polar username
-buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
-thanks_dev: # Replace with a single thanks.dev username
-custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+github: ant-design
+open_collective: ant-design
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 5efca0f4..7df7bc4c 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -1,12 +1,12 @@
-name: "CodeQL"
+name: 'CodeQL'
on:
push:
- branches: [ "master" ]
+ branches: ['master']
pull_request:
- branches: [ "master" ]
+ branches: ['master']
schedule:
- - cron: "12 22 * * 6"
+ - cron: '12 22 * * 6'
jobs:
analyze:
@@ -20,22 +20,24 @@ jobs:
strategy:
fail-fast: false
matrix:
- language: [ javascript ]
+ language: [javascript]
steps:
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
+ with:
+ persist-credentials: false
- name: Initialize CodeQL
- uses: github/codeql-action/init@v2
+ uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Autobuild
- uses: github/codeql-action/autobuild@v2
+ uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
- name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v2
+ uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
with:
- category: "/language:${{ matrix.language }}"
+ category: '/language:${{ matrix.language }}'
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
deleted file mode 100644
index 5735e2d2..00000000
--- a/.github/workflows/main.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-name: ✅ test
-on: [push, pull_request]
-jobs:
- test:
- uses: react-component/rc-test/.github/workflows/test.yml@main
- secrets: inherit
\ No newline at end of file
diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml
new file mode 100644
index 00000000..9503b960
--- /dev/null
+++ b/.github/workflows/react-component-ci.yml
@@ -0,0 +1,8 @@
+name: ✅ test
+on: [push, pull_request]
+permissions:
+ contents: read
+jobs:
+ test:
+ uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
+ secrets: inherit
diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml
new file mode 100644
index 00000000..f68281c8
--- /dev/null
+++ b/.github/workflows/react-doctor.yml
@@ -0,0 +1,27 @@
+name: React Doctor
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened, ready_for_review]
+ push:
+ branches: [master]
+
+permissions:
+ contents: read
+ pull-requests: write
+ issues: write
+ statuses: write
+
+concurrency:
+ group: react-doctor-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ react-doctor:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+ - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3
diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml
new file mode 100644
index 00000000..faf6b8bd
--- /dev/null
+++ b/.github/workflows/surge-preview.yml
@@ -0,0 +1,42 @@
+name: Surge Preview
+
+on:
+ pull_request:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+ pull-requests: write
+ checks: write
+ statuses: write
+
+jobs:
+ preview:
+ runs-on: ubuntu-latest
+ env:
+ PREVIEW: true
+ steps:
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
+ with:
+ persist-credentials: false
+ - name: Build preview
+ if: ${{ secrets.SURGE_TOKEN != '' }}
+ run: |
+ npm install
+ npm run build
+ - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec
+ if: ${{ secrets.SURGE_TOKEN != '' }}
+ env:
+ SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
+ with:
+ surge_token: ${{ env.SURGE_TOKEN }}
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ dist: docs-dist
+ failOnError: false
+ setCommitStatus: false
+ - name: Skip Surge preview
+ if: ${{ secrets.SURGE_TOKEN == '' }}
+ run: echo "SURGE_TOKEN is not configured; skip Surge preview."
diff --git a/.gitignore b/.gitignore
index 898129e9..267c6ce6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,8 @@ build
lib
es
coverage
+.doc
+docs-dist/
yarn.lock
package-lock.json
pnpm-lock.yaml
@@ -38,4 +40,5 @@ pnpm-lock.yaml
.dumi/tmp-production
.env.local
-bun.lockb
\ No newline at end of file
+bun.lockb
+.vercel
diff --git a/README.md b/README.md
index 22d3dce2..f6bd4ce5 100644
--- a/README.md
+++ b/README.md
@@ -1,464 +1,193 @@
-# @rc-component/menu
+
+
@rc-component/menu
+
Part of the Ant Design ecosystem.
+

+
🧭 Accessible React menu primitives for navigation, command surfaces, and nested item trees.
+
----
-React Menu Component. port from https://github.com/kissyteam/menu
+
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]
-[npm-image]: https://img.shields.io/npm/v/@rc-component/menu.svg?style=flat-square
-[npm-url]: https://npmjs.org/package/@rc-component/menu
-[github-actions-image]: https://github.com/react-component/menu/actions/workflows/main.yml/badge.svg
-[github-actions-url]: https://github.com/react-component/menu/actions/workflows/main.yml
-[circleci-image]: https://img.shields.io/circleci/react-component/menu/master?style=flat-square
-[circleci-url]: https://circleci.com/gh/react-component/menu
-[codecov-image]: https://img.shields.io/codecov/c/github/react-component/footer/master.svg?style=flat-square
-[codecov-url]: https://codecov.io/gh/react-component/footer/branch/master
-[coveralls-image]: https://img.shields.io/coveralls/react-component/menu.svg?style=flat-square
-[coveralls-url]: https://coveralls.io/r/react-component/menu?branch=master
-[david-url]: https://david-dm.org/react-component/menu
-[david-image]: https://david-dm.org/react-component/menu/status.svg?style=flat-square
-[david-dev-url]: https://david-dm.org/react-component/menu?type=dev
-[david-dev-image]: https://david-dm.org/react-component/menu/dev-status.svg?style=flat-square
-[download-image]: https://img.shields.io/npm/dm/@rc-component/menu.svg?style=flat-square
-[download-url]: https://npmjs.org/package/@rc-component/menu
-[bundlephobia-url]: https://bundlephobia.com/result?p=@rc-component/menu
-[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/menu
-[dumi-url]: https://github.com/umijs/dumi
-[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
+
+
+
+## Highlights
+
+- Horizontal, vertical, and inline menu modes.
+- Controlled and uncontrolled selection, open keys, and active key state.
+- `items` configuration API with legacy children support.
+- Sub menus, item groups, dividers, icons, overflow, popup rendering, and keyboard focus helpers.
+- TypeScript definitions and semantic `classNames` / `styles` slots.
+- Used by Ant Design as the shared menu foundation.
## Install
-[](https://npmjs.org/package/@rc-component/menu)
+```bash
+npm install @rc-component/menu
+```
## Usage
-```js
-import Menu, { SubMenu, MenuItem } from '@rc-component/menu';
+```tsx | pure
+import Menu, { type MenuProps } from '@rc-component/menu';
+
+const items: MenuProps['items'] = [
+ { key: 'home', label: 'Home' },
+ {
+ key: 'docs',
+ label: 'Docs',
+ children: [
+ { key: 'quick-start', label: 'Quick start' },
+ { key: 'api', label: 'API' },
+ ],
+ },
+];
+
+export default () => (
+
+);
+```
-ReactDOM.render(
+```tsx | pure
+import Menu, { MenuItem, SubMenu } from '@rc-component/menu';
+
+export default () => (
,
- container,
+
);
```
-## Compatibility
-
-| [
](http://godban.github.io/browsers-support-badges/)
IE / Edge | [
](http://godban.github.io/browsers-support-badges/)
Firefox | [
](http://godban.github.io/browsers-support-badges/)
Chrome | [
](http://godban.github.io/browsers-support-badges/)
Safari | [
](http://godban.github.io/browsers-support-badges/)
Electron |
-| --- | --- | --- | --- | --- |
-| IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
+## Examples
-## API
-
-### Menu props
-
-
-
-
- | name |
- type |
- default |
- description |
-
-
-
-
- | ref |
- React.HTMLLIElement |
- |
- get dom node |
-
-
- | className |
- String |
- |
- additional css class of root dom node |
-
-
- | mode |
- String |
- vertical |
- one of ["horizontal","inline","vertical-left","vertical-right"] |
-
-
- | activeKey |
- String |
- |
- initial and current active menu item's key. |
-
-
- | defaultActiveFirst |
- Boolean |
- false |
- whether active first menu item when show if activeKey is not set or invalid |
-
-
- | multiple |
- Boolean |
- false |
- whether allow multiple select |
-
-
- | selectable |
- Boolean |
- true |
- allow selecting menu items |
-
-
- | selectedKeys |
- String[] |
- [] |
- selected keys of items |
-
-
- | defaultSelectedKeys |
- String[] |
- [] |
- initial selected keys of items |
-
-
- | openKeys |
- String[] |
- [] |
- open keys of SubMenuItem |
-
-
- | defaultOpenKeys |
- String[] |
- [] |
- initial open keys of SubMenuItem |
-
-
- | onSelect |
- function({key:String, item:ReactComponent, domEvent:Event, selectedKeys:String[],ItemData:ItemData}) |
- |
- called when select a menu item |
-
-
- | onClick |
- function({key:String, item:ReactComponent, domEvent:Event, keyPath: String[], ItemData:ItemData}) |
- |
- called when click a menu item |
-
-
- | onOpenChange |
- (openKeys:String[]) => void |
- |
- called when open/close sub menu |
-
-
- | onDeselect |
- function({key:String, item:ReactComponent, domEvent:Event, selectedKeys:String[]}) |
- |
- called when deselect a menu item. only called when allow multiple |
-
-
- | triggerSubMenuAction |
- Enum { hover, click } |
- hover |
- which action can trigger submenu open/close |
-
-
- | openAnimation |
- {enter:function,leave:function}|String |
- |
- animate when sub menu open or close. see @rc-component/motion for object type. |
-
-
- | openTransition |
- String |
- |
- css transitionName when sub menu open or close |
-
-
- | subMenuOpenDelay |
- Number |
- 0 |
- delay time to show popup sub menu. unit: s |
-
-
- | subMenuCloseDelay |
- Number |
- 0.1 |
- delay time to hide popup sub menu. unit: s |
-
-
- | forceSubMenuRender |
- Boolean |
- false |
- whether to render submenu even if it is not visible |
-
-
- | getPopupContainer |
- Function(menuDOMNode): HTMLElement |
- () => document.body |
- Where to render the DOM node of popup menu when the mode is horizontal or vertical |
-
-
- | builtinPlacements |
- Object of alignConfigs for dom-align |
- see placements.ts |
- Describes how the popup menus should be positioned |
-
-
- | itemIcon |
- ReactNode | (props: MenuItemProps) => ReactNode |
- |
- Specify the menu item icon. |
-
-
- | expandIcon |
- ReactNode | (props: SubMenuProps & { isSubMenu: boolean }) => ReactNode |
- |
- Specify the menu item icon. |
-
-
- | direction |
- String |
- |
- Layout direction of menu component, it supports RTL direction too. |
-
-
- | inlineIndent |
- Number |
- 24 |
- Padding level multiplier. Right or left padding depends on param "direction". |
-
-
-
-
-### Menu.Item props
-
-
-
-
- | name |
- type |
- default |
- description |
-
-
-
-
- | className |
- String |
- |
- additional css class of root dom node |
-
-
- | disabled |
- Boolean |
- false |
- no effect for click or keydown for this item |
-
-
- | extra |
- React.ReactNode |
- |
- Specify menu item extra node. |
-
-
- | key |
- Object |
- |
- corresponding to activeKey |
-
-
- | onMouseEnter |
- Function({eventKey, domEvent}) |
- |
- |
-
-
- | onMouseLeave |
- Function({eventKey, domEvent}) |
- |
- |
-
-
- | itemIcon |
- ReactNode | (props: MenuItemProps) => ReactNode |
- |
- Specify the menu item icon. |
-
-
-
-
-### Menu.SubMenu props
-
-
-
-
- | name |
- type |
- default |
- description |
-
-
-
-
- | ref |
- React.HTMLLIElement |
- |
- get dom node |
-
-
- | popupClassName |
- String |
- |
- additional css class of root dom node |
-
-
- | popupStyle |
- CSSProperties |
- |
- additional css style of root dom node |
-
-
- | title |
- String/ReactElement |
- |
- sub menu's content |
-
-
- | overflowedIndicator |
- String/ReactElement |
- ··· |
- overflow indicator when menu overlows in horizontal mode |
-
-
- | key |
- Object |
- |
- corresponding to activeKey |
-
-
- | disabled |
- Boolean |
- false |
- no effect for click or keydown for this item |
-
-
- | onMouseEnter |
- Function({eventKey, domEvent}) |
- |
- |
-
-
- | onMouseLeave |
- Function({eventKey, domEvent}) |
- |
- |
-
-
- | onTitleMouseEnter |
- Function({eventKey, domEvent}) |
- |
- |
-
-
- | onTitleMouseLeave |
- Function({eventKey, domEvent}) |
- |
- |
-
-
- | onTitleClick |
- Function({eventKey, domEvent}) |
- |
- |
-
-
- | popupOffset |
- Array |
- |
- The offset of the popup submenu, in an x, y coordinate array. e.g.: `[0,15]` |
-
-
- | expandIcon |
- ReactNode | (props: SubMenuProps) => ReactNode |
- |
- Specify the menu item icon. |
-
-
- | itemIcon |
- ReactNode | (props: SubMenuProps & { isSubMenu: boolean }) => ReactNode |
- |
- Specify the menu item icon. |
-
-
-
-
-### Menu.Divider props
-
-none
-
-### Menu.ItemGroup props
-
-
-
-
- | name |
- type |
- default |
- description |
-
-
-
-
- | ref |
- React.HTMLLIElement |
- |
- get dom node |
-
-
- | title |
- String|React.Element |
- |
- title of item group |
-
-
- | children |
- React.Element[] |
- |
- MenuItems belonged to this group |
-
-
-
-
-## Development
+Run the examples locally:
-```
+```bash
npm install
npm start
```
-## Example
+Then open the dumi dev server in your browser.
-http://localhost:8001/examples/index.md
+## API
-online example: http://react-component.github.io/menu/examples/
+### Menu
+
+| Property | Type | Default | Description |
+| --- | --- | --- | --- |
+| activeKey | `string` | - | Controlled active item key. |
+| builtinPlacements | `Record` | - | Popup alignment placements for sub menus. |
+| className | `string` | - | Class name for the root menu. |
+| classNames | `Partial>` | - | Semantic class names for menu slots. |
+| defaultActiveFirst | `boolean` | `false` | Focus the first enabled item when active key is absent. |
+| defaultOpenKeys | `string[]` | `[]` | Initial open sub menu keys. |
+| defaultSelectedKeys | `string[]` | `[]` | Initial selected item keys. |
+| defaultMotions | `Partial>` | - | Motion config by menu mode. |
+| direction | `'ltr' \| 'rtl'` | - | Layout direction. |
+| disabled | `boolean` | `false` | Disable all menu interactions. |
+| disabledOverflow | `boolean` | `false` | Disable overflow measurement. |
+| expandIcon | `ReactNode \| (props: RenderIconInfo) => ReactNode` | - | Custom sub menu expand icon. |
+| forceSubMenuRender | `boolean` | `false` | Render popup sub menus before they are opened. |
+| getPopupContainer | `(node: HTMLElement) => HTMLElement` | - | Container for popup sub menus. |
+| inlineCollapsed | `boolean` | - | Collapse inline menu layout. |
+| inlineIndent | `number` | `24` | Indent width for inline mode. |
+| itemIcon | `ReactNode \| (props: RenderIconInfo) => ReactNode` | - | Custom item icon. |
+| items | `ItemType[]` | - | Menu item configuration. |
+| mode | `'horizontal' \| 'vertical' \| 'inline'` | `vertical` | Menu display mode. |
+| motion | `CSSMotionProps` | - | Motion config for menu transitions. |
+| multiple | `boolean` | `false` | Allow multiple selected items. |
+| openKeys | `string[]` | - | Controlled open sub menu keys. |
+| overflowedIndicator | `ReactNode` | `"..."` | Indicator rendered for overflowed items. |
+| popupRender | `(node, info) => ReactNode` | - | Customize popup menu rendering. |
+| prefixCls | `string` | `rc-menu` | Class name prefix. |
+| rootClassName | `string` | - | Class name for the root wrapper. |
+| selectable | `boolean` | `true` | Allow item selection. |
+| selectedKeys | `string[]` | - | Controlled selected item keys. |
+| styles | `Partial>` | - | Semantic styles for menu slots. |
+| subMenuCloseDelay | `number` | `0.1` | Delay in seconds before closing popup sub menus. |
+| subMenuOpenDelay | `number` | `0.1` | Delay in seconds before opening popup sub menus. |
+| triggerSubMenuAction | `'click' \| 'hover'` | `hover` | Interaction that opens sub menus. |
+| onClick | `(info: MenuInfo) => void` | - | Triggered when an item is clicked. |
+| onDeselect | `(info: SelectInfo) => void` | - | Triggered when an item is deselected. |
+| onOpenChange | `(openKeys: string[]) => void` | - | Triggered when open keys change. |
+| onSelect | `(info: SelectInfo) => void` | - | Triggered when an item is selected. |
+
+### ItemType
+
+```ts
+type ItemType =
+ | {
+ type?: 'item';
+ // Item keys accept React.Key and are normalized to strings in event info.
+ key: React.Key;
+ label?: React.ReactNode;
+ disabled?: boolean;
+ itemIcon?: RenderIconType;
+ extra?: React.ReactNode;
+ }
+ | {
+ type?: 'submenu';
+ // Sub menu keys are strings to match openKeys/defaultOpenKeys.
+ key: string;
+ label?: React.ReactNode;
+ children: ItemType[];
+ disabled?: boolean;
+ }
+ | {
+ type: 'group';
+ label?: React.ReactNode;
+ children?: ItemType[];
+ }
+ | {
+ type: 'divider';
+ };
+```
-## Test Case
+### Ref
-```
+| Method | Type | Description |
+| --- | --- | --- |
+| `focus` | `(options?: FocusOptions) => void` | Focus the active item or first enabled item. |
+| `findItem` | `({ key: string }) => HTMLElement \| null` | Find the DOM element for an item key. |
+| `list` | `HTMLUListElement` | Root menu list element. |
+
+## Development
+
+```bash
+npm install
+npm start
npm test
-npm run chrome-test
+npm run tsc
+npm run compile
+npm run build
```
-## Coverage
+## Release
-```
-npm run coverage
+```bash
+npm run prepublishOnly
```
-open coverage/ dir
+The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build.
## License
-@rc-component/menu is released under the MIT license.
+@rc-component/menu is released under the [MIT](./LICENSE.md) license.
+
+[npm-image]: https://img.shields.io/npm/v/@rc-component/menu.svg?style=flat-square
+[npm-url]: https://npmjs.org/package/@rc-component/menu
+[github-actions-image]: https://github.com/react-component/menu/actions/workflows/react-component-ci.yml/badge.svg
+[github-actions-url]: https://github.com/react-component/menu/actions/workflows/react-component-ci.yml
+[codecov-image]: https://img.shields.io/codecov/c/github/react-component/menu/master.svg?style=flat-square
+[codecov-url]: https://app.codecov.io/gh/react-component/menu
+[download-image]: https://img.shields.io/npm/dm/@rc-component/menu.svg?style=flat-square
+[download-url]: https://npmjs.org/package/@rc-component/menu
+[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/menu
+[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/@rc-component/menu?style=flat-square
+[dumi-url]: https://github.com/umijs/dumi
+[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
diff --git a/now.json b/now.json
deleted file mode 100644
index 2f8b73fd..00000000
--- a/now.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "version": 2,
- "name": "rc-menu",
- "builds": [
- {
- "src": "package.json",
- "use": "@now/static-build",
- "config": { "distDir": ".doc" }
- }
- ],
- "routes": [
- { "src": "/(.*)", "dest": "/dist/$1" }
- ]
-}
diff --git a/package.json b/package.json
index 4d137325..aa396c73 100644
--- a/package.json
+++ b/package.json
@@ -31,16 +31,18 @@
"assets/*.less"
],
"scripts": {
+ "build": "npm run docs:build",
"compile": "father build && lessc assets/index.less assets/index.css",
"coverage": "rc-test --coverage",
"docs:build": "dumi build",
- "docs:deploy": "gh-pages -d .doc",
+ "docs:deploy": "gh-pages -d docs-dist",
+ "gh-pages": "cross-env GH_PAGES=1 npm run docs:build && npm run docs:deploy",
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
- "now-build": "npm run build",
"prepublishOnly": "npm run compile && rc-np",
- "postpublish": "tnpm sync @rc-component/menu",
+ "prettier": "prettier --write --ignore-unknown .",
"start": "dumi dev",
"test": "rc-test",
+ "tsc": "tsc --noEmit",
"prepare": "husky && dumi setup"
},
"dependencies": {
@@ -61,6 +63,7 @@
"@types/react-dom": "^18.3.7",
"@types/warning": "^3.0.0",
"@umijs/fabric": "^4.0.1",
+ "cross-env": "^7.0.0",
"dumi": "^2.1.17",
"eslint": "^8.55.0",
"father": "^4.0.0",
diff --git a/tsconfig.json b/tsconfig.json
index 0e7a3f4a..18a8d24a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,5 +12,7 @@
"@@/*": [".dumi/tmp/*"],
"@rc-component/menu": ["src/index.ts"]
}
- }
+ },
+ "include": ["src", "docs", ".dumirc.ts"],
+ "exclude": ["node_modules", "lib", "es", "dist", "docs-dist", ".dumi"]
}
diff --git a/vercel.json b/vercel.json
new file mode 100644
index 00000000..5f9139ef
--- /dev/null
+++ b/vercel.json
@@ -0,0 +1,6 @@
+{
+ "framework": "umijs",
+ "installCommand": "npm install",
+ "buildCommand": "npm run build",
+ "outputDirectory": "docs-dist"
+}