|
@@ -20,8 +20,11 @@ function main() {
|
|
var args = parser.parseArgs();
|
|
var args = parser.parseArgs();
|
|
|
|
|
|
var output = args.output;
|
|
var output = args.output;
|
|
- console.log(' * Building ' + output);
|
|
|
|
|
|
+
|
|
|
|
+ console.log('Building ' + output + ':');
|
|
|
|
|
|
|
|
+ var startMS = Date.now();
|
|
|
|
+
|
|
var sourcemap = '';
|
|
var sourcemap = '';
|
|
var sourcemapping = '';
|
|
var sourcemapping = '';
|
|
|
|
|
|
@@ -39,6 +42,8 @@ function main() {
|
|
buffer.push('function ( root, factory ) {\n\n\tif ( typeof define === \'function\' && define.amd ) {\n\n\t\tdefine( [ \'exports\' ], factory );\n\n\t} else if ( typeof exports === \'object\' ) {\n\n\t\tfactory( exports );\n\n\t} else {\n\n\t\tfactory( root );\n\n\t}\n\n}( this, function ( exports ) {\n\n');
|
|
buffer.push('function ( root, factory ) {\n\n\tif ( typeof define === \'function\' && define.amd ) {\n\n\t\tdefine( [ \'exports\' ], factory );\n\n\t} else if ( typeof exports === \'object\' ) {\n\n\t\tfactory( exports );\n\n\t} else {\n\n\t\tfactory( root );\n\n\t}\n\n}( this, function ( exports ) {\n\n');
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ console.log( ' Collecting source files.' );
|
|
|
|
+
|
|
for ( var i = 0; i < args.include.length; i ++ ){
|
|
for ( var i = 0; i < args.include.length; i ++ ){
|
|
|
|
|
|
var contents = fs.readFileSync( './includes/' + args.include[i] + '.json', 'utf8' );
|
|
var contents = fs.readFileSync( './includes/' + args.include[i] + '.json', 'utf8' );
|
|
@@ -76,10 +81,14 @@ function main() {
|
|
|
|
|
|
if ( !args.minify ){
|
|
if ( !args.minify ){
|
|
|
|
|
|
|
|
+ console.log( ' Writing output.' );
|
|
|
|
+
|
|
fs.writeFileSync( output, temp, 'utf8' );
|
|
fs.writeFileSync( output, temp, 'utf8' );
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
|
|
+ console.log( ' Uglyifying.' );
|
|
|
|
+
|
|
var LICENSE = "threejs.org/license";
|
|
var LICENSE = "threejs.org/license";
|
|
|
|
|
|
// Parsing
|
|
// Parsing
|
|
@@ -125,16 +134,23 @@ function main() {
|
|
compressed_ast.print( stream );
|
|
compressed_ast.print( stream );
|
|
var code = stream.toString();
|
|
var code = stream.toString();
|
|
|
|
|
|
|
|
+ console.log( ' Writing output.' );
|
|
|
|
+
|
|
fs.writeFileSync( output, code + sourcemapping, 'utf8' );
|
|
fs.writeFileSync( output, code + sourcemapping, 'utf8' );
|
|
|
|
|
|
if ( args.sourcemaps ) {
|
|
if ( args.sourcemaps ) {
|
|
|
|
|
|
|
|
+ console.log( ' Writing source map.' );
|
|
|
|
+
|
|
fs.writeFileSync( sourcemap, source_map.toString(), 'utf8' );
|
|
fs.writeFileSync( sourcemap, source_map.toString(), 'utf8' );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ var deltaMS = Date.now() - startMS;
|
|
|
|
+ console.log( " --- Build time: " + ( deltaMS / 1000 ) + "s" );
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
main();
|
|
main();
|