npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

yc-xinyi

v3.0.0

Published

新移react组件库

Readme

react组件库

开发一个组件的过程

  • 添加一个组件到组件库(以下命令三选一)
npm run addComponent -- -name=component-name
node ./add -name=component-name
yarn addComponent -name=component-name
  • 在 lib/index.js 中添加下面代码以导出组件
export { default as ComponentName } from './component-name';
  • 在 lib/styles/index.scss 中添加下面代码
@import '../component-name/style/index.scss';
  • 一个组件示例

必须要有属性类型检测来确保组件的规范性和避免隐形问题出现等

import React, { Component } from 'react';
import PropTypes from 'prop-types';

// 基础组件库使用 antd
import { Button } from 'antd';

class ComponentName extends Component {
  render() {
    return (
      <div>ComponentName</div>
    )
  }
}

// 默认属性值
ComponentName.defaultProps = {
  propName: 6
}

// 属性类型检测
ComponentName.propTypes = {
  propName: PropTypes.number
}

export default ComponentName;

bash命令(npm 或 yarn)

  • 添加组件
npm run addComponent
  • 文档开发
npm run doc:dev
  • 类项目开发(可不用,直接通过文档测试组件)
npm run dev

其它

  • 文档开发可自动读取 lib 组件下的 Readme.md 文件,并自动编译其中包含的代码到文档页面中,以达到测试目的

  • 删除一个组件的时候手动把 lib/index.js 和 lib/styles/index.scss 中对应的该组件代码删除