Skip to content

Commit aa2deed

Browse files
authored
docs: Update docs (#1)
* docs: Update docs * chore: bump dev react * chore: cov * chore: update deps * chore: fix pkg * chore: Update CI * chore: fix lint
1 parent e5d08cf commit aa2deed

File tree

5 files changed

+151
-29
lines changed

5 files changed

+151
-29
lines changed

.github/workflows/main.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
setup:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@master
15+
16+
- uses: actions/setup-node@v1
17+
with:
18+
node-version: '12'
19+
20+
- name: cache package-lock.json
21+
uses: actions/cache@v2
22+
with:
23+
path: package-temp-dir
24+
key: lock-${{ github.sha }}
25+
26+
- name: create package-lock.json
27+
run: npm i --package-lock-only
28+
29+
- name: hack for singe file
30+
run: |
31+
if [ ! -d "package-temp-dir" ]; then
32+
mkdir package-temp-dir
33+
fi
34+
cp package-lock.json package-temp-dir
35+
36+
- name: cache node_modules
37+
id: node_modules_cache_id
38+
uses: actions/cache@v2
39+
with:
40+
path: node_modules
41+
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
42+
43+
- name: install
44+
if: steps.node_modules_cache_id.outputs.cache-hit != 'true'
45+
run: npm ci
46+
47+
lint:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: checkout
51+
uses: actions/checkout@master
52+
53+
- name: restore cache from package-lock.json
54+
uses: actions/cache@v2
55+
with:
56+
path: package-temp-dir
57+
key: lock-${{ github.sha }}
58+
59+
- name: restore cache from node_modules
60+
uses: actions/cache@v2
61+
with:
62+
path: node_modules
63+
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
64+
65+
- name: lint
66+
run: npm run lint
67+
68+
- name: ts check
69+
run: npm run lint:tsc
70+
71+
needs: setup
72+
73+
compile:
74+
runs-on: ubuntu-latest
75+
steps:
76+
- name: checkout
77+
uses: actions/checkout@master
78+
79+
- name: restore cache from package-lock.json
80+
uses: actions/cache@v2
81+
with:
82+
path: package-temp-dir
83+
key: lock-${{ github.sha }}
84+
85+
- name: restore cache from node_modules
86+
uses: actions/cache@v2
87+
with:
88+
path: node_modules
89+
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
90+
91+
- name: compile
92+
run: npm run compile
93+
94+
needs: setup
95+
96+
coverage:
97+
runs-on: ubuntu-latest
98+
steps:
99+
- name: checkout
100+
uses: actions/checkout@master
101+
102+
- name: restore cache from package-lock.json
103+
uses: actions/cache@v2
104+
with:
105+
path: package-temp-dir
106+
key: lock-${{ github.sha }}
107+
108+
- name: restore cache from node_modules
109+
uses: actions/cache@v2
110+
with:
111+
path: node_modules
112+
key: node_modules-${{ hashFiles('**/package-temp-dir/package-lock.json') }}
113+
114+
- name: coverage
115+
run: npm test -- --coverage && bash <(curl -s https://codecov.io/bash)
116+
117+
needs: setup

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ We use typescript to create the Type definition. You can view directly in IDE. B
4747

4848
### Portal
4949

50-
| Prop | Description | Type | Default |
51-
| --------- | ------------------------------- | ---------------------------- | ------- |
52-
| component | Customize Form render component | string \| Component \| false | form |
50+
| Prop | Description | Type | Default |
51+
| ------------ | ---------------------------------- | ------------------------ | ------------- |
52+
| getContainer | Customize portal container element | Element \| () => Element | document.body |
53+
| open | Show the portal | boolean | false |
54+
| autoLock | Lock screen scroll when open | boolean | false |

package.json

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,45 @@
11
{
2-
"name": "rc-component/portal",
2+
"name": "@rc-component/portal",
33
"version": "0.0.0",
44
"description": "React Portal Component",
5-
"typings": "es/index.d.ts",
6-
"engines": {
7-
"node": ">=8.x"
8-
},
95
"keywords": [
106
"react",
117
"react-component",
128
"react-portal"
139
],
1410
"homepage": "https://github.com/react-component/portal",
15-
"author": "[email protected]",
11+
"bugs": {
12+
"url": "https://github.com/react-component/portal/issues"
13+
},
1614
"repository": {
1715
"type": "git",
1816
"url": "https://github.com/react-component/portal.git"
1917
},
20-
"bugs": {
21-
"url": "https://github.com/react-component/portal/issues"
22-
},
18+
"license": "MIT",
19+
"author": "[email protected]",
20+
"main": "./lib/index",
21+
"module": "./es/index",
22+
"typings": "es/index.d.ts",
2323
"files": [
2424
"lib",
2525
"es",
2626
"dist"
2727
],
28-
"license": "MIT",
29-
"main": "./lib/index",
30-
"module": "./es/index",
3128
"scripts": {
32-
"start": "dumi dev",
33-
"docs:build": "dumi build",
34-
"docs:deploy": "gh-pages -d docs-dist",
3529
"compile": "father build",
3630
"deploy": "npm run docs:build && npm run docs:deploy",
37-
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
38-
"test": "umi-test",
39-
"test:coverage": "umi-test --coverage",
40-
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
31+
"docs:build": "dumi build",
32+
"docs:deploy": "gh-pages -d docs-dist",
4133
"lint": "eslint src/ --ext .tsx,.ts",
4234
"lint:tsc": "tsc -p tsconfig.json --noEmit",
4335
"now-build": "npm run docs:build",
36+
"prepublishOnly": "npm run compile && np --no-cleanup --yolo --no-publish",
37+
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
38+
"start": "dumi dev",
39+
"test": "umi-test",
40+
"test:coverage": "umi-test --coverage",
4441
"watch": "father dev"
4542
},
46-
"peerDependencies": {
47-
"react": ">=16.9.0",
48-
"react-dom": ">=16.9.0"
49-
},
5043
"dependencies": {
5144
"@babel/runtime": "^7.18.0",
5245
"rc-util": "^5.8.0"
@@ -64,9 +57,16 @@
6457
"gh-pages": "^3.1.0",
6558
"np": "^5.0.3",
6659
"prettier": "^2.1.2",
67-
"react": "^16.14.0",
68-
"react-dom": "^16.14.0",
60+
"react": "^18.0.0",
61+
"react-dom": "^18.0.0",
6962
"typescript": "^4.6.3",
7063
"umi-test": "^1.9.7"
64+
},
65+
"peerDependencies": {
66+
"react": ">=16.9.0",
67+
"react-dom": ">=16.9.0"
68+
},
69+
"engines": {
70+
"node": ">=8.x"
7171
}
7272
}

src/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
import Portal from './Portal';
2+
import type { PortalProps } from './Portal';
3+
4+
export type { PortalProps };
25

36
export default Portal;

tests/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import { render } from '@testing-library/react';
3-
import Portal from '../src/React/Portal';
3+
import Portal from '../src';
44

55
describe('Portal', () => {
66
it('Order', () => {

0 commit comments

Comments
 (0)