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