Skip to content

Commit 02da1fa

Browse files
author
xiongyj
committed
init project
0 parents  commit 02da1fa

30 files changed

+17386
-0
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"plugins": [
3+
"react"
4+
],
5+
"ecmaFeatures": {
6+
"jsx": true,
7+
"modules": true
8+
},
9+
"env": {
10+
"browser": true,
11+
"amd": true,
12+
"es6": true
13+
},
14+
"rules": {
15+
"quotes": [ 1, "single" ],
16+
"no-undef": false,
17+
"global-strict": false,
18+
"no-extra-semi": 1,
19+
"no-underscore-dangle": false
20+
}
21+
}

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### SublimeText ###
2+
*.sublime-workspace
3+
4+
### OSX ###
5+
.DS_Store
6+
.AppleDouble
7+
.LSOverride
8+
Icon
9+
10+
# Thumbnails
11+
._*
12+
13+
# Files that might appear on external disk
14+
.Spotlight-V100
15+
.Trashes
16+
17+
### Windows ###
18+
# Windows image file caches
19+
Thumbs.db
20+
ehthumbs.db
21+
22+
# Folder config file
23+
Desktop.ini
24+
25+
# Recycle Bin used on file shares
26+
$RECYCLE.BIN/
27+
28+
# App specific
29+
30+
node_modules/
31+
.tmp
32+
dist
33+
/src/main.js

.jshintrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"node": true,
3+
"browser": true,
4+
"esnext": true,
5+
"bitwise": true,
6+
"camelcase": false,
7+
"curly": true,
8+
"eqeqeq": true,
9+
"immed": true,
10+
"indent": 2,
11+
"latedef": true,
12+
"newcap": true,
13+
"noarg": true,
14+
"quotmark": "false",
15+
"regexp": true,
16+
"undef": true,
17+
"unused": false,
18+
"strict": true,
19+
"trailing": true,
20+
"smarttabs": true,
21+
"white": true,
22+
"newcap": false,
23+
"globals": {
24+
"React": true
25+
}
26+
}
27+

.yo-rc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"generator-react-webpack": {
3+
"app-name": "galaxy",
4+
"architecture": "reflux",
5+
"styles-language": "less",
6+
"component-suffix": "js"
7+
}
8+
}

Gruntfile.js

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
'use strict';
2+
3+
var mountFolder = function (connect, dir) {
4+
return connect.static(require('path').resolve(dir));
5+
};
6+
7+
var webpackDistConfig = require('./webpack.dist.config.js'),
8+
webpackDevConfig = require('./webpack.config.js');
9+
10+
module.exports = function (grunt) {
11+
// Let *load-grunt-tasks* require everything
12+
require('load-grunt-tasks')(grunt);
13+
14+
// Read configuration from package.json
15+
var pkgConfig = grunt.file.readJSON('package.json');
16+
17+
grunt.initConfig({
18+
pkg: pkgConfig,
19+
20+
webpack: {
21+
options: webpackDistConfig,
22+
dist: {
23+
cache: false
24+
}
25+
},
26+
27+
'webpack-dev-server': {
28+
options: {
29+
hot: true,
30+
port: 8000,
31+
webpack: webpackDevConfig,
32+
publicPath: '/assets/',
33+
contentBase: './<%= pkg.src %>/'
34+
},
35+
36+
start: {
37+
keepAlive: true
38+
}
39+
},
40+
41+
connect: {
42+
options: {
43+
port: 8000
44+
},
45+
46+
dist: {
47+
options: {
48+
keepalive: true,
49+
middleware: function (connect) {
50+
return [
51+
mountFolder(connect, pkgConfig.dist)
52+
];
53+
}
54+
}
55+
}
56+
},
57+
58+
open: {
59+
options: {
60+
delay: 500
61+
},
62+
dev: {
63+
path: 'http://localhost:<%= connect.options.port %>/webpack-dev-server/'
64+
},
65+
dist: {
66+
path: 'http://localhost:<%= connect.options.port %>/'
67+
}
68+
},
69+
70+
karma: {
71+
unit: {
72+
configFile: 'karma.conf.js'
73+
}
74+
},
75+
76+
copy: {
77+
dist: {
78+
files: [
79+
// includes files within path
80+
{
81+
flatten: true,
82+
expand: true,
83+
src: ['<%= pkg.src %>/*'],
84+
dest: '<%= pkg.dist %>/',
85+
filter: 'isFile'
86+
},
87+
{
88+
flatten: true,
89+
expand: true,
90+
src: ['<%= pkg.src %>/images/*'],
91+
dest: '<%= pkg.dist %>/images/'
92+
}
93+
]
94+
}
95+
},
96+
97+
clean: {
98+
dist: {
99+
files: [{
100+
dot: true,
101+
src: [
102+
'<%= pkg.dist %>'
103+
]
104+
}]
105+
}
106+
}
107+
});
108+
109+
grunt.registerTask('serve', function (target) {
110+
if (target === 'dist') {
111+
return grunt.task.run(['build', 'open:dist', 'connect:dist']);
112+
}
113+
114+
grunt.task.run([
115+
'open:dev',
116+
'webpack-dev-server'
117+
]);
118+
});
119+
120+
grunt.registerTask('test', ['karma']);
121+
122+
grunt.registerTask('build', ['clean', 'copy', 'webpack']);
123+
124+
grunt.registerTask('default', []);
125+
};

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 创宇盾星图
2+
* 前端架构 reactjs + reflux + webpack + 百度echarts + grunt + less, 采用ES6语法+ babel解析器

