use bower for deps install; TODO: update docs
authorBill Erickson <berick@esilibrary.com>
Thu, 8 May 2014 14:01:46 +0000 (10:01 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 8 May 2014 14:01:46 +0000 (10:01 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
.gitignore
Open-ILS/web/js/ui/default/staff/Gruntfile.js
Open-ILS/web/js/ui/default/staff/README.install
Open-ILS/web/js/ui/default/staff/bower.json [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/package.json
Open-ILS/web/js/ui/default/staff/test/karma.conf.js

index 94d7ff2..b42b3d4 100644 (file)
@@ -354,3 +354,4 @@ Open-ILS/xul/staff_client/xulrunner-stub.exe
 /JavaScript*
 Open-ILS/web/js/ui/default/staff/build/
 Open-ILS/web/js/ui/default/staff/node_modules/
+Open-ILS/web/js/ui/default/staff/bower_components/
index 2065d95..52cf0be 100644 (file)
@@ -4,26 +4,68 @@ module.exports = function(grunt) {
   var config = { 
     pkg: grunt.file.readJSON('package.json'),
 
-    // copy the JS files we care about from node-fetched dependencies
+    // copy the files we care about from bower-fetched dependencies
     // into our build directory
     copy: {
-      main: {
+
+      js : {
         files: [{ 
-          dest: 'build/', 
+          dest: 'build/js/', 
           flatten: true,
           filter: 'isFile',
           expand : true,
           src: [
-            'node_modules/angular/lib/angular.min.js',
-            'node_modules/angular-route/angular-route.min.js',
-            'node_modules/angular-bootstrap/ui-bootstrap.js',
-            'node_modules/angular-hotkeys/build/hotkeys.min.js'
+            'bower_components/angular/angular.min.js',
+            'bower_components/angular-route/angular-route.min.js',
+            'bower_components/angular-bootstrap/ui-bootstrap.min.js',
+            'bower_components/angular-hotkeys/build/hotkeys.min.js',
+          ]
+        }]
+      },
+
+      css : {
+        files : [{
+          dest : 'build/css/',
+          flatten : true,
+          filter : 'isFile',
+          expand : true,
+          src : [
+            'bower_components/angular-hotkeys/build/hotkeys.min.css',
+            'bower_components/bootstrap/dist/css/bootstrap.min.css' 
+          ]
+        }]
+      },
+
+      fonts : {
+        files : [{
+          dest : 'build/fonts/',
+          flatten : true,
+          filter : 'isFile',
+          expand : true,
+          src : [
+            'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot',
+            'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg',
+            'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf',
+            'bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff'
           ]
         }]
       }
     },
 
-    // confiure minification
+    // combine our CSS deps
+    // note: minification also supported, but not required (yet).
+    cssmin: {
+      combine: {
+        files: {
+          'build/css/evergreen-staff-client-deps.<%= pkg.version %>.css' : [
+            'build/css/hotkeys.min.css',
+            'build/css/bootstrap.min.css'
+          ]
+        }
+      }
+    },
+
+    // concatenation + minification
     uglify: {
       options: {
         banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
@@ -32,10 +74,10 @@ module.exports = function(grunt) {
         src: [
             // These are concatenated in order in the final build file.
             // The order is important.
-            'build/angular.min.js',
-            'build/angular-route.min.js',
-            'build/ui-bootstrap.js',
-            'build/hotkeys.min.js',
+            'build/js/angular.min.js',
+            'build/js/angular-route.min.js',
+            'build/js/ui-bootstrap.min.js',
+            'build/js/hotkeys.min.js',
             // NOTE: OpenSRF must be installed
             '/openils/lib/javascript/JSON_v1.js',
             '/openils/lib/javascript/opensrf.js',
@@ -52,22 +94,30 @@ module.exports = function(grunt) {
             'services/startup.js',
             'services/hatch.js',
             'services/coresvc.js',
+            'services/navbar.js',
             'services/statusbar.js',
             'services/ui.js',
-            'navbar.js'
         ],
-        dest: 'build/<%= pkg.name %>.<%= pkg.version %>.min.js'
+        dest: 'build/js/<%= pkg.name %>.<%= pkg.version %>.min.js'
       }
     },
 
     // bare concat operation; useful for testing concat w/o minification
-    // to more easily detect when concat order is incorrect
+    // to more easily detect if concat order is incorrect
     concat: {
       options: {
        separator: ';',
       }
     },
 
+    // generate test/data/IDL2js.js
+    exec : {
+      idl2js : {
+        command : 'cd test/data && perl idl2js.pl',
+        stdout : true
+      }
+    },
+
     // unit tests configuration
     karma : {
       unit: {
@@ -87,12 +137,15 @@ module.exports = function(grunt) {
   grunt.loadNpmTasks('grunt-contrib-uglify');
   grunt.loadNpmTasks('grunt-contrib-concat');
   grunt.loadNpmTasks('grunt-contrib-copy');
+  grunt.loadNpmTasks('grunt-contrib-cssmin');
   grunt.loadNpmTasks('grunt-karma');
+  grunt.loadNpmTasks('grunt-exec');
 
   // note: "grunt concat" is not requried 
-  grunt.registerTask('all', ['copy', 'karma:unit', 'uglify']);
+  grunt.registerTask('all', ['copy', 'exec', 'karma:unit', 'cssmin', 'uglify']);
 
   // test only, no minification
-  grunt.registerTask('test', ['copy', 'karma:unit']);
-
+  grunt.registerTask('test', ['copy', 'exec', 'karma:unit']);
 };
+
+// vim: ts=2:sw=2:softtabstop=2
index bc299d8..92a1076 100644 (file)
@@ -97,4 +97,5 @@ but the IDL JS is generated from the in-repo fm_IDL.xml file via a script:
    ** Avoid installing test, node_modules, etc. into the web dir.
  * Support fetching JS deps (angularjs, etc.) via direct retrieval for 
    installation without test + concat + minify (i.e. w/o requiring Node.js)?
+ * CSS minification
 
diff --git a/Open-ILS/web/js/ui/default/staff/bower.json b/Open-ILS/web/js/ui/default/staff/bower.json
new file mode 100644 (file)
index 0000000..8c2ed1f
--- /dev/null
@@ -0,0 +1,30 @@
+{
+  "name": "evergreen-staff-client",
+  "version": "0.0.1",
+  "authors": [
+    "Bill Erickson <berick@esilibrary.com>"
+  ],
+  "description": "Evergreen HTML Staff Client",
+  "keywords": [
+    "evergreen"
+  ],
+  "license": "GPL",
+  "homepage": "http://evergreen-ils.org",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "test",
+    "tests"
+  ],
+  "devDependencies": {
+    "bootstrap": "~3.1.1",
+    "angular": "~1.2.16",
+    "angular-route": "~1.2.16",
+    "angular-mocks": "~1.2.16",
+    "angular-bootstrap": "~0.11.0"
+  },
+  "dependencies": {
+    "angular-hotkeys": "chieffancypants/angular-hotkeys#~1.2.0"
+  }
+}
index 0350437..d423fd4 100644 (file)
@@ -5,29 +5,23 @@
   "license": "GPL",
   "homepage": "http://evergreen-ils.org/",
   "devDependencies": {
-    "angular": "^1.2.16",
-    "angular-bootstrap": "0.0.4",
-    "angular-hotkeys": "^1.2.0",
+    "bower": "^1.3.3",
     "grunt": "~0.4.4",
     "grunt-cli": "^0.1.13",
     "grunt-contrib-concat": "^0.4.0",
     "grunt-contrib-copy": "^0.5.0",
+    "grunt-contrib-cssmin": "^0.9.0",
     "grunt-contrib-jasmine": "^0.6.4",
     "grunt-contrib-uglify": "^0.4.0",
+    "grunt-exec": "^0.4.5",
     "grunt-karma": "^0.8.3",
     "karma": "^0.12.14",
     "karma-jasmine": "^0.1.5",
     "karma-phantomjs-launcher": "^0.1.4",
     "karma-script-launcher": "~0.1.0",
-    "karma-story-reporter": "^0.2.2",
-    "napa": "^0.4.1"
-  },
-  "napa": {
-    "angular-route": "angular/bower-angular-route",
-    "angular-mocks": "angular/bower-angular-mocks"
+    "karma-story-reporter": "^0.2.2"
   },
   "scripts": {
-    "install": "napa",
     "test": "grunt test"
   }
 }
index 235c7b4..88a60ef 100644 (file)
@@ -6,11 +6,11 @@ module.exports = function(config){
     logLevel: config.LOG_INFO,
 
     files : [
-      'build/angular.min.js',
-      'build/angular-route.min.js',
-      'node_modules/angular-mocks/angular-mocks.js', // testing only
-      'build/ui-bootstrap.js',
-      'build/hotkeys.min.js',
+      'build/js/angular.min.js',
+      'build/js/angular-route.min.js',
+      'bower_components/angular-mocks/angular-mocks.js', // testing only
+      'build/js/ui-bootstrap.min.js',
+      'build/js/hotkeys.min.js',
       /* OpenSRF must be installed first */
       '/openils/lib/javascript/md5.js',
       '/openils/lib/javascript/JSON_v1.js',