]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/ui/default/staff/Gruntfile.js
webstaff: Enhance grid item selection API for external hooks
[working/Evergreen.git] / Open-ILS / web / js / ui / default / staff / Gruntfile.js
1 module.exports = function(grunt) {
2
3   // Project configuration.
4   var config = { 
5     pkg: grunt.file.readJSON('package.json'),
6
7     // copy the files we care about from bower-fetched dependencies
8     // into our build directory
9     copy: {
10
11       js : {
12         files: [{ 
13           dest: 'build/js/', 
14           flatten: true,
15           filter: 'isFile',
16           expand : true,
17           src: [
18             'bower_components/angular/angular.min.js',
19             'bower_components/angular/angular.min.js.map',
20             'bower_components/angular-route/angular-route.min.js',
21             'bower_components/angular-route/angular-route.min.js.map',
22             'bower_components/angular-bootstrap/ui-bootstrap.min.js',
23             'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
24             'bower_components/angular-hotkeys/build/hotkeys.min.js',
25             'bower_components/jquery/dist/jquery.min.js',
26           ]
27         }]
28       },
29
30       css : {
31         files : [{
32           dest : 'build/css/',
33           flatten : true,
34           filter : 'isFile',
35           expand : true,
36           src : [
37             'bower_components/angular-hotkeys/build/hotkeys.min.css',
38             'bower_components/bootstrap/dist/css/bootstrap.min.css' 
39           ]
40         }]
41       },
42
43       fonts : {
44         files : [{
45           dest : 'build/fonts/',
46           flatten : true,
47           filter : 'isFile',
48           expand : true,
49           src : [
50             'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot',
51             'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg',
52             'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
53             'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff'
54           ]
55         }]
56       }
57     },
58
59     // combine our CSS deps
60     // note: minification also supported, but not required (yet).
61     cssmin: {
62       combine: {
63         files: {
64           'build/css/evergreen-staff-client-deps.<%= pkg.version %>.min.css' : [
65             'build/css/hotkeys.min.css',
66             'build/css/bootstrap.min.css'
67           ]
68         }
69       }
70     },
71
72     // concatenation + minification
73     uglify: {
74       options: {
75         banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
76       },
77       build: {
78         src: [
79             // These are concatenated in order in the final build file.
80             // The order is important.
81             'build/js/jquery.min.js',
82             'build/js/angular.min.js',
83             'build/js/angular-route.min.js',
84             'build/js/ui-bootstrap.min.js',
85             'build/js/ui-bootstrap-tpls.min.js',
86             'build/js/hotkeys.min.js',
87             // NOTE: OpenSRF must be installed
88             '/openils/lib/javascript/JSON_v1.js',
89             '/openils/lib/javascript/opensrf.js',
90             '/openils/lib/javascript/opensrf_ws.js',
91             'services/core.js',
92             'services/strings.js',
93             'services/idl.js',
94             'services/event.js',
95             'services/net.js',
96             'services/auth.js',
97             'services/pcrud.js',
98             'services/env.js',
99             'services/org.js',
100             'services/startup.js',
101             'services/hatch.js',
102             'services/print.js',
103             'services/coresvc.js',
104             'services/navbar.js',
105             'services/statusbar.js',
106             'services/ui.js',
107             'services/date.js',
108         ],
109         dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js'
110       }
111     },
112
113     // bare concat operation; useful for testing concat w/o minification
114     // to more easily detect if concat order is incorrect
115     concat: {
116       options: {
117        separator: ';',
118       }
119     },
120
121     exec : {
122
123       // Generate test/data/IDL2js.js for unit tests.
124       // note: the output of this script is *not* part of the final build.
125       idl2js : {
126         command : 'cd test/data && perl idl2js.pl',
127       },
128
129       // Remove the unit test IDL2js.js file.  We don't need it after testing
130       rmidl2js : {
131         command : 'rm test/data/IDL2js.js',
132       }
133     },
134
135     // unit tests configuration
136     karma : {
137       unit: {
138         configFile: 'test/karma.conf.js',
139         //background: true  // for now, visually babysit unit tests
140       }
141     }
142   };
143
144   // tell concat about our uglify build options (instead of repeating them)
145   config.concat.build = config.uglify.build;
146
147   // apply our configuration
148   grunt.initConfig(config);
149
150   // Load our modules
151   grunt.loadNpmTasks('grunt-contrib-uglify');
152   grunt.loadNpmTasks('grunt-contrib-concat');
153   grunt.loadNpmTasks('grunt-contrib-copy');
154   grunt.loadNpmTasks('grunt-contrib-cssmin');
155   grunt.loadNpmTasks('grunt-karma');
156   grunt.loadNpmTasks('grunt-exec');
157
158   // note: "grunt concat" is not requried 
159   grunt.registerTask('build', ['copy', 'cssmin', 'uglify']);
160
161   // test only, no minification
162   grunt.registerTask('test', ['copy', 'exec:idl2js', 'karma:unit', 'exec:rmidl2js']);
163
164   // note: "grunt concat" is not requried 
165   grunt.registerTask('all', ['test', 'cssmin', 'uglify']);
166
167 };
168
169 // vim: ts=2:sw=2:softtabstop=2