LP#1706124: Make include inactive patrons checkbox sticky
[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 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             'node_modules/angular/angular.min.js',
19             'node_modules/angular/angular.min.js.map',
20             'node_modules/angular-animate/angular-animate.min.js',
21             'node_modules/angular-animate/angular-animate.min.js.map',
22             'node_modules/angular-sanitize/angular-sanitize.min.js',
23             'node_modules/angular-sanitize/angular-sanitize.min.js.map',
24             'node_modules/angular-route/angular-route.min.js',
25             'node_modules/angular-route/angular-route.min.js.map',
26             'node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js',
27             'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
28             'node_modules/angular-hotkeys/build/hotkeys.min.js',
29             'node_modules/angular-file-saver/dist/angular-file-saver.bundle.min.js',
30             'node_modules/angular-location-update/angular-location-update.min.js',
31             'node_modules/angular-tree-control/angular-tree-control.js',
32             'node_modules/ng-toast/dist/ngToast.min.js',
33             'node_modules/angular-cookies/angular-cookies.min.js',
34             'node_modules/angular-cookies/angular-cookies.min.js.map',
35             'node_modules/iframe-resizer/js/iframeResizer.min.js',
36             'node_modules/iframe-resizer/js/iframeResizer.map',
37             'node_modules/iframe-resizer/js/iframeResizer.contentWindow.min.js',
38             'node_modules/angular-order-object-by/src/ng-order-object-by.js',
39             'node_modules/angular-tablesort/js/angular-tablesort.js',
40             'node_modules/lovefield/dist/lovefield.min.js',
41             'node_modules/lovefield/dist/lovefield.min.js.map',
42             'node_modules/moment/min/moment-with-locales.min.js',
43             'node_modules/moment-timezone/builds/moment-timezone-with-data.min.js'
44           ]
45         },
46         {
47           dest: '../common/build/js/', 
48           flatten: true,
49           filter: 'isFile',
50           expand : true,
51           src: [
52             'node_modules/jquery/dist/jquery.min.js'
53           ]
54         }]
55       },
56
57       css : {
58         files : [{
59           dest : 'build/css/',
60           flatten : true,
61           filter : 'isFile',
62           expand : true,
63           src : [
64             'node_modules/angular-hotkeys/build/hotkeys.min.css',
65             'node_modules/bootstrap/dist/css/bootstrap.min.css', 
66             'node_modules/ng-toast/dist/ngToast.min.css',
67             'node_modules/ng-toast/dist/ngToast-animations.min.css',
68             'node_modules/angular-tree-control/css/tree-control.css',
69             'node_modules/angular-tree-control/css/tree-control-attribute.css',
70             'node_modules/angular-tablesort/tablesort.css'
71           ]
72         }]
73       },
74
75       fonts : {
76         files : [{
77           dest : 'build/fonts/',
78           flatten : true,
79           filter : 'isFile',
80           expand : true,
81           src : [
82             'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.eot',
83             'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.svg',
84             'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
85             'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff',
86             'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2'
87           ]
88         }]
89       },
90
91       images : {
92         files : [{
93           dest : 'build/images/',
94           flatten : true,
95           filter : 'isFile',
96           expand : true,
97           src : [
98             'node_modules/angular-tree-control/images/sample.png',
99             'node_modules/angular-tree-control/images/node-opened-2.png',
100             'node_modules/angular-tree-control/images/folder.png',
101             'node_modules/angular-tree-control/images/node-closed.png',
102             'node_modules/angular-tree-control/images/node-closed-light.png',
103             'node_modules/angular-tree-control/images/node-opened.png',
104             'node_modules/angular-tree-control/images/node-opened-light.png',
105             'node_modules/angular-tree-control/images/folder-closed.png',
106             'node_modules/angular-tree-control/images/node-closed-2.png',
107             'node_modules/angular-tree-control/images/file.png'
108           ]
109         }]
110       }
111     },
112
113     // combine our CSS deps
114     // note: minification also supported, but not required (yet).
115     cssmin: {
116       combine: {
117         files: {
118           'build/css/evergreen-staff-client-deps.<%= pkg.version %>.min.css' : [
119             'build/css/hotkeys.min.css',
120             'build/css/bootstrap.min.css',
121             'build/css/ngToast.min.css',
122             'build/css/ngToast-animations.min.css',
123             'build/css/tree-control.css',
124             'build/css/tree-control-attribute.css'
125           ]
126         }
127       }
128     },
129
130     // concatenation + minification
131     uglify: {
132       options: {
133         banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
134       },
135       dev: {
136         files: [{
137           expand: true,
138           src: ['build/js/ui-bootstrap.js', 'build/js/ui-bootstrap-tpls.js'],
139           dest: 'build/js',
140           cwd: '.',
141           rename: function (dst, src) {
142             return src.replace('.js', '.min.js');
143           }
144         }]
145       },
146       build: {
147         src: [
148             // These are concatenated in order in the final build file.
149             // The order is important.
150             '../common/build/js/jquery.min.js',
151             'build/js/angular.min.js',
152             'build/js/angular-animate.min.js',
153             'build/js/angular-sanitize.min.js',
154             'build/js/angular-route.min.js',
155             'build/js/ui-bootstrap.min.js',
156             'build/js/ui-bootstrap-tpls.js',
157             'build/js/hotkeys.min.js',
158             'build/js/angular-tree-control.js',
159             'build/js/ngToast.min.js',
160             'build/js/lovefield.min.js',
161             'bulid/js/moment-with-locales.min.js',
162             'build/js/moment-timezone-with-data.min.js',
163             // NOTE: OpenSRF must be installed
164             // XXX: Should not be hard-coded
165             '/openils/lib/javascript/JSON_v1.js',
166             '/openils/lib/javascript/opensrf.js',
167             '/openils/lib/javascript/opensrf_ws.js',
168             'services/core.js',
169             'services/strings.js',
170             'services/idl.js',
171             'services/event.js',
172             'services/net.js',
173             'services/auth.js',
174             'services/pcrud.js',
175             'services/env.js',
176             'services/org.js',
177             'services/startup.js',
178             'services/hatch.js',
179             'services/print.js',
180             'services/audio.js',
181             'services/coresvc.js',
182             'services/navbar.js',
183             'services/ui.js',
184             'services/date.js',
185             'services/op_change.js',
186             'services/file.js',
187             'services/i18n.js'
188         ],
189         dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js'
190       },
191     },
192
193     // bare concat operation; useful for testing concat w/o minification
194     // to more easily detect if concat order is incorrect
195     concat: {
196       options: {
197        separator: ';'
198       }
199     },
200
201     exec : {
202
203       // Generate test/data/IDL2js.js for unit tests.
204       // note: the output of this script is *not* part of the final build.
205       idl2js : {
206         command : 'cd test/data && perl idl2js.pl'
207       },
208
209       // Remove the unit test IDL2js.js file.  We don't need it after testing
210       rmidl2js : {
211         command : 'rm test/data/IDL2js.js'
212       }
213     },
214
215     // unit tests configuration
216     karma : {
217       unit: {
218         configFile: 'test/karma.conf.js'
219         //background: true  // for now, visually babysit unit tests
220       }
221     }
222   };
223
224   // tell concat about our uglify build options (instead of repeating them)
225   config.concat.build = config.uglify.build;
226
227   // apply our configuration
228   grunt.initConfig(config);
229
230   // Load our modules
231   grunt.loadNpmTasks('grunt-contrib-uglify');
232   grunt.loadNpmTasks('grunt-contrib-concat');
233   grunt.loadNpmTasks('grunt-contrib-copy');
234   grunt.loadNpmTasks('grunt-contrib-cssmin');
235   grunt.loadNpmTasks('grunt-karma');
236   grunt.loadNpmTasks('grunt-exec');
237
238   // note: "grunt concat" is not required 
239   grunt.registerTask('build', ['copy', 'cssmin', 'uglify']);
240
241   // test only, no minification
242   grunt.registerTask('test', ['copy', 'exec:idl2js', 'karma:unit', 'exec:rmidl2js']);
243
244   // note: "grunt concat" is not requried 
245   grunt.registerTask('all', ['test', 'cssmin', 'uglify']);
246
247 };
248
249 // vim: ts=2:sw=2:softtabstop=2