This repository has been archived by the owner on Nov 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
70 lines (56 loc) · 1.32 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
// vim: et sw=2 ts=2
/* global module, require */
const fs = require('fs');
const path = require('path');
function assert_exists(file) {
if (!fs.existsSync(file)) {
throw new Error(`File not found: ${file}`);
}
return file;
}
function add_prefix(left, right) {
return assert_exists(path.join(left, right));
}
module.exports = function(grunt) {
'use strict';
const dist = 'dist';
const pkg = grunt.file.readJSON('package.json');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.initConfig({
pkg,
concat: {
app_deps: {
src: [
"../node_modules/ifrpc/src/ifrpc.js",
"client.js",
"idb.js",
].map(x => add_prefix('src', x)),
dest: `${dist}/forsta-messenger-client.js`
}
},
uglify: {
options: {
mangle: {
safari10: true,
keep_fnames: true
},
compress: {
unused: false,
keep_fnames: true
},
output: {
max_line_len: 1000,
safari10: true
}
},
lib: {
files: [{
src: `${dist}/forsta-messenger-client.js`,
dest: `${dist}/forsta-messenger-client.min.js`
}]
}
}
});
grunt.registerTask('default', ['concat', 'uglify']);
};