Skip to content
This repository was archived by the owner on Aug 22, 2022. It is now read-only.

Commit da29fd7

Browse files
committedDec 8, 2013
调整格式
1 parent 91361c4 commit da29fd7

Some content is hidden

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

53 files changed

+2127
-1998
lines changed
 

‎.jshintrc

+7-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"camelcase" : true,
55
"curly" : true,
66
"eqeqeq" : true,
7-
"forin" : true,
7+
"forin" : false,
88
"immed" : false,
99
"indent" : 4,
1010
"latedef" : false,
1111
"newcap" : false,
12-
"noarg" : true,
12+
"noarg" : false,
1313
"noempty" : true,
1414
"nonew" : false,
1515
"plusplus" : false,
@@ -27,7 +27,7 @@
2727
"asi" : false,
2828
"boss" : false,
2929
"debug" : false,
30-
"eqnull" : false,
30+
"eqnull" : true,
3131
"es5" : false,
3232
"esnext" : false,
3333

@@ -66,17 +66,17 @@
6666
"onevar" : true,
6767
"passfail" : false,
6868
"white" : true,
69-
"predef" : [ "require", "define", "module" ],
69+
"predef" : [ "require", "define", "module", "URL", "XDomainRequest", "ActiveXObject" ],
7070
"withstmt" : false,
7171
"zepto" : true,
7272
"assignvarfirst" : true,
7373
"varnewline": true,
7474
"strictchain": true,
7575
"strictindent": true,
7676
"operatorend": true,
77-
"strictlinebreak": true,
78-
"assignthisto" : "me",
79-
"assignexceptionto" : "ex",
77+
"strictlinebreak": false,
78+
"assignthisto" : false,
79+
"assignexceptionto" : false,
8080
"strictcomment" : true,
8181
"fileoverview" : true,
8282
"novoid" : true

‎Gruntfile.js

