-
Notifications
You must be signed in to change notification settings - Fork 115
/
Gruntfile.js
152 lines (141 loc) · 5.04 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*global module:false*/
module.exports = function(grunt) {
"use strict";
var coreFileList = [
"vendor/cryptojs-v3.1.2/rollups/sha1.js",
"vendor/cryptojs-v3.1.2/rollups/sha256.js",
"vendor/cryptojs-v3.1.2/components/enc-base64.js",
"vendor/cryptojs-v3.1.2/components/lib-typedarrays.js",
"src/TinCan.js",
"src/Utils.js",
"src/LRS.js",
"src/AgentAccount.js",
"src/Agent.js",
"src/Group.js",
"src/Verb.js",
"src/Result.js",
"src/Score.js",
"src/InteractionComponent.js",
"src/ActivityDefinition.js",
"src/Activity.js",
"src/ContextActivities.js",
"src/Context.js",
"src/StatementRef.js",
"src/SubStatement.js",
"src/Statement.js",
"src/StatementsResult.js",
"src/State.js",
"src/ActivityProfile.js",
"src/AgentProfile.js",
"src/About.js",
"src/Attachment.js"
],
browserFileList = coreFileList.slice(),
nodeFileList = coreFileList.slice(),
pkg,
bower;
browserFileList.push(
"src/Environment/Browser.js",
// needed because IE10 doesn't support Uint8ClampedArray
// which is required by CryptoJS for typedarray support
"node_modules/js-polyfills/typedarray.js",
// needed because IE10 doesn't have ArrayBuffer slice
"node_modules/arraybuffer-slice/index.js",
// needed for IE and Safari for TextDecoder/TextEncoder
"node_modules/text-encoding/lib/encoding.js"
);
nodeFileList.push(
"src/Environment/Node.js"
);
pkg = grunt.file.readJSON("package.json");
bower = grunt.file.readJSON("bower.json");
if (pkg.version !== bower.version) {
grunt.fail.fatal("package.json and bower.json versions do not match");
}
// Project configuration.
grunt.initConfig({
pkg: pkg,
watch: {
files: ["src/**/*.js"],
tasks: ["build"],
options: {
interrupt: true
}
},
jshint: {
all: ["Gruntfile.js", "src/**/*.js"],
options: {
bitwise: true,
es3: true, // must use ES3 syntax (support for IE6/7/8/9)
curly: true, // Always use curlys {}
eqeqeq: true, // No more == for you, === only
forin: true,
freeze: true,
immed: true, // prohibits the use of immediate function invocations without wrapping them in parentheses
indent: 4, // force tab width of 4 spaces
latedef: true, // no setting variables before they are defined
newcap: true, // Always call constructors with a Cap
noarg: true, // prohibits arguments.caller and arguments.callee
noempty: true, // prevent empty blocks
nonbsp: true,
nonew: true, // don't allow non-captured constructor use
plusplus: true, // prevent use of ++ and --
quotmark: "double", // require strings to be double quoted
undef: true, // prohibits the use of explicitly undeclared variables
unused: true, // Warns on unused variables
trailing: true, // Prohibits trailing whitespace
maxdepth: 6, // Max nesting of methods 6 layers deep
onevar: true,
strict: true,
globals: {
TinCan: true,
JSON: true
}
}
},
concat: {
options: {
banner: "\"<%= pkg.version %>\";\n"
},
dist: {
files: {
"build/tincan.js": browserFileList,
"build/tincan-node.js": nodeFileList
},
nonull: true
}
},
uglify: {
dist: {
files: {
"build/tincan-min.js": ["build/tincan.js"]
},
options: {
sourceMap: true
}
}
},
yuidoc: {
compile: {
version: "<%= pkg.version %>",
name: "TinCanJS",
description: "Library for working with the Experience API (Tin Can API) in JavaScript",
url: "http://rusticisoftware.github.com/TinCanJS/",
options: {
paths: "src/",
outdir: "doc/api/"
},
logo: "http://cdn4.tincanapi.com/wp-content/themes/tincanapi/images/logo.png"
}
}
});
// Load Tasks
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-yuidoc");
// Define tasks
grunt.registerTask("build", ["jshint", "concat", "uglify"]);
grunt.registerTask("default", "build");
};