File tree Expand file tree Collapse file tree 12 files changed +31
-28
lines changed Expand file tree Collapse file tree 12 files changed +31
-28
lines changed Original file line number Diff line number Diff line change 11template /
22* .js
3- ** /demo
3+ ** /demo /
4+ ** /__tests__ /
Original file line number Diff line number Diff line change 1616/dist
1717/lib
1818/esm
19- /.docz
2019/doc-site
2120/types
2221
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { defineConfig } from 'dumi';
44let base = '/react-ui-library-tutorial' ;
55let publicPath = '/react-ui-library-tutorial/' ;
66
7- if ( process . env . DOC_BUILD_ENV === 'local ' ) {
7+ if ( process . env . SITE_BUILD_ENV === 'PREVIEW ' ) {
88 base = undefined ;
99 publicPath = undefined ;
1010}
Original file line number Diff line number Diff line change 1414
1515于是在部门内搭了一个简单的组件库,组件不多,但在搭建过程中掌握了很多知识,再看 antd 等热门组件库,对其中的一些设计也有了更深的感悟,故记录下来,希望能帮助到其他的同学。
1616
17- [ 🚀 在线预览] ( https://happy-ui.now.sh )
17+ [ 🚀 在线预览] ( https://worldzhao.github.io/react-ui-library-tutorial )
1818
1919🚆 本地预览
2020
@@ -27,15 +27,15 @@ yarn start
2727
2828按顺序执行完命令后,即可在 localhost:3000 端口看到以下内容:
2929
30- ![ preview] ( https://raw.githubusercontent.com/worldzhao/blog/master/images/rc-lib-1.jpg )
30+ ![ preview] ( https://raw.githubusercontent.com/worldzhao/blog/master/images/rc-lib-v1- 1.jpg )
3131
3232## 概览
3333
3434本系列文章主要包含以下内容:
3535
3636- 项目初始化: 组件库前期开发准备工作。` eslint ` /` commit lint ` /` typescript ` 等等;
37- - 开发阶段: 使用[ docz ] ( https://github.com/doczjs/docz ) 进行开发调试以及文档编写;
37+ - 开发阶段: 使用[ dumi ] ( https://d.umijs.org/zh-CN ) 进行开发调试以及文档编写;
3838- 打包阶段: 输出~~ ` umd ` ~~ /` cjs ` /` esm ` 产物并支持按需加载;
3939- 组件测试: 使用` @testing-library/react ` 及其相关生态进行组件测试;
40- - 发布 npm: 编写脚本完成自动化发布 ;
41- - 部署文档站点: 使用[ now ] ( https://zeit.co/home ) 部署文档站点 。
40+ - 发布 npm: 编写脚本完成发布或直接使用 [ np ] ( https://www.npmjs.com/package/np ) 发布 ;
41+ - 部署文档站点: 使用 Github Pages 以及 Github Actions 完成文档站点自动部署 。
Original file line number Diff line number Diff line change 1111** 使用 npm 或 yarn 安装**
1212
1313``` shell
14- $ npm install @zzzzw/happy-ui --save
14+ npm install @zzzzw/happy-ui
1515```
1616
1717``` shell
Original file line number Diff line number Diff line change 2222 "dev" : " dumi dev" ,
2323 "start" : " npm run dev" ,
2424 "build:site" : " rimraf doc-site && dumi build" ,
25- "preview:site" : " cross-env DOC_BUILD_ENV=local npm run build:site && serve doc-site" ,
25+ "preview:site" : " cross-env SITE_BUILD_ENV=PREVIEW npm run build:site && serve doc-site" ,
2626 "deploy:site" : " npm run build:site && gh-pages -d doc-site" ,
2727 "clean" : " rimraf lib esm dist" ,
2828 "build:types" : " tsc -p tsconfig.build.json && cpr lib esm" ,
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { render } from '@testing-library/react' ;
3- import Alert from '../alert ' ;
3+ import Alert from '..' ;
44
55describe ( '<Alert />' , ( ) => {
66 test ( 'should render default' , ( ) => {
Original file line number Diff line number Diff line change 11import React from 'react' ;
2- import Alert from '../alert ' ;
2+ import Alert from '../' ;
33import '../style' ;
44
55export default ( ) => < Alert kind = "warning" > 这是一条警告提示</ Alert > ;
Original file line number Diff line number Diff line change 88 order : 1
99---
1010
11+ # Alert 警告提示
12+
13+ 警告提示,展现需要关注的信息。
14+
15+ ## 代码演示
16+
17+ ### 基本用法
18+
1119<code src =" ./demo/basic.tsx " ></code >
20+
21+ <API src =" ./index.tsx " ></API >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments