@@ -16,6 +16,25 @@ config.init({
16
16
'dist/jquery.validate.min.js' : [ '<banner>' , 'dist/jquery.validate.js' ] ,
17
17
'dist/additional-methods.min.js' : [ '<banner>' , 'dist/additional-methods.js' ]
18
18
} ,
19
+ zip : {
20
+ dist : {
21
+ src : [
22
+ 'dist/additional-methods.js' ,
23
+ 'dist/additional-methods.min.js' ,
24
+ 'dist/jquery.validate.js' ,
25
+ 'dist/jquery.validate.min.js' ,
26
+ 'README.md' ,
27
+ 'changelog.txt' ,
28
+ 'grunt.js' ,
29
+ 'package.json' ,
30
+ 'demo/**/*' ,
31
+ 'lib/**/*' ,
32
+ 'localization/**/*' ,
33
+ 'test/**/*'
34
+ ] ,
35
+ dest : 'dist/<%= pkg.name %>-<%= pkg.version %>.zip'
36
+ }
37
+ } ,
19
38
qunit : {
20
39
files : [ 'test/index.html' ]
21
40
} ,
@@ -43,17 +62,16 @@ config.init({
43
62
}
44
63
} ) ;
45
64
46
- task . registerTask ( 'zip' , 'Create a zip file for release' , function ( ) {
47
- var folder = config ( 'pkg' ) . name + '-' + config ( 'pkg' ) . version ;
48
- var target = 'dist/' + folder + '.zip' ;
49
- log . writeln ( 'Zipping into ' + target ) ;
65
+ task . registerBasicTask ( 'zip' , 'Create a zip file for release' , function ( data ) {
66
+ var files = file . expand ( data . src ) ;
67
+ log . writeln ( "Creating zip file " + data . dest ) ;
50
68
51
69
var done = this . async ( ) ;
52
70
53
71
var zipstream = require ( 'zipstream' ) ;
54
72
var fs = require ( 'fs' ) ;
55
73
56
- var out = fs . createWriteStream ( target ) ;
74
+ var out = fs . createWriteStream ( data . dest ) ;
57
75
var zip = zipstream . createZip ( { level : 1 } ) ;
58
76
59
77
zip . pipe ( out ) ;
@@ -67,29 +85,9 @@ task.registerTask('zip', 'Create a zip file for release', function() {
67
85
return ;
68
86
}
69
87
var file = files . shift ( ) ;
70
- log . writeln ( 'Zipping ' + file . file ) ;
71
- zip . addFile ( fs . createReadStream ( file . file ) , { name : folder + '/' + file . name } , addFile ) ;
88
+ log . verbose . writeln ( 'Zipping ' + file ) ;
89
+ zip . addFile ( fs . createReadStream ( file ) , { name : file } , addFile ) ;
72
90
}
73
-
74
- // TODO use the concat results instead of copying the original source files
75
- // or don't use grunt's banner support, replace @VERSION instead
76
- var files = [ {
77
- file : 'dist/additional-methods.min.js' ,
78
- name : 'additional-methods.min.js'
79
- } ,
80
- {
81
- file : 'dist/jquery.validate.min.js' ,
82
- name : 'jquery.validate.min.js'
83
- } ] ;
84
- file . recurse ( '.' , function ( name ) {
85
- if ( / ^ ( : ? n o d e _ m o d u l e s | d i s t | \. | b u i l d ) / . test ( name ) ) {
86
- return ;
87
- }
88
- files . push ( {
89
- file : name ,
90
- name : name
91
- } ) ;
92
- } ) ;
93
91
addFile ( ) ;
94
92
} ) ;
95
93
0 commit comments