Skip to content

Commit 350bb9b

Browse files
Sharma, AmitSharma, Amit
Sharma, Amit
authored and
Sharma, Amit
committed
first commit in the new repository
1 parent 78d55ca commit 350bb9b

File tree

501 files changed

+55662
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

501 files changed

+55662
-0
lines changed

.babelrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"env": {
3+
"development": {
4+
"presets" : ["es2015", "stage-1", "react"],
5+
"plugins" : ["react-hot-loader/babel", ["transform-runtime", { "polyfill": false }]]
6+
},
7+
"test": {
8+
"presets" : ["es2015", "stage-1", "react"]
9+
},
10+
"production": {
11+
"presets" : [["es2015", { "modules": false, "loose": true }], "stage-1", "react"],
12+
"plugins" : [["transform-runtime", { "polyfill": false }]]
13+
}
14+
}
15+
}

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
7+
[README.md]
8+
indent_style = space
9+
indent_size = 4
10+
11+
[Makefile]
12+
indent_style = tab

.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
tests

.eslintrc.json

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": [ "airbnb", "eslint:recommended", "plugin:flowtype/recommended" ],
4+
"plugins": [ "react", "jsx-a11y", "flowtype" ],
5+
"env": {
6+
"browser": true,
7+
"commonjs": true,
8+
"es6": true,
9+
"jest": true
10+
},
11+
"settings": {
12+
"flowtype": {
13+
"onlyFilesWithFlowAnnotation": true
14+
}
15+
},
16+
"rules": {
17+
"jsx-a11y/no-static-element-interactions": 0,
18+
"react/self-closing-comp": 0,
19+
"react/jsx-no-bind": 0,
20+
"react/jsx-curly-spacing": 0,
21+
"react/no-string-refs": 0,
22+
"react/jsx-closing-bracket-location": 0,
23+
"react/jsx-boolean-value": 0,
24+
"react/no-did-mount-set-state": 1,
25+
"react/jsx-first-prop-new-line": 0,
26+
"react/jsx-max-props-per-line": 0,
27+
"react/require-default-props": 0,
28+
"jsx-a11y/img-has-alt": 0,
29+
"jsx-a11y/label-has-for": 0,
30+
"jsx-a11y/no-noninteractive-element-interactions": 0,
31+
"import/no-named-as-default-member": 0,
32+
"import/prefer-default-export": 0,
33+
"import/no-extraneous-dependencies": [1, {"devDependencies": ["**/__test__/**/*.js", "**/__test__/**/*.jsx", "**/*_test.jsx", "**/*_test.js"]}],
34+
"no-empty": 1,
35+
"no-console": 1,
36+
"react/sort-comp": 0,
37+
"react/prefer-stateless-function": 0,
38+
"react/prop-types": [1, { "ignore": ["children", "key"] }],
39+
"react/no-find-dom-node": 0,
40+
"react/no-unused-prop-types": 1,
41+
"react/forbid-prop-types": [1, { "forbid": ["array"] }],
42+
"react/no-array-index-key": 0
43+
}
44+
}

.flowconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[ignore]
2+
.*/node_modules/.*
3+
4+
[include]
5+
6+
[libs]
7+
flow
8+
9+
[options]
10+
esproposal.class_static_fields=enable
11+
unsafe.enable_getters_and_setters=true

.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.DS_Store
2+
Thumbs.db
3+
.idea
4+
5+
npm-debug.log
6+
node_modules
7+
8+
/dist
9+
/next.js
10+
11+
.vscode
12+
Makefile
13+
yarn.lock
14+
package-lock.json

.npmignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build
2+
tests
3+
site
4+
.*

.travis.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
language: node_js
2+
node_js:
3+
- "6"
4+
5+
env:
6+
- TRAVIS_CI=1
7+
8+
cache:
9+
yarn: true
10+
directories:
11+
- node_modules
12+
13+
install:
14+
npm i
15+
16+
script:
17+
- npm run lint
18+
- npm run build
19+
- npm test
20+
- npm run typescript-test
21+
22+
notifications:
23+
slack: eleme:3Nouwh5OgNugxccCsiFYpUIB

CONTRIBUTING.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Element React Contributing Guide
2+
3+
We are very graceful that you are interested in contributing to `element-react`. Before submitting your contribution though, please make sure to take a moment and read through the following guidelines.
4+
5+
## Issue Guidelines
6+
7+
- Before submitting an issue, please check if similar problems have already been issued.
8+
9+
- The title of the issue should be written as `[Component Name]: Issue caption.` (e.g. `Button: Fix xxx bug`)
10+
11+
- Please specify which version of `element-react` and `element-theme-default` you are using, and other related information.
12+
13+
## Pull Request Guidelines
14+
15+
- Fork this repository to your own account. Do not create branches here.
16+
17+
- Make sure pull request will be merged into `master`.
18+
19+
- Commit info should be formatted as `[Component Name]: Info about commit.` (e.g. `Button: Fix xxx bug`)
20+
21+
- Make sure that your changes pass `npm test`, `npm run lint` and `npm run build`.
22+
23+
- **Rebase** your commits to make your pull request meaningful.

