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/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/angular-tablesort/js/angular-tablesort.js',
41 'node_modules/lovefield/dist/lovefield.min.js',
42 'node_modules/lovefield/dist/lovefield.min.js.map',
43 'node_modules/moment/min/moment-with-locales.min.js',
44 'node_modules/moment-timezone/builds/moment-timezone-with-data.min.js'
56 'node_modules/angular-hotkeys/build/hotkeys.min.css',
57 'node_modules/bootstrap/dist/css/bootstrap.min.css',
58 'node_modules/ng-toast/dist/ngToast.min.css',
59 'node_modules/ng-toast/dist/ngToast-animations.min.css',
60 'node_modules/angular-tree-control/css/tree-control.css',
61 'node_modules/angular-tree-control/css/tree-control-attribute.css',
62 'node_modules/angular-tablesort/tablesort.css'
69 dest : 'build/fonts/',
74 'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.eot',
75 'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.svg',
76 'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
77 'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff',
78 'node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2'
85 dest : 'build/images/',
90 'node_modules/angular-tree-control/images/sample.png',
91 'node_modules/angular-tree-control/images/node-opened-2.png',
92 'node_modules/angular-tree-control/images/folder.png',
93 'node_modules/angular-tree-control/images/node-closed.png',
94 'node_modules/angular-tree-control/images/node-closed-light.png',
95 'node_modules/angular-tree-control/images/node-opened.png',
96 'node_modules/angular-tree-control/images/node-opened-light.png',
97 'node_modules/angular-tree-control/images/folder-closed.png',
98 'node_modules/angular-tree-control/images/node-closed-2.png',
99 'node_modules/angular-tree-control/images/file.png'
105 // combine our CSS deps
106 // note: minification also supported, but not required (yet).
110 'build/css/evergreen-staff-client-deps.<%= pkg.version %>.min.css' : [
111 'build/css/hotkeys.min.css',
112 'build/css/bootstrap.min.css',
113 'build/css/ngToast.min.css',
114 'build/css/ngToast-animations.min.css',
115 'build/css/tree-control.css',
116 'build/css/tree-control-attribute.css'
122 // concatenation + minification
125 banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
130 src: ['build/js/ui-bootstrap.js', 'build/js/ui-bootstrap-tpls.js'],
133 rename: function (dst, src) {
134 return src.replace('.js', '.min.js');
140 // These are concatenated in order in the final build file.
141 // The order is important.
142 'build/js/jquery.min.js',
143 'build/js/angular.min.js',
144 'build/js/angular-animate.min.js',
145 'build/js/angular-sanitize.min.js',
146 'build/js/angular-route.min.js',
147 'build/js/ui-bootstrap.min.js',
148 'build/js/ui-bootstrap-tpls.js',
149 'build/js/hotkeys.min.js',
150 'build/js/angular-tree-control.js',
151 'build/js/ngToast.min.js',
152 'build/js/lovefield.min.js',
153 'bulid/js/moment-with-locales.min.js',
154 'build/js/moment-timezone-with-data.min.js',
155 // NOTE: OpenSRF must be installed
156 // XXX: Should not be hard-coded
157 '/openils/lib/javascript/JSON_v1.js',
158 '/openils/lib/javascript/opensrf.js',
159 '/openils/lib/javascript/opensrf_ws.js',
161 'services/strings.js',
169 'services/startup.js',
173 'services/coresvc.js',
174 'services/navbar.js',
177 'services/op_change.js',
180 dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js'
184 // bare concat operation; useful for testing concat w/o minification
185 // to more easily detect if concat order is incorrect
194 // Generate test/data/IDL2js.js for unit tests.
195 // note: the output of this script is *not* part of the final build.
197 command : 'cd test/data && perl idl2js.pl'
200 // Remove the unit test IDL2js.js file. We don't need it after testing
202 command : 'rm test/data/IDL2js.js'
206 // unit tests configuration
209 configFile: 'test/karma.conf.js'
210 //background: true // for now, visually babysit unit tests
215 // tell concat about our uglify build options (instead of repeating them)
216 config.concat.build = config.uglify.build;
218 // apply our configuration
219 grunt.initConfig(config);
222 grunt.loadNpmTasks('grunt-contrib-uglify');
223 grunt.loadNpmTasks('grunt-contrib-concat');
224 grunt.loadNpmTasks('grunt-contrib-copy');
225 grunt.loadNpmTasks('grunt-contrib-cssmin');
226 grunt.loadNpmTasks('grunt-karma');
227 grunt.loadNpmTasks('grunt-exec');
229 // note: "grunt concat" is not required
230 grunt.registerTask('build', ['copy', 'cssmin', 'uglify']);
232 // test only, no minification
233 grunt.registerTask('test', ['copy', 'exec:idl2js', 'karma:unit', 'exec:rmidl2js']);
235 // note: "grunt concat" is not requried
236 grunt.registerTask('all', ['test', 'cssmin', 'uglify']);
240 // vim: ts=2:sw=2:softtabstop=2