UNPKG

3.06 kBJavaScriptView Raw
1module.exports = function (grunt) {
2 require('load-grunt-tasks')(grunt);
3 grunt.initConfig({
4 license: { name: 'MIT', url: 'https://raw.githubusercontent.com/LouisT/MapQL/master/LICENSE' },
5 pkg: grunt.file.readJSON('package.json'),
6 banner: '/*!\n * MapQL v<%= pkg.version %> - <%= pkg.description %> - Copyright (c) 2017 <%= pkg.author.name %>' +
7 ' (<%= pkg.author.web %>)\n * Licensed under the <%= license.name %> license - <%= license.url %>' +
8 '\n * Updated on <%= grunt.template.today("dd-mm-yyyy") %> at <%= grunt.template.today("HH:mm:ss") %>\n */',
9 clean: {
10 default: ['dist/*']
11 },
12 browserify: {
13 default: {
14 files: {
15 'dist/MapQL.es6.js': ['./index.js'],
16 'dist/MapQL.es6.chainable.js': ['./chainable/index.js']
17 }
18 },
19 babelify: {
20 options: {
21 transform: [[ 'babelify', {
22 presets: ['es2015'],
23 plugins: [
24 ["babel-plugin-transform-builtin-extend", {
25 globals: ["Array", "Map"]
26 }],
27 ["transform-runtime", {
28 polyfill: false,
29 regenerator: true
30 }]
31 ]
32 }]]
33 },
34 files: {
35 'dist/MapQL.es5.js': ['./transpile/polyfill.js'],
36 'dist/MapQL.es5.chainable.js': ['./transpile/chainable.js']
37 }
38 }
39 },
40 uglify: {
41 default: {
42 files: {
43 'dist/MapQL.es5.js': ['dist/MapQL.es5.js'],
44 'dist/MapQL.es5.chainable.js': ['dist/MapQL.es5.chainable.js']
45 }
46 }
47 },
48 comments: {
49 default: {
50 options: {
51 singleline: true,
52 multiline: true,
53 keepSpecialComments: false
54 },
55 src: ['dist/*.js']
56 }
57 },
58 usebanner: {
59 default: {
60 options: {
61 position: 'top',
62 banner: '<%= banner %>',
63 linebreak: true
64 },
65 files: {
66 src: ['dist/MapQL.es6.js', 'dist/MapQL.es5.js']
67 }
68 },
69 chainable: {
70 options: {
71 position: 'top',
72 banner: '<%= banner %>',
73 linebreak: true
74 },
75 files: {
76 src: ['dist/MapQL.es6.chainable.js', 'dist/MapQL.es5.chainable.js']
77 }
78 }
79 }
80 });
81 grunt.registerTask('default', ['clean', 'browserify:default', 'browserify:babelify', 'uglify', 'comments', 'usebanner']);
82};