forked from sagold/js-viewpane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
101 lines (79 loc) · 2.51 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
"use strict";
var webpack = require("webpack");
module.exports = function (grunt) {
var webpackServerConfig = require("./webpack.config");
grunt.initConfig({
// ERROR:
// Running "webpack-dev-server:context" (webpack-dev-server) task
// Warning: Object.keys called on non-object Use --force to continue.
"webpack-dev-server": webpackServerConfig,
"webpack": {
// common settings
"options": webpackServerConfig,
// specific settings and overrides
"dist": {
output: {
path: "dist/",
filename: "viewpane.js",
// libraryTarget: "var",
library: "Viewpane"
},
devtool: null,
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
drop_console: true,
unsafe: true
}
})
]
}
},
"mochaTest": {
"unit": {
options: {
reporter: "spec",
quiet: false,
clearRequireCache: true,
require: ["babel-core/register"]
},
src: ["test/unit/**/*.test.js"]
}
},
"watch": {
"unit": {
files: ["lib/**/*.js", "test/unit/**/*.test.js"],
tasks: ["mochaTest:unit"],
options: {
spawn: true
},
},
},
"karma": {
"options": {
configFile: "karma.conf.js",
browsers: ["Chrome"]
},
"test": {
singleRun: true,
autoWatch: false
},
"tdd": {
singleRun: true,
autoWatch: false
}
}
});
// grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-webpack");
grunt.loadNpmTasks("grunt-mocha-test");
grunt.loadNpmTasks("grunt-karma");
grunt.loadNpmTasks("grunt-contrib-watch");
// test
grunt.registerTask("test", "mochaTest:unit");
grunt.registerTask("tdd", "watch:unit");
grunt.registerTask("test-browser", "karma:test");
// build
grunt.registerTask("dist", "webpack:dist");
grunt.registerTask("serve", "webpack-dev-server");
};