forked from travist/jsencrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
101 lines (92 loc) · 2.26 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
95
96
97
98
99
100
101
module.exports = function(grunt) {
var files = [
'lib/jsbn/jsbn.js',
'lib/jsbn/jsbn2.js',
'lib/jsbn/prng4.js',
'lib/jsbn/rng.js',
'lib/jsbn/rsa.js',
'lib/jsbn/rsa2.js',
'lib/jsbn/rsa-async.js',
'lib/jsbn/base64.js',
'lib/jsrsasign/asn1-1.0.js',
'lib/asn1js/hex.js',
'lib/asn1js/base64.js',
'lib/asn1js/asn1.js',
'src/jsencrypt.js'
];
var lintFiles = [
'src/jsencrypt.js'
];
var licenses = [
'src/LICENSE.txt',
'lib/jsrsasign/LICENSE.txt',
'lib/jsbn/LICENSE.txt',
'lib/asn1js/LICENSE.txt'
];
// The code to wrap the generated files with.
var prefix = 'var JSEncryptExports = {};' + "\n";
prefix += '(function(exports) {' + "\n";
var suffix = 'exports.JSEncrypt = JSEncrypt;' + "\n";
suffix += '})(JSEncryptExports);' + "\n";
suffix += 'var JSEncrypt = JSEncryptExports.JSEncrypt;' + "\n";
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: ['Gruntfile.js'].concat(lintFiles)
},
concat: {
license: {
options: {
separator: "\n\n\n",
process: function(src, filepath) {
var output = 'File: ' + filepath;
output += "\n";
output += src;
return output;
}
},
files: {
'LICENSE.txt': licenses
}
},
js: {
options: {
banner: prefix,
separator: '',
footer: suffix
},
files: {
'bin/jsencrypt.js': files
}
}
},
uglify: {
options: {
banner: prefix,
footer: suffix
},
build: {
files: {
'bin/jsencrypt.min.js': files
}
}
},
jekyll: {
build: {
options: {
config: '_config.yml,_config.build.yml'
}
}
}
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-jekyll');
// Default task(s).
grunt.registerTask('default', ['jshint', 'concat', 'uglify']);
// Only run jekyll on a grunt build.
grunt.registerTask('build', ['jekyll']);
};