forked from RusticiSoftware/TinCanJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
executable file
·112 lines (108 loc) · 2.79 KB
/
build.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
#!/usr/bin/env node
var gear = require('gear');
new gear.Queue(
{
registry: new gear.Registry(
{
module: 'gear-lib'
}
)
}
)
.log("Reading")
.read(
[
'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'
]
)
.log("Linting")
.jslint(
{
config: {
white: true,
nomen: true,
passfail: false,
// for predefined environments
devel: true, // to get console, alert defined
browser: true,
node: true,
es5: false,
// predefined globals
predef: [
"TinCan", "XDomainRequest"
]
},
callback: function (linted) {
var messages = linted.jslint || [],
counter = 0
;
if (messages.length) {
console.log(' ' + linted.name + ' contains ' + messages.length + ' lint errors');
messages.forEach(
function (item) {
if (item && item.reason) {
counter += 1;
console.log(' #' + counter + ': ' + item.reason);
if (item.evidence) {
console.log(' ' + String(item.evidence).trim() + (' // line ' + item.line + ', pos ' + item.character));
}
}
}
)
}
else {
console.log(' ' + linted.name + ' lint free!');
}
}
}
)
.read(
[
'vendor/cryptojs-v3.0.2/rollups/sha1.js',
'vendor/cryptojs-v3.0.2/components/enc-base64.js'
]
)
.log("Concating")
.concat()
.log("Writing raw")
.write('build/tincan.js')
.log("Minifying")
.jsminify(
{
callback: function (e) {
console.log('compression failed: ' + e.message);
},
config: {
mangle: true,
squeeze: true,
semicolon: false,
lift_vars: true,
mangle_toplevel: true,
no_mangle_functions: true,
max_line_length: 6000
}
}
)
.log("Writing min")
.write('build/tincan-min.js')
.run();