Git Product home page Git Product logo

bin-design's Introduction

.tsx .ts 推荐使用eslint 校验

后续版本 tslint可能会被废弃 推荐使用eslint校验

参考antd一些基础组件的写法 结合ts react hooks 编写ui组件

  • react hooks 新特性学习 demo 为组件
  • 组件单元测试学习编写(jest + enzyme + storybook test addon)
  • typescript 语法学习

�运行项目查看所有ui组件(开发环境)

  • yarn storybook
  • �😜bin-design

build storybook 部署到server进行线上查看

  • yarn build-storybook

1.how to build and publish npm

  • 我使用webpack 打包ts react组件(注意事项, out.libraryTarget设置为 commonjs2, externals: react)
  • 可直接跑tsc命令 或者 用babel构建(暂无设计, �后续优化)
  • 运行yarn build yarn publish (�test 命令仅供单元测试学习, 不在build前跑测试)

2.build 过程踩坑记录

  • ��没有正确设置libraryTarget 导致模块不具备export 导出的模块, 报错: webpack does not provide an export name
  • �主项目引用 bin-design 时报错: Hooks can only be called inside the body of a function component.

3.fix

  • 针对webpack does not provide an export name, 设置libratyTarget, 参考文章: create react component and publish npm
  • 针对Hooks can only be called inside the body of a function component 报错, �官网解释, 解决办法:issue
  • 总结:
    1.如果主项目使用�自定义的webpack构建 增加
    alias: { react: path.resolve('./node_modules/react') }
    2. 使用create-react-app, 暂未找到通过的解决办法请参考issue

4. use component

  • 主项目中yarn add bin-design, use like import { Tabs, TabPane } from 'bin-design'
  • 因为使用styled-components, 不用额外引入样式文件👏

bin-design's People

Stargazers

Libin Song avatar luorAx avatar Zhaokang Xu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.