Skip to content

Commit 86b7162

Browse files
authored
chore: migrate to @rc-component namespace (#158)
* chore: migrate to @rc-component namespace * fix * fix
1 parent 325f3d9 commit 86b7162

File tree

5 files changed

+17
-23
lines changed

5 files changed

+17
-23
lines changed

Diff for: docs/examples/simple.tsx

+7-12
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,28 @@
11
import '../../assets/index.less';
22
import React, { useState } from 'react';
3-
import type { SwitchChangeEventHandler } from 'rc-switch';
4-
import Switch from 'rc-switch';
3+
import type { SwitchChangeEventHandler } from '@rc-component/switch';
4+
import Switch from '@rc-component/switch';
55

66
const onChange: SwitchChangeEventHandler = (value, event) => {
77
// eslint-disable-next-line no-console
88
console.log(`switch checked: ${value}`, event);
9-
}
9+
};
1010

1111
export default () => {
1212
const [disabled, setDisabled] = useState(false);
1313

1414
const toggle = () => {
1515
setDisabled((prev) => !prev);
16-
}
16+
};
1717

1818
return (
1919
<div style={{ margin: 20 }}>
20-
<Switch
21-
onChange={onChange}
22-
disabled={disabled}
23-
checkedChildren="开"
24-
unCheckedChildren="关"
25-
/>
20+
<Switch onChange={onChange} disabled={disabled} checkedChildren="开" unCheckedChildren="关" />
2621
<div style={{ marginTop: 20 }}>
2722
<button type="button" onClick={toggle}>
2823
toggle disabled
2924
</button>
3025
</div>
3126
</div>
32-
)
33-
}
27+
);
28+
};

Diff for: package.json

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "rc-switch",
3-
"version": "4.1.0",
2+
"name": "@rc-component/switch",
3+
"version": "1.0.0",
44
"description": "switch ui component for react",
55
"keywords": [
66
"react",
@@ -32,7 +32,7 @@
3232
"lint": "eslint .",
3333
"lint-staged": "lint-staged",
3434
"prepare": "husky install && dumi setup",
35-
"prepublishOnly": "npm run compile && np --yolo --no-publish",
35+
"prepublishOnly": "npm run compile && rc-np",
3636
"postpublish": "npm run gh-pages",
3737
"start": "dumi dev",
3838
"test": "umi-test"
@@ -43,12 +43,11 @@
4343
]
4444
},
4545
"dependencies": {
46-
"@babel/runtime": "^7.21.0",
4746
"classnames": "^2.2.1",
48-
"rc-util": "^5.30.0"
47+
"@rc-component/util": "^1.2.0"
4948
},
5049
"devDependencies": {
51-
"@rc-component/father-plugin": "^1.0.0",
50+
"@rc-component/father-plugin": "^2.0.0",
5251
"@types/classnames": "^2.2.10",
5352
"@types/jest": "^29.4.0",
5453
"@umijs/fabric": "^3.0.0",
@@ -65,7 +64,7 @@
6564
"husky": "^8.0.1",
6665
"less": "^4.1.3",
6766
"lint-staged": "^15.1.0",
68-
"np": "^9.0.0",
67+
"@rc-component/np": "^1.0.3",
6968
"prettier": "^3.1.0",
7069
"react": "^16.0.0",
7170
"react-dom": "^16.0.0",

Diff for: src/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import classNames from 'classnames';
3-
import useMergedState from 'rc-util/lib/hooks/useMergedState';
4-
import KeyCode from 'rc-util/lib/KeyCode';
3+
import useMergedState from '@rc-component/util/lib/hooks/useMergedState';
4+
import KeyCode from '@rc-component/util/lib/KeyCode';
55

66
export type SwitchChangeEventHandler = (
77
checked: boolean,

Diff for: tests/index.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import KeyCode from 'rc-util/lib/KeyCode';
2+
import KeyCode from '@rc-component/util/lib/KeyCode';
33
import { mount } from 'enzyme';
44
import Switch from '..';
55

Diff for: tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"skipLibCheck": true,
1414
"declaration": true,
1515
"paths": {
16-
"rc-switch": ["src/index.tsx"],
16+
"@rc-component/switch": ["src/"],
1717
"@@/*": [".dumi/tmp/*"]
1818
}
1919
}

0 commit comments

Comments
 (0)