karma.conf.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
'use strict';
2+
3+
var path = require('path');
4+
5+
module.exports = function (config) {
6+
config.set({
7+
basePath: '',
8+
frameworks: ['jasmine'],
9+
files: [
10+
'test/helpers/pack/**/*.js',
11+
'test/helpers/react/**/*.js',
12+
'test/spec/components/**/*.js',
13+
'test/spec/stores/**/*.js',
14+
'test/spec/actions/**/*.js'
15+
],
16+
preprocessors: {
17+
'test/helpers/createComponent.js': ['webpack'],
18+
'test/spec/components/**/*.js': ['webpack'],
19+
'test/spec/components/**/*.jsx': ['webpack'],
20+
'test/spec/stores/**/*.js': ['webpack'],
21+
'test/spec/actions/**/*.js': ['webpack']
22+
},
23+
webpack: {
24+
cache: true,
25+
module: {
26+
loaders: [{
27+
test: /\.gif/,
28+
loader: 'url-loader?limit=10000&mimetype=image/gif'
29+
}, {
30+
test: /\.jpg/,
31+
loader: 'url-loader?limit=10000&mimetype=image/jpg'
32+
}, {
33+
test: /\.png/,
34+
loader: 'url-loader?limit=10000&mimetype=image/png'
35+
}, {
36+
test: /\.(js|jsx)$/,
37+
loader: 'babel-loader',
38+
exclude: /node_modules/
39+
}, {
40+
test: /\.less/,
41+
loader: 'style-loader!css-loader!less-loader'
42+
}, {
43+
test: /\.css$/,
44+
loader: 'style-loader!css-loader'
45+
}, {
46+
test: /\.woff/,
47+
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
48+
}, {
49+
test: /\.woff2/,
50+
loader: 'url-loader?limit=10000&mimetype=application/font-woff2'
51+
}]
52+
},
53+
resolve: {
54+
alias: {
55+
'styles': path.join(process.cwd(), './src/styles/'),
56+
'components': path.join(process.cwd(), './src/components/'),
57+
'stores': '../../../src/stores/',
58+
'actions': '../../../src/actions/',
59+
'helpers': path.join(process.cwd(), './test/helpers/')
60+
}
61+
}
62+
},
63+
webpackMiddleware: {
64+
noInfo: true,
65+
stats: {
66+
colors: true
67+
}
68+
},
69+
exclude: [],
70+
port: 8080,
71+
logLevel: config.LOG_INFO,
72+
colors: true,
73+
autoWatch: false,
74+
browsers: ['PhantomJS'],
75+
reporters: ['dots'],
76+
captureTimeout: 60000,
77+
singleRun: true,
78+
plugins: [
79+
require('karma-webpack'),
80+
require('karma-jasmine'),
81+
require('karma-phantomjs-launcher')
82+
]
83+
});
84+
};

0 commit comments

Comments
 (0)