@@ -2,98 +2,6 @@ module.exports = function( grunt ) {
2
2
3
3
"use strict" ;
4
4
5
- grunt . registerTask ( "manifest" , "Generate jquery.json manifest files" , function ( ) {
6
- var uiFiles ,
7
- totalManifests = 0 ,
8
- pkg = grunt . config ( "pkg" ) ,
9
- base = {
10
- core : {
11
- name : "ui.{plugin}" ,
12
- title : "jQuery UI {Plugin}"
13
- } ,
14
- widget : {
15
- name : "ui.{plugin}" ,
16
- title : "jQuery UI {Plugin}" ,
17
- dependencies : [ "core" , "widget" ]
18
- } ,
19
- interaction : {
20
- name : "ui.{plugin}" ,
21
- title : "jQuery UI {Plugin}" ,
22
- dependencies : [ "core" , "widget" , "mouse" ]
23
- } ,
24
- effect : {
25
- name : "ui.effect-{plugin}" ,
26
- title : "jQuery UI {Plugin} Effect" ,
27
- keywords : [ "effect" , "show" , "hide" ] ,
28
- homepage : "http://jqueryui.com/effect/" ,
29
- demo : "http://jqueryui.com/effect/" ,
30
- docs : "http://api.jqueryui.com/{plugin}-effect/" ,
31
- dependencies : [ "effect" ]
32
- }
33
- } ;
34
-
35
- Object . keys ( base ) . forEach ( function ( type ) {
36
- var baseManifest = base [ type ] ,
37
- plugins = grunt . file . readJSON ( "build/" + type + ".json" ) ,
38
- bower = grunt . file . readJSON ( "bower.json" ) ;
39
-
40
- Object . keys ( plugins ) . forEach ( function ( plugin ) {
41
- var manifest , bowerKey ,
42
- data = plugins [ plugin ] ,
43
- name = plugin . charAt ( 0 ) . toUpperCase ( ) + plugin . substr ( 1 ) ;
44
-
45
- function replace ( str ) {
46
- return str . replace ( "{plugin}" , plugin ) . replace ( "{Plugin}" , name ) ;
47
- }
48
-
49
- manifest = {
50
- name : data . name || replace ( baseManifest . name ) ,
51
- title : data . title || replace ( baseManifest . title ) ,
52
- description : data . description ,
53
- keywords : [ "ui" , plugin ]
54
- . concat ( baseManifest . keywords || [ ] )
55
- . concat ( data . keywords || [ ] ) ,
56
- version : pkg . version ,
57
- author : pkg . author ,
58
- maintainers : pkg . maintainers ,
59
- licenses : pkg . licenses ,
60
- bugs : pkg . bugs ,
61
- homepage : data . homepage || replace ( baseManifest . homepage ||
62
- "http://jqueryui.com/{plugin}/" ) ,
63
- demo : data . demo || replace ( baseManifest . demo ||
64
- "http://jqueryui.com/{plugin}/" ) ,
65
- docs : data . docs || replace ( baseManifest . docs ||
66
- "http://api.jqueryui.com/{plugin}/" ) ,
67
- download : "http://jqueryui.com/download/" ,
68
- dependencies : { } ,
69
- // custom
70
- category : data . category || type
71
- } ;
72
-
73
- for ( bowerKey in bower . dependencies ) {
74
- manifest . dependencies [ bowerKey ] = bower . dependencies [ bowerKey ] ;
75
- }
76
-
77
- ( baseManifest . dependencies || [ ] )
78
- . concat ( data . dependencies || [ ] )
79
- . forEach ( function ( dependency ) {
80
- manifest . dependencies [ "ui." + dependency ] = pkg . version ;
81
- } ) ;
82
-
83
- grunt . file . write ( manifest . name + ".jquery.json" ,
84
- JSON . stringify ( manifest , null , "\t" ) + "\n" ) ;
85
- totalManifests += 1 ;
86
- } ) ;
87
- } ) ;
88
-
89
- uiFiles = grunt . file . expand ( "ui/*.js" ) . length ;
90
- if ( totalManifests !== uiFiles ) {
91
- grunt . log . error ( "Generated " + totalManifests + " manifest files, but there are " +
92
- uiFiles + " ui/*.js files. Do all of them have entries?" ) ;
93
- return false ;
94
- }
95
- } ) ;
96
-
97
5
grunt . registerTask ( "clean" , function ( ) {
98
6
require ( "rimraf" ) . sync ( "dist" ) ;
99
7
} ) ;
0 commit comments