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 🙏

© 2024 – Pkg Stats / Ryan Hefner

zeal-cube

v1.2.21

Published

Fork Ant [email protected] and integrate custom components

Downloads

69

Readme

Fork [email protected] 并集成了自定义样式以及[email protected]的部分组件. API文档

安装

npm install zeal-cube --save   

示例

import { DatePicker } from 'zeal-cube';
ReactDOM.render(<DatePicker />, mountNode);

引入样式:

import 'zeal-cube/dist/zeal-cube.css';  // or 'zeal-cube/dist/zeal-cube.less'

你也可以 按需加载组件。(针对联通客户中心脚手架说明如下)

需要三步

第一,安装'babel-plugin-import'

第二,在config.js 增加配置如下

  extraBabelPlugins: [
    [
      require.resolve('babel-plugin-import'),
      {
        libraryName: 'zeal-cube',
        style:true
      },
    ],
  ],

第三,移除import 'zeal-cube/dist/zeal-cube.css'

以Button为例,如果整个应用只用到Button,配置前后能节省__1.1M__

发布NPM

npm run pub 

发布前需要更新package.json中的版本号,否则会报错

生成API文档

npm run predeploy 

命令执行结束,会生成_site目录,然后发布到线上服务器。如果只是本地预览可以执行 npm run start

关于组件封装

  • 支持*.jsx,.tsx和.less
  • 源码统一放在components文件夹,目录约定如下:
  |--- ellipsis                                 # 组件名。小写,以“-”连接。如: button、back-top                  
  |    |--- index.zh-CN.md                      # 必须要有,用于生成API文档 
  |    |--- demo                                # 必须要有,否则api文档无法生成对应的demo                  
  |    |    |--- line.md                        # demo1 
  |    |    |--- number.md                      # demo2
  |    |--- index.jsx                           # 组件源码  
  |    |--- style                                # 组件样式必须放在style目录下,否则无法实现按需加载     
  |    |    |--- index.less                      # 样式  
  |    |    |--- index.tsx                      # 必须是tsx格式,且必须引入style组件和当前组件的index.less 否则无法实现按需加载
  |    |--- index.test.js                       # 测试   
  • 组件样式,应使用唯一的命名空间,格式如:cube-组件名
// 禁止使用css module
.cube-ellipsis{

}
  • commit源码之前,内部会自动调用lint进行校验,保证代码的规范

更多规范参考 Airbnb React/JSX Style Guide 英文 | 中文

国际化

参考 国际化文档

支持环境

  • 现代浏览器和 IE9 及以上。

| IE / Edge | Firefox | Chrome | Safari | Opera | Electron | | --------- | --------- | --------- | --------- | --------- | --------- | | IE9, IE10, IE11, Edge| last 2 versions| last 2 versions| last 2 versions| last 2 versions| last 2 versions

FAQs

commit之前,构建工具会自动通过lint-staged命令对*.less、.jsx、.tsx和*md进行校验,保证代码的规范。如下是常见报错以及对于的修改方案

  • Value must be omitted for boolean attributes

表示 默认 属性是true 不需要设置 xxx={true}

  • Trailing spaces not allowed

后面的空格是不允许的

  • .stylelintrc 配置"selector-pseudo-class-no-unknown": null,

允许less中使用:global

  • at-rule-empty-line-before @import、@media 符号必须上面要空一行,且左边顶格
.cube-result {
  text-align: center;
  width: 72%;
  margin: 0 auto;

@media screen and (max-width: @screen-xs) {
    width: 100%;
}
}
  • error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style

.eslintrc.js 添加"linebreak-style": 0