From a702f0941fe35cf35c775b073fa6ad987219bc28 Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 05:50:10 -0300 Subject: [PATCH 1/8] added raphael as a dependency in package.json --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index d3afe18..e840372 100644 --- a/package.json +++ b/package.json @@ -30,5 +30,8 @@ "bugs": { "url": "https://github.com/toorshia/justgage/issues" }, + "dependencies": { + "raphael":"" + }, "homepage": "https://github.com/toorshia/justgage" } From 9455c88b5d103609b035c0035fee2b6452adb21b Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 05:52:10 -0300 Subject: [PATCH 2/8] justgauge.js now imports raphael and exports itself as a module --- justgage.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/justgage.js b/justgage.js index 3b6d514..43ac05d 100644 --- a/justgage.js +++ b/justgage.js @@ -5,6 +5,13 @@ * @author Bojan Djuricic (@Toorshia) **/ + // am I in a commonJS environment? + if(typeof exports === "object" && exports) { + // yep, i will import raphael then + var Raphael = require('raphael'); + } + + JustGage = function(config) { var obj = this; @@ -1178,3 +1185,9 @@ function extend(out) { return out; }; + +// am I in a commonJS environment? +if(typeof exports === "object" && exports) { + // yep, i will export myself as a module. + module.exports = JustGage; +} From 5ab4013584c1447dc1c326df1802df58f8cfbce8 Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 06:04:36 -0300 Subject: [PATCH 3/8] index.js to standarize commonjs module --- index.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..46cf9e7 --- /dev/null +++ b/index.js @@ -0,0 +1,3 @@ +//this file is to export the module + + module.exports = require("justgage.js"); From cb63f3f797ad243567e26d8562ec48b27ef7df7b Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 06:07:25 -0300 Subject: [PATCH 4/8] export removed because it's now in index.js --- justgage.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/justgage.js b/justgage.js index 43ac05d..c108331 100644 --- a/justgage.js +++ b/justgage.js @@ -1186,8 +1186,4 @@ function extend(out) { return out; }; -// am I in a commonJS environment? -if(typeof exports === "object" && exports) { - // yep, i will export myself as a module. - module.exports = JustGage; -} + From d062a85b518aa4f1fa7bbe4be726ae12647db552 Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 06:10:08 -0300 Subject: [PATCH 5/8] main: now references index.js because i expect the user to be using commonjs by default If the user was using script tags then this will not matter at all. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e840372..ee67cc0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "justgage", "version": "1.2.2", "description": "JustGage is a handy JavaScript plugin for generating and animating nice & clean gauges. It is based on Raphaël library for vector drawing, so it’s completely resolution independent and self-adjusting.", - "main": "justgage.js", + "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, From 7231c7517309334d71f2ac635a103f53a5e76f23 Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 06:15:15 -0300 Subject: [PATCH 6/8] fixed route --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 46cf9e7..a1f6908 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,3 @@ //this file is to export the module - module.exports = require("justgage.js"); + module.exports = require("./justgage.js"); From 1cf2444ab38988720f885d35b57795d1fc1d8d38 Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 06:21:21 -0300 Subject: [PATCH 7/8] actually I needed those exports --- justgage.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/justgage.js b/justgage.js index c108331..9911b58 100644 --- a/justgage.js +++ b/justgage.js @@ -5,12 +5,6 @@ * @author Bojan Djuricic (@Toorshia) **/ - // am I in a commonJS environment? - if(typeof exports === "object" && exports) { - // yep, i will import raphael then - var Raphael = require('raphael'); - } - JustGage = function(config) { @@ -1186,4 +1180,11 @@ function extend(out) { return out; }; +-// am I in a commonJS environment? + + -if(typeof exports === "object" && exports) { + // let's import raphael then + var Raphael = require('raphael'); + - // and i will export myself as a module. + - module.exports = JustGage; + -} From a1674e3a2c63d710d9367ff4afa7c80fea80fdae Mon Sep 17 00:00:00 2001 From: martov1 Date: Thu, 20 Oct 2016 06:23:49 -0300 Subject: [PATCH 8/8] removed silly typho --- justgage.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/justgage.js b/justgage.js index 9911b58..45e227f 100644 --- a/justgage.js +++ b/justgage.js @@ -1180,11 +1180,11 @@ function extend(out) { return out; }; --// am I in a commonJS environment? + - -if(typeof exports === "object" && exports) { - // let's import raphael then - var Raphael = require('raphael'); - - // and i will export myself as a module. - - module.exports = JustGage; - -} +// am I in a commonJS environment? + +if(typeof exports === "object" && exports) { + // let's import raphael then + var Raphael = require('raphael'); + // and i will export myself as a module. + module.exports = JustGage; + }