-
Notifications
You must be signed in to change notification settings - Fork 9
/
Gruntfile.js
103 lines (99 loc) · 3.13 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
102
103
module.exports = function(grunt) {
var webpack = require("webpack");
var webpackConfig = require("./webpack.config.js");
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
webpack: {
options: webpackConfig,
build: {
plugins: webpackConfig.plugins.concat(
new webpack.DefinePlugin({
"process.env": {
// This has effect on the react lib size
"NODE_ENV": JSON.stringify("production")
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin()
)
},
"build-dev": {
devtool: "sourcemap",
debug: true
}
},
"webpack-dev-server": {
options: {
webpack: webpackConfig
},
start: {
keepAlive: true,
port: 8089,
contentBase: "app",
hot: true,
webpack: {
devtool: "eval",
debug: true,
entry: webpackConfig.entry.concat(
"webpack-dev-server/client?http://localhost:8089",
"webpack/hot/dev-server"
),
plugins: webpackConfig.plugins.concat(
new webpack.HotModuleReplacementPlugin()
)
}
}
},
jshint: {
// define the files to lint
files: ['Gruntfile.js', 'webpack.config.js', 'app/**/*.js', 'app/**/*.jsx'],
// configure JSHint (documented at http://www.jshint.com/docs/)
options: {
// more options here if you want to override JSHint defaults
browser: true,
globals: {
jQuery: true,
console: true,
module: true,
require: true,
/* jest */
afterEach: false,
beforeEach: false,
describe: false,
expect: false,
it: false,
jest: false,
pit: false,
xdescribe: false,
xit: false
},
"undef": true,
"unused": true
}
},
watch: {
app: {
files: ["app/**/*"],
tasks: ["jshint", "jest", "webpack:build-dev"],
options: {
spawn: false,
}
}
},
"gh-pages": {
options: {
base: 'app'
},
src: ['**']
}
});
grunt.loadNpmTasks('grunt-jest');
grunt.loadNpmTasks('grunt-jsxhint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-webpack');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.registerTask("default", ["webpack-dev-server:start"]);
grunt.registerTask("dev", ["jshint", "jest", "webpack:build-dev", "watch:app"]);
grunt.registerTask("build", ["jshint", "webpack:build"]);
grunt.registerTask("publish", ["build", "gh-pages"]);
};