mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
59 lines
1.8 KiB
JavaScript
Executable File
59 lines
1.8 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* Socket.IO client
|
|
*
|
|
* @author Guillermo Rauch <guillermo@learnboost.com>
|
|
* @license The MIT license.
|
|
* @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com>
|
|
*/
|
|
|
|
/*
|
|
* This file will help you take all the Socket.IO client files and build socket.io.js.
|
|
* You can later use Google Closure Compiler on it.
|
|
*/
|
|
|
|
var fs = require('fs'),
|
|
socket = require('../lib/io'),
|
|
jsp = require('../lib/vendor/uglifyjs/lib/parse-js'),
|
|
pro = require("../lib/vendor/uglifyjs/lib/process"),
|
|
ast,
|
|
files = [
|
|
'io.js',
|
|
'util.js',
|
|
'transport.js',
|
|
'transports/xhr.js',
|
|
'transports/websocket.js',
|
|
'transports/flashsocket.js',
|
|
'transports/htmlfile.js',
|
|
'transports/xhr-multipart.js',
|
|
'transports/xhr-polling.js',
|
|
'transports/jsonp-polling.js',
|
|
'socket.js',
|
|
'vendor/web-socket-js/swfobject.js',
|
|
'vendor/web-socket-js/web_socket.js'
|
|
],
|
|
content = "/** Socket.IO "+ socket.io.version +" - Built with build.js */\n",
|
|
license = "/* Socket.IO.min "+ socket.io.version +" @author Guillermo Rauch <guillermo@learnboost.com>, @license The MIT license., @copyright Copyright (c) 2010 LearnBoost <dev@learnboost.com> */\n";
|
|
|
|
console.log('Reading files…');
|
|
|
|
files.forEach(function(file){
|
|
var path = __dirname + '/../lib/' + file;
|
|
console.log(' + ' + path);
|
|
content += fs.readFileSync(path) + "\n";
|
|
});
|
|
|
|
console.log('Generating…');
|
|
|
|
fs.write(fs.openSync(__dirname + '/../socket.io.js', 'w'), content, 0, 'utf8');
|
|
console.log(' + ' + __dirname + '/../socket.io.js');
|
|
|
|
console.log('Uglyfying…');
|
|
ast = jsp.parse(content);
|
|
ast = pro.ast_mangle(ast); // get a new AST with mangled names
|
|
ast = pro.ast_squeeze(ast);
|
|
fs.write(fs.openSync(__dirname + '/../socket.io.min.js', 'w'), license + pro.gen_code(ast), 0, 'utf8');
|
|
console.log(' + ' + __dirname + '/../socket.io.min.js');
|
|
|
|
console.log('All done!'); |