forked from sandflow/imscJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
116 lines (92 loc) · 4.14 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
module.exports = function (grunt) {
grunt.initConfig({
properties: grunt.file.readJSON('properties.json'),
pkg: grunt.file.readJSON('package.json'),
clean: ['<%= properties.webappBuildDir %>', '<%= properties.umdBuildDir %>'],
sync: {
all: {
files:
[
// copy tests
{ expand: true, cwd: '<%= properties.webappTestDir %>', src: '**', dest: '<%= properties.webappBuildDir %>' },
// copy tests resources
{ expand: true, cwd: '<%= properties.unitTestsResourcesDir %>', src: 'imsc-tests/imsc1/ttml/**', dest: '<%= properties.webappBuildDir %>' },
{ expand: true, cwd: '<%= properties.unitTestsResourcesDir %>', src: 'imsc-tests/imsc1/tests.json', dest: '<%= properties.webappBuildDir %>' },
{ expand: true, cwd: '<%= properties.unitTestsResourcesDir %>', src: 'imsc-tests/imsc1_1/ttml/**', dest: '<%= properties.webappBuildDir %>' },
{ expand: true, cwd: '<%= properties.unitTestsResourcesDir %>', src: 'imsc-tests/imsc1_1/tests.json', dest: '<%= properties.webappBuildDir %>' },
{ expand: true, cwd: '<%= properties.unitTestsResourcesDir %>', src: 'unit-tests/**', dest: '<%= properties.webappBuildDir %>' }
]
},
release: {
src: '<%= properties.umdBuildDir %>/<%= properties.umdMinName %>',
dest: '<%= properties.webappBuildDir %>/libs/imsc.js'
},
debug: {
src: '<%= properties.umdBuildDir %>/<%= properties.umdDebugName %>',
dest: '<%= properties.webappBuildDir %>/libs/imsc.js'
}
},
npmcopy: {
default: {
files: {
'<%= properties.webappBuildDir %>/libs/': [
'sax:main',
'qunit-assert-close:main',
'qunitjs:main',
'filesaver.js-npm:main',
'jszip/dist/jszip.js'
]
}
}
},
browserify: [
{
src: "<%= pkg.main %>",
dest: "<%= properties.umdBuildDir %>/<%= properties.umdDebugName %>",
options: {
exclude: ["sax"],
browserifyOptions: {
standalone: 'imsc'
}
}
},
{
src: "<%= pkg.main %>",
dest: "<%= properties.umdBuildDir %>/<%= properties.umdAllDebugName %>",
options: {
browserifyOptions: {
standalone: 'imsc'
}
}
}
],
jshint: {
'default': {
src: "src/main/js",
options: {
"-W032": true
}
}
},
exec: {
minify:
{
cmd: [
"npx google-closure-compiler --js=<%= properties.umdBuildDir %>/<%= properties.umdAllDebugName %> --js_output_file=<%= properties.umdBuildDir %>/<%= properties.umdAllMinName %>",
"npx google-closure-compiler --js=<%= properties.umdBuildDir %>/<%= properties.umdDebugName %> --js_output_file=<%= properties.umdBuildDir %>/<%= properties.umdMinName %>"
].join("&&")
}
}
}
);
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-npmcopy');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-sync');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('build:release', ['jshint', 'browserify', 'exec:minify', 'sync:all', 'sync:release', 'npmcopy']);
grunt.registerTask('build:debug', ['jshint', 'browserify', 'exec:minify', 'sync:all', 'sync:debug', 'npmcopy']);
grunt.registerTask('build', ['build:debug']);
grunt.registerTask('clean', ['clean']);
};