1 module.exports = function(grunt) {
3 // Project configuration.
5 pkg: grunt.file.readJSON('package.json'),
7 // copy the files we care about from fetched dependencies
8 // into our build directory
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'
47 dest: '../common/build/js/',
52 'node_modules/jquery/dist/jquery.min.js'
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'
77 dest : 'build/fonts/',
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'
93 dest : 'build/images/',
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'
113 // combine our CSS deps
114 // note: minification also supported, but not required (yet).
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'
130 // concatenation + minification
133 banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
138 src: ['build/js/ui-bootstrap.js', 'build/js/ui-bootstrap-tpls.js'],
141 rename: function (dst, src) {
142 return src.replace('.js', '.min.js');
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',
169 'services/strings.js',
177 'services/startup.js',
181 'services/coresvc.js',
182 'services/navbar.js',
185 'services/op_change.js',
189 dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js'
193 // bare concat operation; useful for testing concat w/o minification
194 // to more easily detect if concat order is incorrect
203 // Generate test/data/IDL2js.js for unit tests.
204 // note: the output of this script is *not* part of the final build.
206 command : 'cd test/data && perl idl2js.pl'
209 // Remove the unit test IDL2js.js file. We don't need it after testing
211 command : 'rm test/data/IDL2js.js'
215 // unit tests configuration
218 configFile: 'test/karma.conf.js'
219 //background: true // for now, visually babysit unit tests
224 // tell concat about our uglify build options (instead of repeating them)
225 config.concat.build = config.uglify.build;
227 // apply our configuration
228 grunt.initConfig(config);
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');
238 // note: "grunt concat" is not required
239 grunt.registerTask('build', ['copy', 'cssmin', 'uglify']);
241 // test only, no minification
242 grunt.registerTask('test', ['copy', 'exec:idl2js', 'karma:unit', 'exec:rmidl2js']);
244 // note: "grunt concat" is not requried
245 grunt.registerTask('all', ['test', 'cssmin', 'uglify']);
249 // vim: ts=2:sw=2:softtabstop=2