Skip to content

Commit

Permalink
docs: upgrade dumi version (#523)
Browse files Browse the repository at this point in the history
* chore: init

* fix: types

* docs: update docs

* chore: fix type

* chore: clean up

* test: init

* test: js -> ts

* test: part

* test: part

* test: part

* chore: rest of it

* chore: bump types

* test: fixed
  • Loading branch information
zombieJ authored Dec 21, 2023
1 parent 211979f commit 5bfa1a5
Show file tree
Hide file tree
Showing 22 changed files with 280 additions and 322 deletions.
15 changes: 15 additions & 0 deletions .dumirc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'dumi';
import path from 'path';

export default defineConfig({
alias: {
'rc-upload$': path.resolve('src'),
'rc-upload/es': path.resolve('src'),
},
mfsu: false,
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
themeConfig: {
name: 'Upload',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
});
14 changes: 5 additions & 9 deletions .fatherrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
export default {
cjs: "babel",
esm: { type: "babel", importLibToEs: true },
preCommit: {
eslint: true,
prettier: true,
},
runtimeHelpers: true,
};
import { defineConfig } from 'father';

export default defineConfig({
plugins: ['@rc-component/father-plugin'],
});
2 changes: 1 addition & 1 deletion .github/workflows/react-component-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: actions/setup-node@v1
with:
node-version: '12'
node-version: '16'

- name: cache package-lock.json
uses: actions/cache@v2
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ tmp/
.umi-production
.umi-test
.env.local

# dumi
.dumi/tmp
.dumi/tmp-production
32 changes: 0 additions & 32 deletions .umirc.ts

This file was deleted.

9 changes: 7 additions & 2 deletions docs/demo/asyncAction.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## asyncAction
---
title: asyncAction
nav:
title: Demo
path: /demo
---

<code src="../examples/asyncAction.tsx">
<code src="../examples/asyncAction.tsx"/></code>
9 changes: 7 additions & 2 deletions docs/demo/beforeUpload.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## beforeUpload
---
title: beforeUpload
nav:
title: Demo
path: /demo
---

<code src="../examples/beforeUpload.tsx">
<code src="../examples/beforeUpload.tsx"/></code>
9 changes: 7 additions & 2 deletions docs/demo/customRequest.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## customRequest
---
title: customRequest
nav:
title: Demo
path: /demo
---

<code src="../examples/customRequest.tsx">
<code src="../examples/customRequest.tsx"/></code>
9 changes: 7 additions & 2 deletions docs/demo/directoryUpload.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## directoryUpload
---
title: directoryUpload
nav:
title: Demo
path: /demo
---

<code src="../examples/directoryUpload.tsx">
<code src="../examples/directoryUpload.tsx"/></code>
9 changes: 7 additions & 2 deletions docs/demo/drag.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## drag
---
title: drag
nav:
title: Demo
path: /demo
---

<code src="../examples/drag.tsx">
<code src="../examples/drag.tsx"/></code>
9 changes: 7 additions & 2 deletions docs/demo/simple.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## simple
---
title: simple
nav:
title: Demo
path: /demo
---

<code src="../examples/simple.tsx">
<code src="../examples/simple.tsx"/></code>
4 changes: 2 additions & 2 deletions docs/examples/simple.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint no-console:0 */

import Upload, { type UploadProps } from 'rc-upload';
import React from 'react';
import Upload from 'rc-upload';

const style = `
.rc-upload-disabled {
opacity:0.5;
`;

const uploaderProps = {
const uploaderProps: UploadProps = {
action: '/upload.do',
data: { a: 1, b: 2 },
multiple: true,
Expand Down
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: rc-trigger
---

<embed src="../README.md"></embed>
4 changes: 0 additions & 4 deletions jest.config.js

This file was deleted.

5 changes: 1 addition & 4 deletions now.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
{
"src": "package.json",
"use": "@now/static-build",
"config": { "distDir": ".doc" }
"config": { "distDir": "dist" }
}
],
"routes": [
{ "src": "/(.*)", "dest": "/dist/$1" }
]
}
68 changes: 28 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,78 +9,66 @@
"upload"
],
"homepage": "http://github.com/react-component/upload",
"bugs": {
"url": "http://github.com/react-component/upload/issues"
},
"repository": {
"type": "git",
"url": "[email protected]:react-component/upload.git"
},
"bugs": {
"url": "http://github.com/react-component/upload/issues"
},
"license": "MIT",
"main": "./lib/index",
"module": "./es/index",
"files": [
"lib",
"es"
],
"main": "./lib/index",
"module": "./es/index",
"scripts": {
"start": "dumi dev",
"compile": "father build",
"coverage": "rc-test --coverage",
"docs:build": "dumi build",
"docs:deploy": "npm run docs:build && gh-pages -d .doc",
"compile": "father build",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"postpublish": "npm run docs:deploy",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"now-build": "npm run docs:build",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
"test": "father test",
"coverage": "father test --coverage",
"now-build": "npm run docs:build"
"postpublish": "npm run docs:deploy",
"start": "dumi dev",
"test": "rc-test"
},
"dependencies": {
"@babel/runtime": "^7.18.3",
"classnames": "^2.2.5",
"rc-util": "^5.2.0"
},
"devDependencies": {
"@types/enzyme": "^3.10.8",
"@types/jest": "^26.0.20",
"@types/react": "^17.0.15",
"@types/react-dom": "^17.0.9",
"@rc-component/father-plugin": "^1.0.0",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@types/jest": "^29.5.11",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@umijs/fabric": "^2.0.0",
"axios": "^0.26.1",
"co-busboy": "^1.3.0",
"coveralls": "^3.0.3",
"cross-env": "^7.0.0",
"dumi": "^1.0.37",
"enzyme": "^3.1.1",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.1.2",
"dumi": "^2.1.0",
"eslint": "^7.1.0",
"father": "^2.22.0",
"father": "^4.0.0",
"fs-extra": "^9.0.0",
"gh-pages": "^3.1.0",
"np": "^7.0.0",
"raf": "^3.4.0",
"rc-test": "^7.0.13",
"rc-tools": "8.x",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"regenerator-runtime": "^0.13.7",
"sinon": "^9.0.2",
"typescript": "^4.0.2",
"vinyl-fs": "^3.0.3"
},
"dependencies": {
"@babel/runtime": "^7.18.3",
"classnames": "^2.2.5",
"rc-util": "^5.2.0"
},
"jest": {
"collectCoverageFrom": [
"src/*"
],
"coveragePathIgnorePatterns": [
"src/IframeUploader.jsx"
],
"transform": {
"\\.tsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js",
"\\.jsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js"
}
},
"peerDependencies": {
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
Expand Down
68 changes: 0 additions & 68 deletions server.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { UploadProps } from './interface';
import Upload from './Upload';
import { UploadProps } from './interface';

export { UploadProps };
export type { UploadProps };

export default Upload;
4 changes: 2 additions & 2 deletions src/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface UploadProps
style?: React.CSSProperties;
className?: string;
disabled?: boolean;
component?: React.JSXElementConstructor<any>;
component?: React.ComponentType<any> | string;
action?: Action;
method?: UploadRequestMethod;
directory?: boolean;
Expand All @@ -28,7 +28,7 @@ export interface UploadProps
beforeUpload?: (
file: RcFile,
FileList: RcFile[],
) => BeforeUploadFileType | Promise<void | BeforeUploadFileType>;
) => BeforeUploadFileType | Promise<void | BeforeUploadFileType> | void;
customRequest?: (option: UploadRequestOption) => void;
withCredentials?: boolean;
openFileDialogOnClick?: boolean;
Expand Down
Loading

1 comment on commit 5bfa1a5

@vercel
Copy link

@vercel vercel bot commented on 5bfa1a5 Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.