Skip to content

Commit e631e7f

Browse files
committed
upgrade project structure. should import style file by youself.
1 parent b865d12 commit e631e7f

25 files changed

+392
-205
lines changed

.gitignore

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
node_modules
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (http://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# Typescript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# Yarn Integrity file
55+
.yarn-integrity
56+
57+
# dotenv environment variables file
58+
.env
59+
60+
demo
61+
62+
deploy.config.json
63+
64+
dist

.publish

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit caebcb105dab2d332c8709961c9437182c92e3ed

README-cn.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
[pullLoad](https://github.com/lidianhao123/pullLoad) 非 react 版本,支持 require.js 模块化调用
77

88
#### 示例
9-
[demo1](https://react-ld.github.io/react-pullLoad/index.html) document.body 作为容器
9+
[demo1](https://react-ld.github.io/react-pullLoad/index1.html) ReactPullLoad 根节点 DOM 作为容器
1010

1111
[demo2](https://react-ld.github.io/react-pullLoad/index2.html) ReactPullLoad 根节点 DOM 作为容器
1212

1313
[demo3](https://react-ld.github.io/react-pullLoad/index3.html) document.body 作为容器 且自定义刷新和加载更多 UI 组件
1414

15+
[demo3](https://react-ld.github.io/react-pullLoad/index4.html) 禁用下拉刷新功能
16+
1517
# 当前版本 1.0.4
1618

1719
# 简介
@@ -37,6 +39,7 @@ npm install --save react-pullload
3739

3840
```js
3941
import ReactPullLoad,{ STATS } from 'react-pullload'
42+
import 'node_modules/react-pullload/dist/ReactPullLoad.css'
4043

4144
export class App extends Component{
4245
constructor(){

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
[pullLoad](https://github.com/lidianhao123/pullLoad) is another refreshing and loading more lib without react, support require.js to load lib.
77

88
#### examples
9-
[demo1](https://react-ld.github.io/react-pullLoad/index.html) use document.body as container
9+
[demo1](https://react-ld.github.io/react-pullLoad/index1.html) use ReactPullLoad root DOM as container
1010

1111
[demo2](https://react-ld.github.io/react-pullLoad/index2.html) use ReactPullLoad root DOM as container
1212

1313
[demo3](https://react-ld.github.io/react-pullLoad/index3.html) use document.body as container, and config UI component (HeadNode and FooterNode).
14+
[demo4](https://react-ld.github.io/react-pullLoad/index4.html) forbidden pull refresh
1415

1516
# version 1.0.4
1617

@@ -32,6 +33,7 @@ npm install --save react-pullload
3233

3334
```js
3435
import ReactPullLoad,{ STATS } from 'react-pullload'
36+
import 'node_modules/react-pullload/dist/ReactPullLoad.css'
3537

3638
export class App extends Component{
3739
constructor(){

dist/bundle1.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

dist/bundle2.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

dist/bundle3.js

Lines changed: 0 additions & 22 deletions
This file was deleted.
File renamed without changes.

demo/App.jsx renamed to example/App1.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { Component, PureComponent, PropTypes } from 'react'
33
import { render } from 'react-dom'
44
import ReactPullLoad,{STATS} from 'index.js'
55
import './App.css'
6+
import '../src/ReactPullLoad.less'
67

78

89
const defaultStyle ={

demo/App1.jsx renamed to example/App2.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React, { Component, PureComponent, PropTypes } from 'react'
33
import { render } from 'react-dom'
44
import ReactPullLoad,{STATS} from 'index.js'
55
import './App.css'
6+
import '../src/ReactPullLoad.less'
67

78
const defaultStyle ={
89
width: "100%",

demo/App2.jsx renamed to example/App3.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { Component, PureComponent, PropTypes } from 'react'
33
import { render } from 'react-dom'
44
import ReactPullLoad,{STATS} from 'index.js'
55
import './App.css'
6-
6+
import '../src/ReactPullLoad.less'
77

88
const defaultStyle ={
99
width: "100%",

demo/App3.jsx renamed to example/App4.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { Component, PureComponent, PropTypes } from 'react'
33
import { render } from 'react-dom'
44
import ReactPullLoad,{STATS} from 'index.js'
55
import './App.css'
6-
6+
import '../src/ReactPullLoad.less'
77

88
const defaultStyle ={
99
width: "100%",

example/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 示例
2+
[demo1](https://react-ld.github.io/react-pullLoad/index1.html) ReactPullLoad 根节点 DOM 作为容器
3+
4+
[demo2](https://react-ld.github.io/react-pullLoad/index2.html) ReactPullLoad 根节点 DOM 作为容器
5+
6+
[demo3](https://react-ld.github.io/react-pullLoad/index3.html) document.body 作为容器 且自定义刷新和加载更多 UI 组件
7+
[demo4](https://react-ld.github.io/react-pullLoad/index4.html) 禁用下拉刷新功能
8+
9+
# 文档
10+
11+
[react-pullLoad](https://github.com/react-ld/react-pullLoad)

demo/index.html renamed to example/index1.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>ReactPullLoad demo</title>
5+
<title>ReactPullLoad demo1</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
77
</head>
88
<body>
@@ -11,5 +11,6 @@
1111
bundle1.js is demo use document as contianer
1212
bundle2.js is demo use ReactPullLoad root DOM as contianer
1313
-->
14+
<script src="./bundle1.js"></script>
1415
</body>
1516
</html>

dist/index.html renamed to example/index2.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
5-
<title>ReactPullLoad demo</title>
5+
<title>ReactPullLoad demo2</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
77
</head>
88
<body>
@@ -11,5 +11,6 @@
1111
bundle1.js is demo use document as contianer
1212
bundle2.js is demo use ReactPullLoad root DOM as contianer
1313
-->
14-
<script type="text/javascript" src="bundle1.js?753d6a186dc589442558"></script><script type="text/javascript" src="bundle2.js?69bfcaddd8006d7d4155"></script><script type="text/javascript" src="bundle3.js?de6349f014f232f06867"></script></body>
14+
<script src="./bundle2.js"></script>
15+
</body>
1516
</html>

example/index3.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>ReactPullLoad demo3</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<!--
11+
bundle1.js is demo use document as contianer
12+
bundle2.js is demo use ReactPullLoad root DOM as contianer
13+
-->
14+
<script src="./bundle3.js"></script>
15+
</body>
16+
</html>

example/index4.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>ReactPullLoad demo4</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<!--
11+
bundle1.js is demo use document as contianer
12+
bundle2.js is demo use ReactPullLoad root DOM as contianer
13+
-->
14+
<script src="./bundle4.js"></script>
15+
</body>
16+
</html>

gulpfile.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
var gulp = require('gulp');
2+
var webpack = require('webpack');
3+
var clean = require('gulp-clean');
4+
var gutil = require('gulp-util');
5+
// var ftp = require( 'vinyl-ftp' );
6+
var ghPages = require('gulp-gh-pages');
7+
// var deploy = require('./deploy.config.json');
8+
var deploy_remote_path = "/public/17zt/viewer"
9+
var webpack_config_demo = require('./webpack.config.example.js');
10+
var babel = require('gulp-babel');
11+
var less = require('gulp-less');
12+
var path = require('path');
13+
14+
gulp.task('demo:clean', function(){
15+
return gulp.src('./demo', {read: false})
16+
.pipe(clean());
17+
})
18+
19+
gulp.task('demo:file', ['demo:clean'], function(){
20+
return gulp.src(['example/**/*.html','example/README.md'])
21+
.pipe(gulp.dest('demo/'))
22+
})
23+
24+
//编译示例
25+
gulp.task('demo:webpack', ['demo:clean'], function(callback) {
26+
webpack(webpack_config_demo, function (error,status) {
27+
//gulp 异步任务必须明确执行 callback() 否则 gulp 将一直卡住
28+
callback()
29+
});
30+
});
31+
32+
gulp.task('demo:build', ['demo:file', 'demo:webpack']);
33+
34+
//部署示例到自己的测试服务器
35+
// gulp.task('deploy:demo', ['build:demo'], function () {
36+
// deploy.log = gutil.log;
37+
38+
// var conn = ftp.create(deploy);
39+
40+
// return gulp.src('demo/**')
41+
// .pipe(conn.dest(deploy_remote_path))
42+
// })
43+
44+
//部署示例到 gh-pages
45+
gulp.task('deploy:gh-pages', function() {
46+
return gulp.src('./demo/**')
47+
.pipe(ghPages());
48+
});
49+
50+
gulp.task("publish:clean", function(){
51+
return gulp.src('./dist', {read: false})
52+
.pipe(clean());
53+
})
54+
55+
//编译 js 文件
56+
gulp.task('publish:js', ["publish:clean"], function(){
57+
return gulp.src('src/**/*.{js,jsx}')
58+
.pipe(babel({
59+
presets: ["es2015", "stage-1", "react"]
60+
}))
61+
.pipe(gulp.dest('dist'));
62+
})
63+
64+
//编译 less 文件
65+
gulp.task('publish:less', ["publish:clean"], function () {
66+
return gulp.src('src/**/*.less')
67+
.pipe(less({
68+
paths: [ path.join(__dirname, 'less', 'includes') ]
69+
}))
70+
.pipe(gulp.dest('dist'));
71+
});
72+
73+
//发布 css 文件
74+
gulp.task('publish:css', ["publish:clean"], function(){
75+
return gulp.src('src/**/*.css')
76+
.pipe(gulp.dest('dist'))
77+
})
78+
79+
//打包发布 npm
80+
gulp.task('publish', ["publish:clean", 'publish:js', 'publish:less']);
81+
82+
gulp.task('demo', ['deploy:demo']);
83+
84+
gulp.task('gh-pages', ['deploy:gh-pages']);

package.json

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
{
22
"name": "react-pullload",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "React compopnent pull down refresh and pull up load more",
5-
"main": "./lib/index.js",
5+
"main": "./dist/index.js",
66
"scripts": {
7-
"start": "webpack-dev-server --hot --config webpack.demo.dev.config.js",
8-
"build": "node_modules/babel-cli/bin/babel.js src --out-dir lib && cp src/*.less lib/",
9-
"demo": "webpack -p --optimize-dedupe --progress --config webpack.demo.config.js",
10-
"clean:demos": "rm -rf ../github.io/tloader",
11-
"clean:lib": "rm -rf lib/",
7+
"start": "webpack-dev-server --config webpack.config.js",
8+
"example": "rm -rf ./demo/* & NODE_ENV=development webpack --config webpack.config.example.js",
129
"test": "echo \"Error: no test specified\" && exit 1"
1310
},
1411
"repository": {
@@ -26,6 +23,11 @@
2623
"bugs": {
2724
"url": "https://github.com/react-ld/react-pullLoad/issues"
2825
},
26+
"files": [
27+
"dist",
28+
"example",
29+
"src"
30+
],
2931
"homepage": "https://github.com/react-ld/react-pullLoad#readme",
3032
"devDependencies": {
3133
"autoprefixer": "^6.5.1",
@@ -37,6 +39,12 @@
3739
"babel-preset-react": "^6.16.0",
3840
"babel-preset-stage-1": "^6.16.0",
3941
"css-loader": "^0.25.0",
42+
"gulp": "^3.9.1",
43+
"gulp-babel": "^7.0.0",
44+
"gulp-clean": "^0.3.2",
45+
"gulp-gh-pages": "^0.5.4",
46+
"gulp-less": "^3.3.2",
47+
"gulp-util": "^3.0.8",
4048
"html-webpack-plugin": "^2.22.0",
4149
"less": "^2.7.1",
4250
"less-loader": "^2.2.3",
@@ -46,7 +54,7 @@
4654
"react-dom": "^15.3.2",
4755
"react-hot-loader": "^3.0.0-beta.6",
4856
"style-loader": "^0.13.1",
49-
"webpack": "^1.13.2",
50-
"webpack-dev-server": "^1.16.2"
57+
"webpack": "^2.6.1",
58+
"webpack-dev-server": "^2.4.5"
5159
}
5260
}

postcss.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = ({ file, options, env }) => ({
2+
// parser: file.extname === '.sss' ? 'sugarss' : false,
3+
// plugins: {
4+
// 'postcss-import': { root: file.dirname },
5+
// 'postcss-cssnext': options.cssnext ? options.cssnext : false,
6+
// 'autoprefixer': env == 'production' ? options.autoprefixer : false,
7+
// 'cssnano': env === 'production' ? options.cssnano : false
8+
// }
9+
plugins: [ require('autoprefixer')({ browsers: ["Android >= 4", "iOS >= 7"]}) ]
10+
})

src/ReactPullLoad.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { findDOMNode } from 'react-dom'
44
import { STATS } from './constants'
55
import HeadNode from './HeadNode'
66
import FooterNode from './FooterNode'
7-
import './ReactPullLoad.less'
87

98
function addEvent(obj, type, fn) {
109
if (obj.attachEvent) {

0 commit comments

Comments
 (0)