README.md

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Element React
2+
3+
[![](https://travis-ci.org/eleme/element-react.svg?branch=master)](https://travis-ci.org/eleme/element-react)
4+
[![](https://img.shields.io/npm/v/element-react.svg)](https://www.npmjs.com/package/element-react)
5+
[![](https://img.shields.io/npm/dm/element-react.svg)](https://www.npmjs.com/package/element-react)
6+
7+
[Element](https://github.com/ElemeFE/element) was initially written in [Vue](https://vuejs.org/), which has many elegant UI components, but we also love [React](https://facebook.github.io/react/), so we forked it for the React community.
8+
9+
## Getting Started
10+
11+
### Install
12+
13+
```bash
14+
npm install element-react --save
15+
```
16+
17+
Before the building, you need a style theme, here we recommend you to pick up `element-theme-default`.
18+
19+
```bash
20+
npm install element-theme-default --save
21+
```
22+
23+
### Usage
24+
25+
We are die hard fans of ECMAScript 6, so we recommend you writing code in modern javascript.
26+
27+
```js
28+
import { Button } from 'element-react';
29+
```
30+
31+
Also we provide an advanced way to [tree shaking](https://blog.engineyard.com/2016/tree-shaking) the code with [Rollup.js](http://rollupjs.org/) and [Webpack 2](https://webpack.github.io/)
32+
33+
```js
34+
import { Button } from 'element-react/next';
35+
```
36+
37+
### Config
38+
39+
With webpack, you need additional loaders to build with `element-react`.
40+
41+
```js
42+
const webpack = require('webpack');
43+
44+
module.exports = {
45+
entry: {
46+
src: 'path/to/src'
47+
},
48+
output: {
49+
path: 'path/to/output'
50+
publicPath: '/public',
51+
chunkFilename: '[chunkhash:12].js',
52+
filename: '[chunkhash:12].js'
53+
},
54+
plugins: [
55+
new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
56+
new webpack.optimize.UglifyJsPlugin({
57+
output: {
58+
comments: false
59+
}
60+
})
61+
],
62+
resolve: {
63+
extensions: ['.js', '.jsx']
64+
},
65+
module: {
66+
loaders: [
67+
{
68+
test: /\.jsx?$/,
69+
loader: 'babel-loader',
70+
include: ['path/to/src']
71+
},
72+
{
73+
test: /\.css$/,
74+
loaders: ['style-loader', 'css-loader']
75+
},
76+
{
77+
test: /\.(ttf|eot|svg|woff|woff2)(\?.+)?$/,
78+
loader: 'file-loader?name=[hash:12].[ext]'
79+
}
80+
]
81+
}
82+
}
83+
```
84+
85+
## Contributing
86+
87+
Please make sure to read the [Contributing Guide](https://github.com/eleme/element-react/blob/master/CONTRIBUTING.md) before making a pull request.
88+
89+
## Acknowledgments
90+
91+
* [@doxiaodong](https://github.com/doxiaodong) for adding typescript ambient declarations.
92+
* [@cuining](https://github.com/cuining) for building the live code editor.
93+
94+
## Credits
95+
96+
* [Element](https://github.com/ElemeFE/element) Desktop UI elements for Vue.js 2.0.
97+
98+
## License
99+
100+
MIT

build/npm/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './src';

build/npm/next.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './dist/npm/es6/src';

build/scripts/prepare.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# testing before publish
4+
npm run lint && npm run build && npm run test && npm run typescript-test
5+
6+
if [ $? = 0 ]; then
7+
# purge dist
8+
rm -fr dist
9+
10+
# babel transform es6 into es5
11+
babel src --out-dir dist/npm/es5/src --copy-files
12+
babel libs --out-dir dist/npm/es5/libs --copy-files
13+
babel build/npm/index.js --out-file dist/npm/es5/index.js
14+
15+
export BABEL_ENV=production
16+
17+
babel src --out-dir dist/npm/es6/src --copy-files
18+
babel libs --out-dir dist/npm/es6/libs --copy-files
19+
20+
# keep es6 for next.js
21+
cp build/npm/next.js next.js
22+
else
23+
echo 'Code cant be verify, plz check ~'
24+
fi

build/scripts/release.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# set ORIGIN to current git origin
4+
ORIGIN=$(git remote -v | awk '$1=="origin" && $3=="(push)" {print $2}');
5+
VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g');
6+
7+
# target folder: /dist/site, make it clean and step into
8+
rm -fr dist
9+
mkdir dist dist/site
10+
cd dist/site
11+
12+
# init an empty git repo, checkout branch gh-pages
13+
git init
14+
git remote add origin $ORIGIN
15+
git fetch
16+
git checkout -t origin/gh-pages
17+
18+
# remove all existed files in the repo, run the site build script
19+
rm *
20+
npm run build
21+
22+
# commit and push to gh-pages
23+
git add . -A
24+
git commit -m "$VERSION"
25+
git push

build/site/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<title>Element-React</title>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
</head>
9+
<body>
10+
<div id="app" />
11+
</body>
12+
</html>

0 commit comments

Comments
 (0)