New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cuke-ui

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cuke-ui

A React.js UI components for Web

0.0.12
Source
npm
Version published
Maintainers
1
Created
Source

cuke-ui

黄瓜 ui : 一个即插即用的 React UI 库 (** 施工中,请勿用于生产环境... **)

npm npm npm version travis Coverage Status

名字由来

cuke(黄瓜), 常见的一种蔬菜, 希望这个项目也成为常见的一个依赖(虽然这是不可能的), 其中黄瓜也符合 这个组件库的 宗旨 : 即插即用 其次 cuke 谐音 (cool ke) 很酷的李金珂的 意思 主题色 采用 黄瓜绿, 清新又可爱, 组件借鉴(抄袭)了 有牌面的 Ant Design, 抱着学习的目的,开发了这个组件库, 所以建议不要用于生产环境,可能心情不好就不维护了

在线演示

https://cuke-ui.github.io/cuke-ui/

安装

使用 npm

npm i cuke-ui --save

使用 yarn

yarn add cuke-ui

使用 cdn

<link rel="stylesheet" href="https://unpkg.com/cuke-ui@latest/dist/cuke-ui.min.css">
<script type="text/javascript" src="https://unpkg.com/cuke-ui@latest/dist/cuke-ui.min.js"></script>

如何使用

1.全部引入

import React from "react"
import { Button, message } from "cuke-ui"
import "cuke-ui/dist/cuke-ui.min.css"

class Text extends React.Component {
  render(){
    return (
      <Button onClick={()=> message.success('即插即用的react UI库')}>黄瓜ui</Button>
    )
 }
}

2.按需引入

import Button from 'cuke-ui/lib/Button';
import 'cuke-ui/lib/Button/style.less';

3.使用 babel-plugin-import

//.babelrc
"plugins": [
  ["import",{
    "libraryName":"cuke-ui",
    "style" : name => `${name}/style.less`
  }]

更新日志

CHANGELOG

计划开发的组件

计划2018年底完成,给自己一个交代

设计规范

高仿 Ant-Design

谁在使用

  • 勇敢的人
  • 我自己
  • 李金珂的小屋

参考轮子

发布打包

基于webpack打包umd模块 , babel 打包es模块 , Gulp 打包css

yarn run build

输出

  • dist
    • cuke-ui.js
    • cuke-ui.min.js
    • cuke-ui.css
    • cuke-ui.min.css
  • lib
    • button
      • index.js
    • style.less
    • 其他组件
      • index.js

本地开发

请首先安装 npm i -g yarn

  • 安装依赖

如果无法科学上网 可 使用 淘宝镜像 yarn config set registry https://registry.npm.taobao.org

git clone https://github.com/cuke-ui/cuke-ui.git
cd cuke-ui
yarn
  • 启动开发服务器

基于 storybook 什么是storybook?

yarn dev

参考 components/button

components 新建一个组件(组件名与文件名对应) 以 button 组件目录结构为例

  • components
    • button //组件文件夹
      • __tests__ //单元测试
        • __snapshots__ // ui 快照
        • index.test.js //测试文件
      • index.js //组件逻辑
      • styles.less //组件样式

然后 在 stories 目录下 新建一个 button.js

  • stories
    • button.js // storybook 的文档文件
//button.js
import React from 'react';
import { storiesOf } from '@storybook/react';
import Button from '../components/button';          //引入你的组件
import { withInfo } from '@storybook/addon-info';

storiesOf('示例标题', module)
 .add('Button 按钮', withInfo()(() => (         // 添加到页面上
   <Button type="primary">获取文字</Button>   // 这里写jsx
 )))

最后 将 写好的 storybook 文件 添加到 配置里面

.storybook > config.js



import { configure } from '@storybook/react';
function loadStories() {
  require('../stories/button');     //刚才写好的文件
}

configure(loadStories, module);

这样就完成了 storybook 会将你写好的组件 添加到页面上, 并且会自动生成说明文档 (其实本质上就是一个 webpack 的 dev-server)

最后的最后, 在 components/index.js 导出组件,以便于发布

export { default as Button } from "./button";

测试相关

覆盖率

yarn coverage

单元测试

yarn test

watch

yarn test -- --watch

代码风格

yarn lint

文档相关

打包文档

yarn build:doc

发布文档

yarn pub:doc

License

MIT

Keywords

cuke

FAQs

Package last updated on 01 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts