From f8f566e7bbfa516ae7455f1d5cba3551c1a500fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=AC=A2?= Date: Wed, 22 Oct 2025 16:27:06 +0800 Subject: [PATCH 1/2] chore: migrate to @rc-component namespace --- .dumirc.ts | 6 +++--- README.md | 2 +- examples/fill-width.tsx | 2 +- now.json | 11 ----------- package.json | 15 +++++++-------- src/Item.tsx | 2 +- src/Overflow.tsx | 4 ++-- src/hooks/channelUpdate.ts | 2 +- src/hooks/useEffectState.tsx | 2 +- tests/github.spec.tsx | 4 ++-- tsconfig.json | 2 +- 11 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 now.json diff --git a/.dumirc.ts b/.dumirc.ts index b7bb3f8..c95d79d 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -4,13 +4,13 @@ const isGitPagesSite = process.env.GITHUB_ACTIONS; export default defineConfig({ favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], themeConfig: { - name: 'rc-overflow', + name: '@rc-component/overflow', logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', }, exportStatic: {}, outputPath: 'docs-dist', - base: isGitPagesSite ? `/rc-overflow/` : `/`, - publicPath: isGitPagesSite ? `/rc-overflow/` : `/`, + base: isGitPagesSite ? `/@rc-component/overflow/` : `/`, + publicPath: isGitPagesSite ? `/@rc-component/overflow/` : `/`, styles: [ ` .markdown table { diff --git a/README.md b/README.md index f4e1ebc..875b80e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# rc-overflow 🐾 +# @rc-component/overflow 🐾 [![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] diff --git a/examples/fill-width.tsx b/examples/fill-width.tsx index 5dd6407..e433bf1 100644 --- a/examples/fill-width.tsx +++ b/examples/fill-width.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import useLayoutEffect from "rc-util/lib/hooks/useLayoutEffect"; +import useLayoutEffect from "@rc-component/util/lib/hooks/useLayoutEffect"; import Overflow from '../src'; import '../assets/index.less'; import './common.less'; diff --git a/now.json b/now.json deleted file mode 100644 index 7b2f649..0000000 --- a/now.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 2, - "name": "rc-overflow", - "builds": [ - { - "src": "package.json", - "use": "@vercel/static-build", - "config": { "distDir": "docs-dist" } - } - ] -} \ No newline at end of file diff --git a/package.json b/package.json index 78520de..e699f3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "rc-overflow", - "version": "1.4.1", + "name": "@rc-component/overflow", + "version": "1.0.0", "description": "Auto collapse box when overflow", "keywords": [ "react", @@ -38,19 +38,19 @@ "prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"", "test": "rc-test", "test:coverage": "rc-test --coverage", - "prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish", + "prepublishOnly": "npm run compile && rc-np", "lint": "eslint src/ --ext .tsx,.ts", "lint:tsc": "tsc -p tsconfig.json --noEmit", "now-build": "npm run docs:build" }, "dependencies": { - "@babel/runtime": "^7.11.1", "classnames": "^2.2.1", - "rc-resize-observer": "^1.0.0", - "rc-util": "^5.37.0" + "@rc-component/resize-observer": "^1.0.0", + "@rc-component/util": "^1.3.0" }, "devDependencies": { - "@rc-component/father-plugin": "^1.0.0", + "@rc-component/father-plugin": "^2.0.0", + "@rc-component/np": "^1.0.3", "@testing-library/jest-dom": "^5.16.4", "@testing-library/react": "^12.0.0", "@types/classnames": "^2.2.9", @@ -73,7 +73,6 @@ "father": "^4.0.0", "glob": "^10.0.0", "less": "^3.10.3", - "np": "^7.0.0", "prettier": "^2.0.5", "rc-test": "^7.0", "react": "^16.0.0", diff --git a/src/Item.tsx b/src/Item.tsx index 6946da6..a1e89ff 100644 --- a/src/Item.tsx +++ b/src/Item.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import classNames from 'classnames'; -import ResizeObserver from 'rc-resize-observer'; +import ResizeObserver from '@rc-component/resize-observer'; import type { ComponentType } from './RawItem'; // Use shared variable to save bundle size diff --git a/src/Overflow.tsx b/src/Overflow.tsx index 1a2af67..4a096be 100644 --- a/src/Overflow.tsx +++ b/src/Overflow.tsx @@ -1,8 +1,8 @@ import * as React from 'react'; import { useState, useMemo, useCallback } from 'react'; import classNames from 'classnames'; -import ResizeObserver from 'rc-resize-observer'; -import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect'; +import ResizeObserver from '@rc-component/resize-observer'; +import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect'; import Item from './Item'; import useEffectState, { useBatcher } from './hooks/useEffectState'; import type { ComponentType } from './RawItem'; diff --git a/src/hooks/channelUpdate.ts b/src/hooks/channelUpdate.ts index fabb27a..4422798 100644 --- a/src/hooks/channelUpdate.ts +++ b/src/hooks/channelUpdate.ts @@ -1,4 +1,4 @@ -import raf from 'rc-util/lib/raf'; +import raf from '@rc-component/util/lib/raf'; export default function channelUpdate(callback: VoidFunction) { if (typeof MessageChannel === 'undefined') { diff --git a/src/hooks/useEffectState.tsx b/src/hooks/useEffectState.tsx index 02833f2..75d47bc 100644 --- a/src/hooks/useEffectState.tsx +++ b/src/hooks/useEffectState.tsx @@ -1,4 +1,4 @@ -import useEvent from 'rc-util/lib/hooks/useEvent'; +import { useEvent } from '@rc-component/util'; import * as React from 'react'; import { unstable_batchedUpdates } from 'react-dom'; import channelUpdate from './channelUpdate'; diff --git a/tests/github.spec.tsx b/tests/github.spec.tsx index 05b21f4..c709b2b 100644 --- a/tests/github.spec.tsx +++ b/tests/github.spec.tsx @@ -1,9 +1,9 @@ import React from 'react'; import { render, act } from '@testing-library/react'; -import { spyElementPrototypes } from 'rc-util/lib/test/domHook'; +import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook'; import Overflow from '../src'; -import { _rs as onResize } from 'rc-resize-observer/lib/utils/observerUtil'; +import { _rs as onResize } from '@rc-component/resize-observer/lib/utils/observerUtil'; interface ItemType { label: React.ReactNode; diff --git a/tsconfig.json b/tsconfig.json index 168ea06..4949a5c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "paths": { "@/*": ["src/*"], "@@/*": [".dumi/tmp/*"], - "rc-overflow": ["src/index.tsx"] + "@rc-component/overflow": ["src/index.tsx"] } } } \ No newline at end of file From 142c9a1d254b6254e51774d17f42897c965c7416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=AC=A2?= Date: Wed, 22 Oct 2025 16:42:56 +0800 Subject: [PATCH 2/2] feat: restore dumirc --- .dumirc.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.dumirc.ts b/.dumirc.ts index c95d79d..b7bb3f8 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -4,13 +4,13 @@ const isGitPagesSite = process.env.GITHUB_ACTIONS; export default defineConfig({ favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], themeConfig: { - name: '@rc-component/overflow', + name: 'rc-overflow', logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', }, exportStatic: {}, outputPath: 'docs-dist', - base: isGitPagesSite ? `/@rc-component/overflow/` : `/`, - publicPath: isGitPagesSite ? `/@rc-component/overflow/` : `/`, + base: isGitPagesSite ? `/rc-overflow/` : `/`, + publicPath: isGitPagesSite ? `/rc-overflow/` : `/`, styles: [ ` .markdown table {