From dc92b3ebfbb93782066ecc144e1f23d09c28584c Mon Sep 17 00:00:00 2001 From: Jakob Heuser Date: Sat, 30 Mar 2019 10:17:55 -0700 Subject: [PATCH 1/3] Make ElGrapho UMD friendly for node+webpack environments --- engine/src/ElGrapho.js | 7 +------ engine/src/ElGraphoCollection.js | 4 ---- engine/src/WebGL.js | 2 +- engine/src/models/ForceDirectedGraph.js | 3 --- webpack.config.js | 5 ++++- 5 files changed, 6 insertions(+), 15 deletions(-) diff --git a/engine/src/ElGrapho.js b/engine/src/ElGrapho.js index 995e4d3..788142a 100644 --- a/engine/src/ElGrapho.js +++ b/engine/src/ElGrapho.js @@ -5,8 +5,7 @@ const ElGraphoCollection = require('./ElGraphoCollection'); const Controls = require('./components/Controls/Controls'); const Count = require('./components/Count/Count'); const Events = require('./Events'); -const Concrete = require('../../../../concrete/build/concrete.js'); -//const Concrete = require('concretejs'); +const Concrete = require('concretejs'); const _ = require('lodash'); const Color = require('./Color'); const Theme = require('./Theme'); @@ -490,7 +489,3 @@ ElGrapho.models = { }; module.exports = ElGrapho; - -if (window) { - window.ElGrapho = ElGrapho; -} \ No newline at end of file diff --git a/engine/src/ElGraphoCollection.js b/engine/src/ElGraphoCollection.js index e26b67b..97f80f3 100644 --- a/engine/src/ElGraphoCollection.js +++ b/engine/src/ElGraphoCollection.js @@ -92,7 +92,3 @@ let ElGraphoCollection = { }; module.exports = ElGraphoCollection; - -if (window) { - window.ElGraphoCollection = ElGraphoCollection; -} \ No newline at end of file diff --git a/engine/src/WebGL.js b/engine/src/WebGL.js index 8e3d45d..4dfb1c9 100644 --- a/engine/src/WebGL.js +++ b/engine/src/WebGL.js @@ -1,6 +1,6 @@ const glMatrix = require('gl-matrix'); const mat4 = glMatrix.mat4; -const Concrete = require('../../../../concrete/build/concrete.js'); +const Concrete = require('concretejs'); const pointVert = require('../dist/shaders/point.vert'); const pointStrokeVert = require('../dist/shaders/pointStroke.vert'); const hitPointVert = require('../dist/shaders/hitPoint.vert'); diff --git a/engine/src/models/ForceDirectedGraph.js b/engine/src/models/ForceDirectedGraph.js index f6571c4..2509f74 100644 --- a/engine/src/models/ForceDirectedGraph.js +++ b/engine/src/models/ForceDirectedGraph.js @@ -142,9 +142,6 @@ const ForceDirectedGraph = function(config) { // } } - - console.log(model); - return model; }; diff --git a/webpack.config.js b/webpack.config.js index 420819d..0ef8788 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,7 +2,10 @@ module.exports = { entry: './engine/src/ElGrapho.js', output: { filename: 'ElGrapho.js', - path: __dirname + '/engine/dist' + path: __dirname + '/engine/dist', + library: 'ElGrapho', + libraryTarget: 'umd', + globalObject: 'typeof self !== \'undefined\' ? self : this' }, devtool: 'source-map', mode: 'development' // development or production From 374f1bc06fb0e20e267fde0c9b512c3c81f82e22 Mon Sep 17 00:00:00 2001 From: Jakob Heuser Date: Sat, 30 Mar 2019 10:21:15 -0700 Subject: [PATCH 2/3] using a preferred window detector instead of self --- webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 0ef8788..7574053 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,7 +5,7 @@ module.exports = { path: __dirname + '/engine/dist', library: 'ElGrapho', libraryTarget: 'umd', - globalObject: 'typeof self !== \'undefined\' ? self : this' + globalObject: 'typeof window !== \'undefined\' ? window : this' }, devtool: 'source-map', mode: 'development' // development or production From dcc0ac0ff5a0b417e1e6186d04490bee144f923e Mon Sep 17 00:00:00 2001 From: Jakob Heuser Date: Sat, 30 Mar 2019 10:26:09 -0700 Subject: [PATCH 3/3] fixup --- engine/src/ElGrapho.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/engine/src/ElGrapho.js b/engine/src/ElGrapho.js index 04c1549..e5af8a1 100644 --- a/engine/src/ElGrapho.js +++ b/engine/src/ElGrapho.js @@ -595,9 +595,4 @@ ElGrapho.layouts = { Web: Web }; -<<<<<<< HEAD module.exports = ElGrapho; -======= -// node.js export -module.exports = ElGrapho; ->>>>>>> upstream/master