
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
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>
- 全部引入
import React from "react"
import { Button } from "cuke-ui"
import "cuke-ui/dist/cuke-ui.min.css"
class Page extends React.Component {
render(){
return (
<Button type="primary">黄瓜ui</Button>
)
}
}
2 .按需引入
import Button from 'cuke-ui/lib/button';
import 'cuke-ui/lib/button/style';
// .babelrc.js
module.exports = {
plugins: [
["babel-plugin-import", {
"libraryName": "cuke-ui",
"libraryDirectory": "es",
"style": true
},'cuke-ui'],
]
}
// 多个组件库
module.exports = {
plugins: [
["babel-plugin-import", {
"libraryName": "cuke-ui",
"libraryDirectory": "es",
"style": true
},'cuke-ui'],
["babel-plugin-import", {
"libraryName": "antd",
"libraryDirectory": "es",
"style": true
},'antd'],
]
}
高仿 Ant-Design
请首先安装 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
组件目录结构为例
__tests__
//单元测试
__snapshots__
// ui 快照index.test.js
//测试文件index.js
//组件逻辑
- style.js
// 按需加载需要用到styles.less
//组件样式然后 在 stories
目录下 新建一个 button.js
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";
FAQs
A React.js UI components for Web
The npm package cuke-ui receives a total of 3 weekly downloads. As such, cuke-ui popularity was classified as not popular.
We found that cuke-ui demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.