Update JSON API
[src/app-framework-demo.git] / afm-client / bower_components / jszip / Gruntfile.js
1 /*jshint node: true */
2 module.exports = function(grunt) {
3   var browsers = [{
4       browserName: "iphone",
5       platform: "OS X 10.8",
6       version: "6"
7   }, {
8       browserName: "android",
9       platform: "Linux",
10       version: "4.0"
11   }, {
12       browserName: "firefox",
13       platform: "XP"
14   }, {
15       browserName: "chrome",
16       platform: "XP"
17   }, {
18       browserName: "internet explorer",
19       platform: "WIN8",
20       version: "10"
21   }, {
22       browserName: "internet explorer",
23       platform: "VISTA",
24       version: "9"
25   }, {
26       browserName: "internet explorer",
27       platform: "Windows 7",
28       version: "8"
29   }, {
30       browserName: "internet explorer",
31       platform: "XP",
32       version: "7"
33   }, {
34       browserName: "opera",
35       platform: "Windows 2008",
36       version: "12"
37   }, {
38       browserName: "safari",
39       platform: "OS X 10.8",
40       version: "6"
41   }];
42
43   var tags = [];
44   if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST != "false") {
45     tags.push("pr" + process.env.TRAVIS_PULL_REQUEST);
46   } else if (process.env.TRAVIS_BRANCH) {
47     tags.push(process.env.TRAVIS_BRANCH);
48   }
49
50   grunt.initConfig({
51       connect: {
52           server: {
53               options: {
54                   base: "",
55                   port: 9999
56               }
57           }
58       },
59       'saucelabs-qunit': {
60           all: {
61               options: {
62                   urls: ["http://127.0.0.1:9999/test/index.html"],
63                   tunnelTimeout: 5,
64                   build: process.env.TRAVIS_JOB_ID,
65                   concurrency: 3,
66                   browsers: browsers,
67                   testname: "qunit tests",
68                   tags: tags
69               }
70           }
71       },
72       jshint: {
73             options: {
74                 jshintrc: "./.jshintrc"
75             },
76             all: ['./lib/*.js']
77         },
78     browserify: {
79       all: {
80         files: {
81           'dist/jszip.js': ['lib/index.js']
82         },
83         options: {
84           bundleOptions: {
85             standalone: 'JSZip',
86             insertGlobalVars : {
87               Buffer: function () {
88                 // instead of the full polyfill, we just use the raw value
89                 // (or undefined).
90                 return '(typeof Buffer !== "undefined" ? Buffer : undefined)';
91               }
92             }
93           },
94           postBundleCB: function(err, src, done) {
95             // add the license
96             var license = require('fs').readFileSync('lib/license_header.js');
97             // remove the source mapping of zlib.js, see #75
98             var srcWithoutSourceMapping = src.replace(/\/\/@ sourceMappingURL=raw..flate.min.js.map/g, '');
99             done(err, license + srcWithoutSourceMapping);
100           }
101         }
102       }
103     },
104     uglify: {
105       options: {
106         report: 'gzip',
107         mangle: true,
108         preserveComments: 'some'
109       },
110       all: {
111         src: 'dist/jszip.js',
112         dest: 'dist/jszip.min.js'
113       }
114     }
115   });
116
117   grunt.loadNpmTasks("grunt-saucelabs");
118   grunt.loadNpmTasks("grunt-contrib-connect");
119   grunt.loadNpmTasks('grunt-browserify');
120   grunt.loadNpmTasks('grunt-contrib-jshint');
121   grunt.loadNpmTasks('grunt-contrib-uglify');
122
123   if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
124     grunt.registerTask("test", ["connect", "saucelabs-qunit"]);
125   } else {
126     grunt.registerTask("test", []);
127   }
128   grunt.registerTask("build", ["browserify", "uglify"]);
129   grunt.registerTask("default", ["jshint", "build"]);
130 };