Skip to content

Commit 5f0a68b

Browse files
committed
chore: standardize rc tooling and docs
1 parent 9effc92 commit 5f0a68b

6 files changed

Lines changed: 83 additions & 66 deletions

File tree

.dumirc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig } from 'dumi';
22
import path from 'path';
33

44
const basePath = process.env.GH_PAGES ? '/notification/' : '/';
5-
const publicPath = process.env.GH_PAGES ? '/notification/' : '/';
5+
const publicPath = basePath;
66

77
export default defineConfig({
88
alias: {

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ export default () => (
9494

9595
## Examples
9696

97-
Run the examples locally:
97+
Run the local dumi site:
9898

9999
```bash
100100
npm install
101101
npm start
102102
```
103103

104-
Then open the dumi dev server in your browser.
104+
Then open `http://localhost:8000`.
105105

106106
## API
107107

README.zh-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ export default () => (
9494

9595
## 示例
9696

97-
本地运行示例
97+
运行本地 dumi 站点
9898

9999
```bash
100100
npm install
101101
npm start
102102
```
103103

104-
然后在浏览器中打开 dumi 开发服务地址
104+
然后打开 `http://localhost:8000`
105105

106106
## API
107107

package.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,32 +56,32 @@
5656
"clsx": "^2.1.1"
5757
},
5858
"devDependencies": {
59-
"@rc-component/father-plugin": "^2.0.4",
60-
"@rc-component/np": "^1.0.3",
61-
"@testing-library/jest-dom": "^6.0.0",
59+
"@rc-component/father-plugin": "^2.2.0",
60+
"@rc-component/np": "^1.0.4",
61+
"@testing-library/jest-dom": "^6.9.1",
6262
"@testing-library/react": "^15.0.7",
63-
"@types/node": "^24.5.2",
64-
"@types/react": "^18.0.0",
65-
"@types/react-dom": "^18.0.0",
63+
"@types/node": "^26.0.1",
64+
"@types/react": "^18.3.31",
65+
"@types/react-dom": "^18.3.7",
6666
"@types/testing-library__jest-dom": "^6.0.0",
67-
"@typescript-eslint/eslint-plugin": "^5.59.7",
68-
"@typescript-eslint/parser": "^5.59.7",
67+
"@typescript-eslint/eslint-plugin": "^5.62.0",
68+
"@typescript-eslint/parser": "^5.62.0",
6969
"@umijs/fabric": "^4.0.1",
70-
"@vitest/coverage-v8": "^0.34.2",
71-
"cross-env": "^7.0.0",
72-
"dumi": "^2.1.0",
70+
"@vitest/coverage-v8": "^4.1.9",
71+
"cross-env": "^10.1.0",
72+
"dumi": "^2.4.35",
7373
"eslint": "^8.57.1",
74-
"father": "^4.0.0",
75-
"gh-pages": "^3.1.0",
76-
"husky": "^8.0.3",
77-
"jsdom": "^24.0.0",
78-
"less": "^4.2.0",
79-
"lint-staged": "^14.0.1",
80-
"prettier": "^3.0.2",
81-
"react": "^18.0.0",
82-
"react-dom": "^18.0.0",
83-
"typescript": "^5.4.5",
84-
"vitest": "^0.34.2"
74+
"father": "^4.6.23",
75+
"gh-pages": "^6.3.0",
76+
"husky": "^9.1.7",
77+
"jsdom": "^29.1.1",
78+
"less": "^4.6.7",
79+
"lint-staged": "^16.4.0",
80+
"prettier": "^3.9.0",
81+
"react": "^18.3.1",
82+
"react-dom": "^18.3.1",
83+
"typescript": "^5.9.3",
84+
"vitest": "^4.1.9"
8585
},
8686
"peerDependencies": {
8787
"react": ">=18.0.0",

tests/index.test.tsx

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ describe('Notification.Basic', () => {
4141
}
4242
}
4343

44+
function expectContentStyle(selector: string, content: string) {
45+
expect((document.querySelector(selector) as HTMLElement).style.content).toBe(`"${content}"`);
46+
}
47+
4448
it('works', () => {
4549
const { instance, unmount } = renderDemo();
4650

@@ -637,17 +641,15 @@ describe('Notification.Basic', () => {
637641
it('should style work', () => {
638642
const { instance } = renderDemo({
639643
style: () => ({
640-
content: 'little',
644+
content: '"little"',
641645
}),
642646
});
643647

644648
act(() => {
645649
instance.open({});
646650
});
647651

648-
expect(document.querySelector('.rc-notification')).toHaveStyle({
649-
content: 'little',
650-
});
652+
expectContentStyle('.rc-notification', 'little');
651653
});
652654

653655
it('should open style and className work', () => {
@@ -656,15 +658,13 @@ describe('Notification.Basic', () => {
656658
act(() => {
657659
instance.open({
658660
style: {
659-
content: 'little',
661+
content: '"little"',
660662
},
661663
className: 'bamboo',
662664
});
663665
});
664666

665-
expect(document.querySelector('.rc-notification-notice')).toHaveStyle({
666-
content: 'little',
667-
});
667+
expectContentStyle('.rc-notification-notice', 'little');
668668
expect(document.querySelector('.rc-notification-notice')).toHaveClass('bamboo');
669669
});
670670

@@ -706,7 +706,7 @@ describe('Notification.Basic', () => {
706706
description: 'little',
707707
styles: {
708708
section: {
709-
content: 'light',
709+
content: '"light"',
710710
},
711711
},
712712
classNames: {
@@ -715,9 +715,7 @@ describe('Notification.Basic', () => {
715715
});
716716
});
717717

718-
expect(document.querySelector('.rc-notification-notice-section')).toHaveStyle({
719-
content: 'light',
720-
});
718+
expectContentStyle('.rc-notification-notice-section', 'light');
721719
expect(document.querySelector('.rc-notification-notice-section')).toHaveClass('section-class');
722720
});
723721

@@ -729,7 +727,7 @@ describe('Notification.Basic', () => {
729727
icon: <span />,
730728
styles: {
731729
wrapper: {
732-
content: 'little',
730+
content: '"little"',
733731
},
734732
},
735733
classNames: {
@@ -738,9 +736,7 @@ describe('Notification.Basic', () => {
738736
});
739737
});
740738

741-
expect(document.querySelector('.rc-notification-notice-wrapper')).toHaveStyle({
742-
content: 'little',
743-
});
739+
expectContentStyle('.rc-notification-notice-wrapper', 'little');
744740
expect(document.querySelector('.rc-notification-notice-wrapper')).toHaveClass('bamboo');
745741
});
746742

@@ -777,16 +773,16 @@ describe('Notification.Basic', () => {
777773
},
778774
styles: {
779775
title: {
780-
content: 'global-title',
776+
content: '"global-title"',
781777
},
782778
description: {
783-
content: 'global-description',
779+
content: '"global-description"',
784780
},
785781
actions: {
786-
content: 'global-actions',
782+
content: '"global-actions"',
787783
},
788784
icon: {
789-
content: 'global-icon',
785+
content: '"global-icon"',
790786
},
791787
},
792788
});
@@ -824,33 +820,33 @@ describe('Notification.Basic', () => {
824820
'global-title',
825821
'notice-title',
826822
);
823+
expectContentStyle('.rc-notification-notice-title', 'global-title');
827824
expect(document.querySelector('.rc-notification-notice-title')).toHaveStyle({
828-
content: 'global-title',
829825
marginTop: '1px',
830826
});
831827
expect(document.querySelector('.rc-notification-notice-description')).toHaveClass(
832828
'global-description',
833829
'notice-description',
834830
);
831+
expectContentStyle('.rc-notification-notice-description', 'global-description');
835832
expect(document.querySelector('.rc-notification-notice-description')).toHaveStyle({
836-
content: 'global-description',
837833
marginRight: '2px',
838834
});
839835
expect(document.querySelector('.rc-notification-notice-actions')).toHaveClass(
840836
'global-actions',
841837
'notice-actions',
842838
);
839+
expectContentStyle('.rc-notification-notice-actions', 'global-actions');
843840
expect(document.querySelector('.rc-notification-notice-actions')).toHaveStyle({
844-
content: 'global-actions',
845841
marginBottom: '3px',
846842
});
847843
expect(document.querySelector('.actions')).toBeFalsy();
848844
expect(document.querySelector('.rc-notification-notice-icon')).toHaveClass(
849845
'global-icon',
850846
'notice-icon',
851847
);
848+
expectContentStyle('.rc-notification-notice-icon', 'global-icon');
852849
expect(document.querySelector('.rc-notification-notice-icon')).toHaveStyle({
853-
content: 'global-icon',
854850
marginLeft: '4px',
855851
});
856852
});
@@ -875,10 +871,10 @@ describe('Notification.Basic', () => {
875871
},
876872
styles: {
877873
list: {
878-
content: 'root-list',
874+
content: '"root-list"',
879875
},
880876
listContent: {
881-
content: 'little',
877+
content: '"little"',
882878
},
883879
},
884880
});
@@ -887,13 +883,9 @@ describe('Notification.Basic', () => {
887883
instance.open({});
888884
});
889885

890-
expect(document.querySelector('.rc-notification-list')).toHaveStyle({
891-
content: 'root-list',
892-
});
886+
expectContentStyle('.rc-notification-list', 'root-list');
893887
expect(document.querySelector('.rc-notification-list')).toHaveClass('root-list');
894-
expect(document.querySelector('.rc-notification-list-content')).toHaveStyle({
895-
content: 'little',
896-
});
888+
expectContentStyle('.rc-notification-list-content', 'little');
897889
expect(document.querySelector('.rc-notification-list-content')).toHaveClass('bamboo');
898890
});
899891

tsconfig.json

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,38 @@
88
"skipLibCheck": true,
99
"esModuleInterop": true,
1010
"paths": {
11-
"@/*": ["src/*"],
12-
"@@/*": [".dumi/tmp/*"],
13-
"@rc-component/notification": ["src/index.ts"],
14-
"rc-notification": ["src/index.ts"]
11+
"@/*": [
12+
"src/*"
13+
],
14+
"@@/*": [
15+
".dumi/tmp/*"
16+
],
17+
"@rc-component/notification": [
18+
"src/index.ts"
19+
],
20+
"rc-notification": [
21+
"src/index.ts"
22+
]
1523
},
16-
"types": ["vitest/globals"]
24+
"types": [
25+
"vitest/globals"
26+
],
27+
"ignoreDeprecations": "5.0"
1728
},
18-
"include": ["src", "docs", ".dumirc.ts", ".fatherrc.ts", "vitest.config.ts", "vitest-setup.ts"],
19-
"exclude": ["node_modules", "lib", "es", "dist", "docs-dist", ".dumi"]
29+
"include": [
30+
"src",
31+
"docs",
32+
".dumirc.ts",
33+
".fatherrc.ts",
34+
"vitest.config.ts",
35+
"vitest-setup.ts"
36+
],
37+
"exclude": [
38+
"node_modules",
39+
"lib",
40+
"es",
41+
"dist",
42+
"docs-dist",
43+
".dumi"
44+
]
2045
}

0 commit comments

Comments
 (0)