forked from mervick/aes-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·94 lines (87 loc) · 2.9 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
* Gruntfile.js
* @author Andrey Izman <izmanw@gmail.com>
* @copyright Andrey Izman (c) 2018
* @license MIT
*/
/* jshint node: true */
'use strict';
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: function() {
const dateFormat = require("dateformat");
const path = 'javascript/';
const src = [
path + 'src/*.js'
];
const dest = path + 'dist/aes256.js';
const destMin = path + 'dist/aes256.min.js';
const year = (new Date()).getFullYear();
const banner =
'/*!\n' +
' * aes256.js v<%= pkg.version %>\n' +
' * @author Andrey Izman <izmanw@gmail.com>\n' +
' * @copyright Andrey Izman (c) ' + year + '\n' +
' * @license MIT\n' +
' */';
const paths = ['./node_modules', './javascript/src'];
const babelify = {
"presets" : ["es2015"],
};
return {
'watch': {
src: src,
dest: dest,
options: {
debug: true,
watch: true,
keepAlive: true,
banner: banner,
browserifyOptions: {
debug: true,
paths: paths
},
postBundleCB: function (err, src, next) {
grunt.log.writeln('');
grunt.log.writeln('Time: ' + dateFormat(new Date(), "h:MM:ss.l")['yellow']);
next(err, src);
}
},
transform: [
['babelify', babelify]
]
},
'build': {
src: src,
dest: dest,
options: {
banner: banner,
browserifyOptions: {
debug: false,
paths: paths
}
},
transform: [
['babelify', babelify]
]
},
'minify': {
src: src,
dest: destMin,
options: {
banner: banner,
browserifyOptions: {
paths: paths
}
},
transform: [
['babelify', babelify],
'uglifyify'
]
},
};
} ()
});
};