This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
92 lines (80 loc) · 2.07 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
'use strict';
const path = require('path');
// wrapper function for grunt configuration
module.exports = function(grunt) {
grunt.initConfig({
// read in the package information
pkg: grunt.file.readJSON('package.json'),
// grunt-eslint plugin configuration (lint for JS)
eslint: {
options: {
},
target: [
'Gruntfile.js',
'src/**/*.js',
'test/**/*.js'
]
},
// grunt-contrib-clean plugin configuration (clean up files)
clean: {
build: [
'dist/*',
'test/config/'
],
options: {
force: false
}
},
// grunt-mocha-test plugin configuration (unit testing)
mochaTest: {
test: {
options: {
reporter: 'spec',
timeout: 60000
},
src: [
'test/**/*.js'
]
}
},
// grunt-webpack plugin configuration (concatenates and removes whitespace)
webpack: {
clientConfig: {
target: 'web',
mode: 'development',
resolve: {
fallback: {
"os": false,
"fs": false,
"path": false,
"url": false,
"crypto": false
}
},
entry: './index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'lib-web.js',
library: 'notary'
}
},
serverConfig: {
target: 'node',
mode: 'development',
entry: './index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'lib-node.js',
library: 'notary'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-webpack');
grunt.registerTask('build', 'Build the module.', ['clean:build', 'eslint', 'mochaTest']);
grunt.registerTask('package', 'Package the libraries.', ['clean:build', 'eslint', 'webpack']);
grunt.registerTask('default', 'Default targets.', ['build']);
};