From afc7c9eea5fa0d2aeab62177f05a751d40550dde Mon Sep 17 00:00:00 2001 From: xrkffgg Date: Fri, 19 Mar 2021 17:51:06 +0800 Subject: [PATCH] chore: use dumi (#10) * chore: use dumi * fix test --- .gitignore | 5 +++++ .umirc.ts | 21 +++++++++++++++++++ HISTORY.md => CHANGELOG.md | 0 README.md | 8 +------ docs/demo/autoSize.md | 3 +++ docs/demo/simple.md | 3 +++ .../autoSize.js => docs/examples/autoSize.jsx | 2 +- .../simple.js => docs/examples/simple.jsx | 2 +- docs/index.md | 5 +++++ index.js | 1 - package.json | 9 +++++--- tests/index.spec.js | 2 +- tsconfig.json | 9 ++++++-- 13 files changed, 54 insertions(+), 16 deletions(-) create mode 100644 .umirc.ts rename HISTORY.md => CHANGELOG.md (100%) create mode 100644 docs/demo/autoSize.md create mode 100644 docs/demo/simple.md rename examples/autoSize.js => docs/examples/autoSize.jsx (95%) rename examples/simple.js => docs/examples/simple.jsx (95%) create mode 100644 docs/index.md delete mode 100644 index.js diff --git a/.gitignore b/.gitignore index 971b25d..318cde2 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,8 @@ yarn.lock package-lock.json coverage/ .doc +# umi +.umi +.umi-production +.umi-test +.env.local diff --git a/.umirc.ts b/.umirc.ts new file mode 100644 index 0000000..07a646c --- /dev/null +++ b/.umirc.ts @@ -0,0 +1,21 @@ +// more config: https://d.umijs.org/config +import { defineConfig } from 'dumi'; + +const name = 'textarea'; + +export default defineConfig({ + title: 'rc-textarea', + favicon: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', + outputPath: '.doc', + exportStatic: {}, + base: `/${name}/`, + publicPath: `/${name}/`, + styles: [ + ` + .markdown table { + width: auto !important; + } + `, + ], +}); diff --git a/HISTORY.md b/CHANGELOG.md similarity index 100% rename from HISTORY.md rename to CHANGELOG.md diff --git a/README.md b/README.md index d844907..21e1a13 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,6 @@ # rc-textarea -[![NPM version][npm-image]][npm-url] -[![npm download][download-image]][download-url] -[![build status][github-actions-image]][github-actions-url] -[![Codecov][codecov-image]][codecov-url] -[![Dependencies][david-image]](david-url) -[![DevDependencies][david-dev-image]][david-dev-url] -[![bundle size][bundlephobia-image]][bundlephobia-url] +[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![Dependencies][david-image]](david-url) [![DevDependencies][david-dev-image]][david-dev-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [npm-image]: http://img.shields.io/npm/v/rc-textarea.svg?style=flat-square [npm-url]: http://npmjs.org/package/rc-textarea diff --git a/docs/demo/autoSize.md b/docs/demo/autoSize.md new file mode 100644 index 0000000..a2dfa90 --- /dev/null +++ b/docs/demo/autoSize.md @@ -0,0 +1,3 @@ +## autoSize + + diff --git a/docs/demo/simple.md b/docs/demo/simple.md new file mode 100644 index 0000000..34a6d23 --- /dev/null +++ b/docs/demo/simple.md @@ -0,0 +1,3 @@ +## simple + + diff --git a/examples/autoSize.js b/docs/examples/autoSize.jsx similarity index 95% rename from examples/autoSize.js rename to docs/examples/autoSize.jsx index f3c906b..814de0e 100644 --- a/examples/autoSize.js +++ b/docs/examples/autoSize.jsx @@ -1,6 +1,6 @@ /* eslint-disable no-console */ import React, { useState } from 'react'; -import Textarea from '../src/index'; +import Textarea from 'rc-textarea'; export default function App() { const [value, setValue] = useState('hello\nworld'); diff --git a/examples/simple.js b/docs/examples/simple.jsx similarity index 95% rename from examples/simple.js rename to docs/examples/simple.jsx index 50c5eae..29d5cd7 100644 --- a/examples/simple.js +++ b/docs/examples/simple.jsx @@ -1,6 +1,6 @@ /* eslint-disable no-console */ import React, { useState } from 'react'; -import Textarea from '../src/index'; +import Textarea from 'rc-textarea'; export default function App() { const [value, setValue] = useState(''); diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..56fc654 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,5 @@ +--- +title: rc-textarea +--- + + diff --git a/index.js b/index.js deleted file mode 100644 index fd4d7e5..0000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./src/'); diff --git a/package.json b/package.json index bfacde8..db27bdc 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,11 @@ }, "license": "MIT", "scripts": { - "start": "cross-env NODE_ENV=development father doc dev --storybook", - "build": "father doc build --storybook", + "start": "dumi dev", + "docs:build": "dumi build", + "docs:deploy": "gh-pages -d .doc", "compile": "father build && lessc assets/index.less assets/index.css", - "gh-pages": "npm run build && father doc deploy", + "gh-pages": "npm run docs:build && npm run docs:deploy", "prepublishOnly": "npm run compile && np --yolo --no-publish && npm run gh-pages", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", @@ -53,11 +54,13 @@ "@umijs/fabric": "^2.0.8", "coveralls": "^3.0.6", "cross-env": "^7.0.2", + "dumi": "^1.1.0", "enzyme": "^3.0.0", "enzyme-adapter-react-16": "^1.0.1", "enzyme-to-json": "^3.4.0", "eslint": "^7.0.0", "father": "^2.13.4", + "gh-pages": "^3.1.0", "husky": "^4.2.5", "less": "^3.10.3", "np": "^5.1.0", diff --git a/tests/index.spec.js b/tests/index.spec.js index caba8dc..5e1daa4 100644 --- a/tests/index.spec.js +++ b/tests/index.spec.js @@ -1,6 +1,6 @@ import React from 'react'; import { mount } from 'enzyme'; -import TextArea from '../index'; +import TextArea from '../src'; import { focusTest, sleep } from './utils'; import calculateNodeHeight, { calculateNodeStyling, diff --git a/tsconfig.json b/tsconfig.json index bba2297..4da5e9f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,11 @@ "jsx": "preserve", "declaration": true, "skipLibCheck": true, - "esModuleInterop": true + "esModuleInterop": true, + "paths": { + "@/*": ["src/*"], + "@@/*": ["src/.umi/*"], + "rc-textarea": ["src/index.tsx"] + } } -} \ No newline at end of file +}