Skip to content

Commit

Permalink
Revert "Using the org versions of dagre & graphlib"
Browse files Browse the repository at this point in the history
This reverts commit 27c2d7c.
  • Loading branch information
rustedgrail committed Mar 13, 2024
1 parent 8204bc4 commit 4c8d41e
Show file tree
Hide file tree
Showing 9 changed files with 426 additions and 8,359 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DEMO_FILES = $(shell find demo -type f)
SRC_FILES = index.js lib/version.js $(shell find lib -type f -name '*.js')
BUILD_FILES = $(addprefix $(BUILD_DIR)/dist/, \
$(MOD).js $(MOD).min.js \
$(MOD).core.js $(MOD).core.min.js \
$(DEMO_FILES))

DIRS = $(BUILD_DIR) $(BUILD_DIR)/dist $(BUILD_DIR)/dist/demo
Expand All @@ -44,6 +45,7 @@ test: browser-test demo-test node-test

browser-test: $(BUILD_FILES)
$(KARMA) start --single-run $(KARMA_OPTS)
$(KARMA) start karma.core.conf.js --single-run $(KARMA_OPTS)

demo-test: test/demo-test.js | $(BUILD_FILES)
echo $(PHANTOMJS) $<
Expand All @@ -61,6 +63,12 @@ $(BUILD_DIR)/dist/$(MOD).js: index.js $(SRC_FILES) | $(BUILD_DIR)/dist node_modu
$(BUILD_DIR)/dist/$(MOD).min.js: $(BUILD_DIR)/dist/$(MOD).js | $(BUILD_DIR)/dist
@$(UGLIFY) $< --comments '@license' --source-map --output $@

$(BUILD_DIR)/dist/$(MOD).core.js: index.js $(SRC_FILES) | $(BUILD_DIR)/dist node_modules
@$(BROWSERIFY) $< > $@ --no-bundle-external -s dagreD3

$(BUILD_DIR)/dist/$(MOD).core.min.js: $(BUILD_DIR)/dist/$(MOD).core.js | $(BUILD_DIR)/dist
@$(UGLIFY) $< --comments '@license' --source-map --output $@

$(BUILD_DIR)/dist/demo/%: demo/% | $(BUILD_DIR)/dist/demo
@cp $< $@

Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
],
"dependencies": {
"d3": "^5.14",
"@dagrejs/dagre": "1.0.2",
"g@dagrejs/raphlib": "2.1.13",
"dagre": "^0.8.5",
"graphlib": "^2.1.8",
"lodash": "^4.17.15"
}
}
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
* THE SOFTWARE.
*/
module.exports = {
graphlib: require("@dagrejs/graphlib"),
dagre: require("@dagrejs/dagre"),
graphlib: require("./lib/graphlib"),
dagre: require("./lib/dagre"),
intersect: require("./lib/intersect"),
render: require("./lib/render"),
util: require("./lib/util"),
Expand Down
82 changes: 82 additions & 0 deletions karma.core.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Karma configuration
// Generated on Sat Oct 18 2014 14:34:48 GMT-0700 (PDT)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],


// list of files / patterns to load in the browser
files: [
{ pattern: 'test/*.css', included: false },

'node_modules/lodash/lodash.js',
'node_modules/d3/dist/d3.js',
'node_modules/graphlib/dist/graphlib.core.js',
'node_modules/dagre/dist/dagre.core.js',
'build/dist/dagre-d3.core.js',

'node_modules/chai/chai.js',
'test/bundle-test.js'
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'dist/dagre-d3.core.js': 'coverage'
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],

coverageReporter: {
dir: 'build/cov',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},

// web server port
port: 9877,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'Firefox'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};
18 changes: 18 additions & 0 deletions lib/dagre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// eslint-disable-next-line no-redeclare
/* global window */

var dagre;

if (typeof require === "function") {
try {
dagre = require("dagre");
} catch (e) {
// continue regardless of error
}
}

if (!dagre) {
dagre = window.dagre;
}

module.exports = dagre;
19 changes: 19 additions & 0 deletions lib/graphlib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// eslint-disable-next-line no-redeclare
/* global window */

var graphlib;

if (typeof require === "function") {
try {
graphlib = require("graphlib");
}
catch (e) {
// continue regardless of error
}
}

if (!graphlib) {
graphlib = window.graphlib;
}

module.exports = graphlib;
2 changes: 1 addition & 1 deletion lib/render.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var _ = require("./lodash");
var d3 = require("./d3");
var layout = require("@dagrejs/dagre").layout;
var layout = require("./dagre").layout;

module.exports = render;

Expand Down
Loading

0 comments on commit 4c8d41e

Please sign in to comment.