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