-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
104 lines (97 loc) · 3.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
102
103
104
// Declare dependencies
/* global module */
module.exports = function (grunt) {
var webpackConfig = require("./webpack.config");
"use strict";
// Project configuration.
grunt.initConfig({
// Project package file destination.
pkg: grunt.file.readJSON("package.json"),
eslint: {
all: ["src/**/*.js", "tests/**/*.js", "demos/**/*.js", "examples/**/*.js", "*.js", "!src/lib/**"]
},
jsonlint: {
all: ["package.json", ".jshintrc", "src/**/*.json", "tests/**/*.json", "demos/**/*.json", "!node_modules", "!src/lib/**", "!tests/lib/**"]
},
watch: {
src: {
files: ["src/**"],
tasks: ["copy:srcFiles", "webpack:dev"]
},
publications: {
files: ["pubs/**"],
tasks: ["copy:publications"]
}
},
webpack: {
dev: webpackConfig,
prod: Object.assign(webpackConfig, {mode: "production"})
},
copy: {
publications: {
files: [
{
expand: true,
cwd: "pubs",
src: "**",
dest: "target/pubs"
}
]
},
srcFiles: {
files: [
{
expand: true,
cwd: "src",
src: "**",
dest: "target"
}
]
},
demoLibraries: {
// TODO: some of these can be removed due to inclusion in webpack
files: [
{
expand: true,
cwd: "node_modules/infusion/dist",
src: "**",
dest: "target/lib/infusion/dist"
},
{
expand: true,
cwd: "node_modules/infusion/src",
src: "**",
dest: "target/lib/infusion/src"
},
{
expand: true,
cwd: "node_modules/figuration/dist",
src: "**",
dest: "target/lib/figuration"
},
{
expand: true,
cwd: "node_modules/mark.js/dist",
src: "jquery.mark.min.js",
dest: "target/lib/mark.js"
}
]
}
},
clean: {
target: "target/*"
}
});
// Load the plugin(s):
grunt.loadNpmTasks("fluid-grunt-eslint");
grunt.loadNpmTasks("grunt-jsonlint");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-webpack");
// Custom tasks:
grunt.registerTask("default", ["lint"]);
grunt.registerTask("lint", "Apply eslint and jsonlint", ["eslint", "jsonlint"]);
grunt.registerTask("build", "Create full application in target directory", ["clean:target", "copy:demoLibraries", "copy:publications", "copy:srcFiles", "webpack:dev"]);
grunt.registerTask("buildProd", "Create full application in target directory", ["clean:target", "copy:demoLibraries", "copy:publications", "copy:srcFiles", "webpack:prod"]);
};