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