Skip to content

Commit

Permalink
javscript set up for coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
simonguo committed Aug 5, 2017
1 parent 1ddfa71 commit 7fd6e4f
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 62 deletions.
9 changes: 8 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,12 @@
"stage-0",
"react",
"es2015"
]
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
}
2 changes: 2 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
service_name: travis-ci
repo_token: 1Aagfc4r6UqD9M88fFI8XnBhr6Lr3Dy1o
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ build/**
lib/**
tools/*
node_modules/**
webpack.config.js
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ module.exports = {
'parser': 'babel-eslint',
'plugins': [
'react',
'babel'
'babel',
'json'
],
'parserOptions': {
'ecmaVersion': 6,
Expand Down Expand Up @@ -66,7 +67,7 @@ module.exports = {
'jsx-a11y/label-has-for': OFF,
'react/jsx-filename-extension': OFF,
'react/prefer-stateless-function': OFF,
'react/require-default-props':OFF
'react/require-default-props': OFF

}
};
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ cache:
directories:
- node_modules

after_script:
- npm run coveralls

before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
Expand Down
121 changes: 66 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,103 +1,114 @@
# [RSUITE](https://rsuite.github.io) [![Travis][build-badge]][build] [![npm][npm-badge]][npm]
[![Discord][discord-badge]][discord]


RSUITE `[ɑː(r)swiːt]` 是一套 React 开发的 UI 组件库,提供 Bootstrap 设计体系的常用组件,并且会在此基础上持续开发一些高级组件。
# RSUITE

我们的目标就是让 WEB 开发更快捷,同时具有一定的灵活性和扩展性。
------

RSUITE `[ɑː(r)swiːt]` 是一套基于 React 开发的 UI 组件库,产生于 HYPERS 前端团队,是面向企业级后台产品的一套前端解决方案。

RSUITE 目标就是让 WEB 开发更快捷,同时具有一定的灵活性和扩展性,致力于改善前端工程师的开发体验。

## 特性

- 基于 React 组件化开发模式;
- 丰富、漂亮 UI 组件;
- 支持多主题切换;
- 支持响应式布局;
- 支持 ES2015。
------
版本及状态

[![npm](https://badge.fury.io/js/rsuite.svg)](https://www.npmjs.com/package/rsuite)
[![Travis](https://travis-ci.org/rsuite/rsuite.svg?branch=master)](https://travis-ci.org/rsuite/rsuite)
[![Coverage Status](https://coveralls.io/repos/github/rsuite/rsuite/badge.svg?branch=next)](https://coveralls.io/github/rsuite/rsuite?branch=next)

社区

## 版本
[![Discord](https://img.shields.io/badge/Discord-Join%20chat%20%E2%86%92-738bd7.svg)](https://discord.gg/GmPXTH3)

[![npm](https://badge.fury.io/js/rsuite.svg)](https://www.npmjs.com/package/rsuite)
[![Travis](https://travis-ci.org/rsuite/rsuite.svg?branch=master)](https://travis-ci.org/rsuite/rsuite)


兼容 React 版本 `^0.14.9 || >=15.3.0`

## 安装
## 快速开始

<br/>
安装:

```
npm install rsuite --save
npm i rsuite --save
```


示例:

```js
// ES2015
import { Button } from 'rsuite';

// CommonJS
var Button = require('rsuite').Button;
ReactDOM.render(<Button>Button</Button>, mountNode);
```

// AMD
define(['rsuite'], function(Suite) {
var Button = Suite.Button;
...
});

## 创建一个 RSUITE 应用

ReactDOM.render(<Button>Button</Button>, mountNode);
```
通过 `create-rsuite-app` 快速创建一个 RSUITE 应用。 另外,应用中还集成了以下内容:

- `Redux`: 数据流管理
- `React Router`: 路由管理
- `React Intl`: 国际化
- `ESLint`: 代码检查
- `Webpack`: 应用构建及开发环境搭建
- `Babel`: 代码编译

## 主题
详细参考 [dependencies](https://github.com/rsuite/create-rsuite-app/blob/master/generators/app/templates/package.json#L12-L33)

- 可以通过 [rsuite-theme](https://github.com/rsuite/rsuite-theme) 管理,只需要配置一个系统主色,自动生成系统配色方案。
安装:

安装
```
npm install rsuite-theme --save
npm i -g yo
npm i -g generator-create-rsuite-app
```
`import`
```js
import 'rsuite-theme/dist/less/rsuite.less';

创建项目:

```
# 创建并进入项目文件夹
mkdir your-project && cd your-project
- 也可以通过 CDN 引入 css 文件
// 使用脚手架安装项目
yo create-rsuite-app
```

```html
<link rel="stylesheet" href="https://unpkg.com/rsuite-theme/dist/css/rsuite.min.css" />
运行项目:

等待 `npm install` 安装完成后,执行下面命令,打开 `localhost:3002` 即可运行项目。

```
npm run dev
```

> 使用中如果存在问题,提交 [issues](https://github.com/rsuite/create-rsuite-app/issues/new)
## 其他组件
## 主题相关

- [rsuite-table](https://github.com/rsuite/rsuite-table)
- [rsuite-datepicker](https://github.com/rsuite/rsuite-datepicker)
- [rsuite-daterangepicker](https://github.com/rsuite/rsuite-daterangepicker)
- [rsuite-picker](https://github.com/rsuite/rsuite-picker)
- [rsuite-echarts](https://github.com/rsuite/rsuite-echarts)
- [rsuite-uploader](https://github.com/rsuite/rsuite-uploader)
- [rsuite-tree](https://github.com/rsuite/rsuite-tree)
- [rsuite-slider](https://github.com/rsuite/rsuite-slider)
- [rsuite-affix](https://github.com/rsuite/rsuite-affix)
- [rsuite-autocomplete](https://github.com/rsuite/rsuite-autocomplete)


## License
- 方式 1 :引用 less 文件

MIT
```less
// 如果需要使用一些拓展组件,应该引入组件样式
@import "~rsuite-table/lib/less/index";

// 引入 RSUITE 样式
@import "~rsuite-theme/dist/less/rsuite";

[build-badge]: https://travis-ci.org/rsuite/rsuite.svg?branch=master
[build]: https://travis-ci.org/rsuite/rsuite
// 修改主题颜色,不设置则使用 RSUITE 默认颜色
@base-color: #6292f0;

// 可以修改主题中的变量参数,来自定义自己的主题
// 参考 https://github.com/rsuite/rsuite-theme/blob/master/src/less/variables.less
```

- 方式 2 : CDN

```html
<link rel="stylesheet" href="https://unpkg.com/rsuite-theme/dist/css/rsuite.min.css" />
```

[npm-badge]: https://badge.fury.io/js/rsuite.svg
[npm]: http://badge.fury.io/js/rsuite
- 其他详细配置参考 [rsuite-theme](https://rsuitejs.com/components/theme)


[discord-badge]: https://img.shields.io/badge/Discord-Join%20chat%20%E2%86%92-738bd7.svg
[discord]: https://discord.gg/GmPXTH3
> 使用中如果存在问题,提交 [issues](https://github.com/rsuite/rsuite-theme/issues/new)
11 changes: 10 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

const webpackConfig = {
output: {
pathinfo: true
Expand All @@ -24,7 +26,7 @@ module.exports = (config) => {
'sinon-chai'
],
colors: true,
reporters: ['mocha'],
reporters: ['mocha', 'coverage'],

logLevel: config.LOG_INFO,
preprocessors: {
Expand All @@ -40,6 +42,13 @@ module.exports = (config) => {
base: 'Chrome',
flags: ['--no-sandbox'],
},
},
coverageReporter: {
dir: path.join(__dirname, 'coverage'),
reporters: [
{ type: 'html' },
{ type: 'lcov', subdir: 'lcov' } // lcov
]
}
});
};
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"build": "babel-node tools/build.js",
"tdd": "karma start",
"lint": "eslint src *.js*",
"test": "npm run lint && karma start --single-run"
"test": "npm run lint && NODE_ENV=test karma start --single-run",
"coveralls": "cat ./coverage/lcov/lcov.info | ./node_modules/.bin/coveralls"
},
"keywords": [
"react",
Expand Down Expand Up @@ -43,16 +44,19 @@
"babel-core": "^6.7.6",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.4",
"babel-plugin-istanbul": "^4.1.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.5.0",
"chai": "^3.5.0",
"child-process-promise": "^2.0.2",
"colors": "^1.1.2",
"coveralls": "^2.13.1",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-json": "^1.2.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.1.0",
"fs-promise": "^0.5.0",
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
library: 'RSuite',
libraryTarget: 'umd'
},
plugins: plugins,
plugins,
module: {
rules: [{
test: /\.jsx?$/,
Expand Down

0 comments on commit 7fd6e4f

Please sign in to comment.