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