From 121b9fc090829c99c9631c67c4a83d4b68e05c69 Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 10:06:44 -0300 Subject: [PATCH 1/8] Fixes issues with errors --- .gitignore | 1 + lib/errors/build.js | 6 +++--- package.json | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 2d415e1..73f68bf 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ npm-debug.log apiref bower_components dist +report diff --git a/lib/errors/build.js b/lib/errors/build.js index 7130c0f..bb74176 100644 --- a/lib/errors/build.js +++ b/lib/errors/build.js @@ -14,10 +14,10 @@ var formatMessage = function(message) { var defineElement = function(fullName, baseClass, message) { return fullName + ' = function() {\n' + ' this.message = ' + formatMessage(message) + ';\n' + - ' ' + baseClass + '.call(this, this.message);\n' + - ' this.name = "' + fullName + '";\n' + + ' this.stack = (new Error()).stack;\n' + '};\n' + - 'inherits(' + fullName + ', ' + baseClass + ');\n\n'; + fullName + '.prototype = Object.create(' + baseClass + '.prototype);\n' + + fullName + '.prototype.name = "' + fullName + '";\n\n'; }; var traverseNode = function(baseClass, errorDefinition) { diff --git a/package.json b/package.json index 5ae6407..d377fee 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test": "gulp test-all", "coverage": "gulp coverage", "build": "gulp", - "postinstall": "node_modules/gulp/bin/gulp.js browser-all" + "postinstall": "node ./lib/errors/build.js" }, "contributors": [ { From f5d04280ebbacc924750fb1b44176003997e088e Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 10:09:18 -0300 Subject: [PATCH 2/8] Add lodash to shrinkwrap --- npm-shrinkwrap.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b619ac3..db5372d 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -49,6 +49,11 @@ } } }, + "lodash": { + "version": "2.4.1", + "from": "lodash@=2.4.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.1.tgz" + }, "sha512": { "version": "0.0.1", "from": "sha512@=0.0.1", From 9a57bd3748a2ffe04aa6d3ced58483d2dbdeacbb Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 10:09:48 -0300 Subject: [PATCH 3/8] Remove duplicate lodash dependency --- package.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/package.json b/package.json index d377fee..9dbb94c 100644 --- a/package.json +++ b/package.json @@ -91,14 +91,11 @@ "gulp-mocha": "^2.0.0", "gulp-rename": "^1.2.0", "gulp-shell": "^0.2.10", - "inherits": "^2.0.1", - "lodash": "^2.4.1", "mocha": "~2.0.1", "run-sequence": "^1.0.2", "karma": "^0.12.28", "karma-firefox-launcher": "^0.1.3", "karma-mocha": "^0.1.9", - "lodash": "^2.4.1", "mocha": "~2.0.1", "run-sequence": "^1.0.2" }, From 491170103b51487d78313f71c4ac1a6d998598f2 Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 10:18:33 -0300 Subject: [PATCH 4/8] Add inherits to shrinkwrap --- npm-shrinkwrap.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index db5372d..eb62ce9 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -38,6 +38,11 @@ } } }, + "inherits": { + "version": "2.0.1", + "from": "inherits@2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, "hash.js": { "version": "0.3.2", "from": "hash.js@0.3.2", From 3a0d6e8c89e2c6ff1e1281ad09118bbcd86b37af Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 10:20:39 -0300 Subject: [PATCH 5/8] Export window.bitcore for browsers --- gulpfile.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 142f8db..d199636 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -96,7 +96,8 @@ gulp.task('lint', function() { gulp.task('browser', ['errors'], function() { return gulp.src('index.js') .pipe(browserify({ - insertGlobals: true + insertGlobals: true, + standalone: 'bitcore' })) .pipe(rename('bitcore.js')) .pipe(gulp.dest('browser')); From efcb9ce08b0e64e0aa569aae11b1c355aaea6a3b Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 10:21:15 -0300 Subject: [PATCH 6/8] Change to use browser-all before karma --- gulpfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index d199636..aa98843 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -111,7 +111,7 @@ gulp.task('browser-all', ['errors'], function(callback) { runSequence(['browser'], ['browser-test'], callback); }); -gulp.task('karma', ['browser-test'], testKarma); +gulp.task('karma', ['browser-all'], testKarma); gulp.task('errors', shell.task([ 'node ./lib/errors/build.js' From d29d8d267d7d2b07221b45bffb04f92fd5298ea3 Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 11:37:40 -0300 Subject: [PATCH 7/8] Add message to stack --- lib/errors/build.js | 2 +- lib/errors/spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/errors/build.js b/lib/errors/build.js index bb74176..cbd44f9 100644 --- a/lib/errors/build.js +++ b/lib/errors/build.js @@ -14,7 +14,7 @@ var formatMessage = function(message) { var defineElement = function(fullName, baseClass, message) { return fullName + ' = function() {\n' + ' this.message = ' + formatMessage(message) + ';\n' + - ' this.stack = (new Error()).stack;\n' + + ' this.stack = this.message + \'\\n\' + (new Error()).stack;\n' + '};\n' + fullName + '.prototype = Object.create(' + baseClass + '.prototype);\n' + fullName + '.prototype.name = "' + fullName + '";\n\n'; diff --git a/lib/errors/spec.js b/lib/errors/spec.js index cc3f1b9..6a0453b 100644 --- a/lib/errors/spec.js +++ b/lib/errors/spec.js @@ -4,7 +4,7 @@ module.exports = [{ errors: [ { name: 'InvalidArgument', - message: 'HDPrivateKey: Invalid Argument {0}, expected {1} but got {2}', + message: 'Invalid Argument {0}, expected {1} but got {2}', errors: [{ name: 'InvalidB58Char', message: 'Invalid Base58 character: {0} in {1}' @@ -48,7 +48,7 @@ module.exports = [{ errors: [ { name: 'InvalidArgument', - message: 'HDPublicKey: Invalid Argument {0}, expected {1} but got {2}', + message: 'Invalid Argument {0}, expected {1} but got {2}', errors: [{ name: 'ArgumentIsPrivateExtended', message: 'Argument is an extended private key: {0}' From 70795ec9a69e75d3cbacb43150dd1781a8512e06 Mon Sep 17 00:00:00 2001 From: Esteban Ordano Date: Wed, 3 Dec 2014 17:26:31 -0300 Subject: [PATCH 8/8] Revert gulp delete --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9dbb94c..9b56679 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "test": "gulp test-all", "coverage": "gulp coverage", "build": "gulp", - "postinstall": "node ./lib/errors/build.js" + "postinstall": "node_modules/gulp/bin/gulp.js browser-all" }, "contributors": [ {