blob: dd6406b7e0f336740879ece827f4cfb1682412bc [file] [log] [blame]
Henrique Mendonça095ddb72013-09-20 19:38:03 +02001//To build dist/thrift.js, dist/thrift.min.js and doc/*
2//run grunt at the command line in this directory.
3//Prerequisites:
4// Node Setup - nodejs.org
5// Grunt Setup - npm install //reads the ./package.json and installs project dependencies
6
7module.exports = function(grunt) {
8 'use strict';
9
10 grunt.initConfig({
11 pkg: grunt.file.readJSON('package.json'),
12 concat: {
13 options: {
14 separator: ';'
15 },
16 dist: {
17 src: ['src/**/*.js'],
18 dest: 'dist/<%= pkg.name %>.js'
19 }
20 },
21 jsdoc : {
22 dist : {
23 src: ['src/*.js', './README'],
24 options: {
25 destination: 'doc'
26 }
27 }
28 },
29 uglify: {
30 options: {
31 banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
32 },
33 dist: {
34 files: {
35 'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
36 }
37 }
38 },
39 qunit: {
40 all: {
41 options: {
42 urls: [
43 'http://localhost:8088/test.html'
44 ]
45 }
46 }
47 },
48 jshint: {
49 files: ['Gruntfile.js', 'src/**/*.js', 'test/*.js'],
50 options: {
51 // options here to override JSHint defaults
52 globals: {
53 jQuery: true,
54 console: true,
55 module: true,
56 document: true
57 }
58 }
59 },
60 });
61
62 grunt.loadNpmTasks('grunt-contrib-uglify');
63 grunt.loadNpmTasks('grunt-contrib-jshint');
64 grunt.loadNpmTasks('grunt-contrib-qunit');
65 grunt.loadNpmTasks('grunt-contrib-concat');
66 grunt.loadNpmTasks('grunt-jsdoc');
67
68 grunt.registerTask('test', ['jshint', 'qunit']);
69 grunt.registerTask('default', ['jshint', 'qunit', 'concat', 'uglify', 'jsdoc']);
70};