Skip to content

Commit eaa50ad

Browse files
committed
splitting box code in parts, make NodeJS module and add basic test
1 parent 7db8190 commit eaa50ad

12 files changed

+1311
-1264
lines changed

.npmignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.gitignore
2+
.htaccess
3+
*.mp4
4+
node_modules/
5+
test/

Gruntfile.js

+35-7
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,43 @@ module.exports = function(grunt) {
66
options: {
77
separator: ';'
88
},
9-
dist: {
10-
src: ['src/**/*.js'],
11-
dest: 'dist/<%= pkg.name %>.js'
9+
all: {
10+
src: ['src/log.js', // logging system
11+
'src/DataStream.js', // bit/byte/string read-write operations
12+
'src/descriptor.js', // MPEG-4 descriptor parsing
13+
'src/box.js', // base code for box parsing/writing
14+
'src/box-parse.js', // box parsing code
15+
'src/box-write.js', // box writing code
16+
'src/box-unpack.js', // box code for sample manipulation
17+
'src/mp4-text.js', // text-based track manipulations
18+
'src/isofile.js', // file level operations (read, write)
19+
'src/mp4box.js' // application level operations (data append, sample extraction, segmentation, ...)
20+
],
21+
dest: 'dist/<%= pkg.name %>.all.js'
22+
},
23+
simple: {
24+
src: ['src/log.js', // logging system
25+
'src/DataStream.js', // bit/byte/string read-write operations
26+
'src/box.js', // base code for box parsing/writing
27+
'src/box-parse.js', // box parsing code
28+
'src/isofile.js', // file level operations (read, write)
29+
'src/mp4box.js' // application level operations (data append, sample extraction, segmentation, ...)
30+
],
31+
dest: 'dist/<%= pkg.name %>.simple.js'
1232
}
1333
},
1434
uglify: {
1535
options: {
1636
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
1737
},
18-
dist: {
38+
all: {
1939
files: {
20-
'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
40+
'dist/<%= pkg.name %>.all.min.js': ['<%= concat.all.dest %>']
41+
}
42+
},
43+
simple: {
44+
files: {
45+
'dist/<%= pkg.name %>.simple.min.js': ['<%= concat.simple.dest %>']
2146
}
2247
}
2348
},
@@ -39,7 +64,7 @@ module.exports = function(grunt) {
3964
}
4065
},
4166
jshint: {
42-
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js', '!test/lib/**/*.js'],
67+
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js', '!test/lib/**/*.js' , '!test/mp4/**/*.js'],
4368
options: {
4469
// options here to override JSHint defaults
4570
eqeqeq: false,
@@ -65,6 +90,9 @@ module.exports = function(grunt) {
6590

6691
grunt.registerTask('test', ['jshint', 'connect', 'qunit']);
6792

68-
grunt.registerTask('default', [ 'jshint', 'concat', 'uglify']);
93+
grunt.registerTask('all', [ 'concat:all', 'uglify:all']);
94+
grunt.registerTask('simple', [ 'concat:simple', 'uglify:simple']);
95+
96+
grunt.registerTask('default', [ 'jshint', 'all', 'simple']);
6997

7098
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"streaming"
99
],
1010
"homepage": "https://github.com/gpac/mp4box.js",
11-
"main": "src/mp4box.js",
11+
"main": "dist/mp4box.all.js",
1212
"repository": {
1313
"type": "git",
1414
"url": "https://github.com/gpac/mp4box.js.git"

0 commit comments

Comments
 (0)