+37-74
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,26 @@ module.exports = function(grunt) {
1111
banner: '/* WebUploader <%= pkg.version %> */\n(function( window, undefined ) {\n',
1212
footer: '\n})( this );',
1313
separator: '\n\n',
14-
process: function( src, filepath ) {
15-
return src.replace( /@version@/g, grunt.config.get('pkg.version') )
16-
.replace( /(^|\r\n|\r|\n)/g, '$1 ');
17-
},
18-
19-
// 排序,让被依赖的文件移至最上面。
20-
filesFilter: function( f, files ) {
21-
var cwd = f.cwd || '',
22-
ret = [],
23-
process = function( file ) {
24-
var fileinfo = path.join( cwd, file ),
25-
str, matches, depends, idx;
26-
27-
if ( !grunt.file.exists( fileinfo ) ) {
28-
return;
29-
}
30-
31-
ret.push( file );
32-
33-
str = grunt.file.read( fileinfo );
34-
matches = str.match(/@import\s(.*?)$/im);
35-
if (matches) {
36-
depends = matches[1]
37-
38-
// 多个依赖用道号隔开
39-
.split(/\s*,\s*/g);
4014

41-
idx = ret.indexOf( file );
42-
[].splice.apply( ret, [ idx, 0 ].concat( depends ) );
43-
depends.forEach( process );
44-
}
45-
46-
47-
};
48-
// console.log( files );
49-
files.forEach( process );
50-
ret = ret.filter(function( item, idx, arr ){
51-
return idx === arr.indexOf( item );
52-
});
53-
54-
return ret;
15+
// 调整缩进
16+
process: function( src, filepath ) {
17+
return src.replace( /(^|\r\n|\r|\n)/g, '$1 ');
5518
}
5619
},
20+
5721
all: {
5822
options: {
59-
process: function( src, filepath ) {
23+
process: function( src ) {
6024
return src
61-
.replace( /webuploader\/jq-bridge/g, 'jQuery' )
62-
.replace( /@version@/g, grunt.config.get('pkg.version') )
63-
.replace( /(^|\r\n|\r|\n)/g, '$1 ');
25+
// .replace('jQuery', 'jq-bridge')
26+
.replace( /(^|\r\n|\r|\n)/g, '$1 ');
6427
}
6528
},
6629

6730
cwd: 'src',
6831

6932
src: [
70-
'amd.js',
7133
// 'jq-bridge.js',
72-
'base.js',
73-
// 'promise.js',
7434

7535
// 把剩余的打包进来。
7636
'widgets/filepicker.js',
@@ -89,28 +49,15 @@ module.exports = function(grunt) {
8949
options: {
9050
banner: '/* WebUploader <%= pkg.version %> */\n(function( window, undefined ) {\n',
9151
footer: '\n})( this );\nexports = this.WebUploader;',
92-
separator: '\n\n',
93-
process: function( src, filepath ) {
94-
return src
95-
.replace( /webuploader\/jq-bridge/g, 'jQuery' )
96-
.replace( /@version@/g, grunt.config.get('pkg.version') )
97-
.replace( /(^|\r\n|\r|\n)/g, '$1 ');
98-
}
9952
},
10053

10154
cwd: 'src',
10255

10356
src: [
104-
'amd.js',
105-
// 'jq-bridge.js',
106-
'base.js',
107-
// 'promise.js',
108-
10957
// 把剩余的打包进来。
11058
'widgets/filepicker.js',
11159
'**/*.js',
11260

113-
11461
'!exports.js',
11562
'exports.js'
11663
],
@@ -120,16 +67,35 @@ module.exports = function(grunt) {
12067
},
12168

12269
music: {
70+
cwd: 'src',
71+
72+
src: [
73+
'amd.js',
74+
'base.js',
75+
76+
// 把剩余的打包进来。
77+
'widgets/filepicker.js',
78+
'widgets/filednd.js',
79+
'widgets/queue.js',
80+
'widgets/runtime.js',
81+
'widgets/upload.js',
82+
83+
'runtime/html5/blob.js',
84+
'runtime/html5/transport.js',
85+
'runtime/html5/filepicker.js',
86+
'runtime/html5/dnd.js',
87+
88+
'!exports.js',
89+
'exports.js'
90+
],
91+
92+
dest: 'examples/music/webuploader.js'
93+
},
94+
95+
wenku: {
12396
options: {
12497
banner: '/* WebUploader <%= pkg.version %> */\n(function( window, undefined ) {\n',
125-
footer: '\n})( this );',
126-
separator: '\n\n',
127-
process: function( src, filepath ) {
128-
return src
129-
.replace( /webuploader\/jq-bridge/g, 'jQuery' )
130-
.replace( /@version@/g, grunt.config.get('pkg.version') )
131-
.replace( /(^|\r\n|\r|\n)/g, '$1 ');
132-
}
98+
footer: '\n})( this );exports = WebUploader;'
13399
},
134100

135101
cwd: 'src',
@@ -158,7 +124,7 @@ module.exports = function(grunt) {
158124
],
159125

160126

161-
dest: 'examples/music/webuploader.js'
127+
dest: '/Users/liaoxuezhi/www/wenku/common/static/common/ui/js_core/upload/webuploader.js'
162128
}
163129

164130

@@ -186,7 +152,7 @@ module.exports = function(grunt) {
186152

187153
concat: {
188154
files: ['src/**/*.js', 'Gruntfile.js'],
189-
tasks: ['concat:music'],
155+
tasks: ['concat:wenku'],
190156
}
191157
},
192158

@@ -210,9 +176,6 @@ module.exports = function(grunt) {
210176
}
211177
});
212178

213-
// 加载build目录下的所有task
214-
// grunt.loadTasks( 'tasks' );
215-
216179
// 负责报告文件大小
217180
grunt.loadNpmTasks( 'grunt-size' );
218181

@@ -223,7 +186,7 @@ module.exports = function(grunt) {
223186
grunt.loadNpmTasks( 'grunt-contrib-watch' );
224187

225188
// 加载build目录下的所有task
226-
grunt.loadTasks( 'tasks' );
189+
grunt.loadTasks( 'build/tasks' );
227190

228191
// Default task(s).
229192
grunt.registerTask( 'default', [ 'jsbint:all', 'concat:all' ] );

0 commit comments

Comments
 (0)
This repository has been archived.