Added JS build script.

This commit is contained in:
Stefan Thomas
2012-11-07 12:49:17 -08:00
parent fa3fab5816
commit f4d951cd67
7 changed files with 70 additions and 9 deletions

8
.gitignore vendored
View File

@@ -14,13 +14,7 @@
# Ignore object files.
*.o
build/obj/*
build/proto/*
build/bin/rippled
build/rippled
# Ignore JavaScript build targets
build/ripple.js
build
# Ignore locally installed node_modules
node_modules

26
package.json Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "ripple",
"version": "0.7.0",
"description": "Open-source peer-to-peer payment network",
"directories": {
"test": "test"
},
"dependencies": {
"async": "~0.1.22",
"ws": "~0.4.22",
"extend": "~1.1.1"
},
"devDependencies": {
"buster": "~0.6.2",
"webpack": "~0.7.17"
},
"scripts": {
"test": "buster test"
},
"repository": {
"type": "git",
"url": "git://github.com/jedmccaleb/NewCoin.git"
},
"readmeFilename": "README"
}

View File

@@ -7,7 +7,7 @@ var utils = require('./utils.js');
var jsbn = require('./jsbn.js');
// Don't include in browser context.
var config = require('../test/config.js');
var config = require('../../test/config.js');
var BigInteger = jsbn.BigInteger;
var nbi = jsbn.nbi;

View File

@@ -22,7 +22,7 @@ var Amount = require('./amount.js').Amount;
var UInt160 = require('./amount.js').UInt160;
// Don't include in browser context.
var config = require('../test/config.js');
var config = require('../../test/config.js');
// Request events emmitted:
// 'success' : Request successful.

1
web_modules/domain.js Normal file
View File

@@ -0,0 +1 @@
module.exports = null;

1
web_modules/ws.js Normal file
View File

@@ -0,0 +1 @@
module.exports = WebSocket;

39
webpack.js Normal file
View File

@@ -0,0 +1,39 @@
var pkg = require('./package.json');
var webpack = require("webpack");
var async = require("async");
var extend = require("extend");
var programPath = __dirname + "/src/js/remote.js";
console.log('Compiling Ripple JavaScript...');
var builds = [{
filename: 'ripple-'+pkg.version+'.js',
},{
filename: 'ripple-'+pkg.version+'-debug.js',
debug: true
},{
filename: 'ripple-'+pkg.version+'-min.js',
minimize: true
}];
async.series(builds.map(build), function (err) {
if (err) {
console.error(err);
}
});
var defaultOpts = {
library: 'ripple',
};
function build(opts) {
var opts = extend({}, defaultOpts, opts);
opts.output = __dirname + "/build/"+opts.filename;
return function (callback) {
var filename = opts.filename;
webpack(programPath, opts, function (err, result) {
console.log(' '+filename, result.hash, '['+result.modulesCount+']');
callback(err);
});
}
}