Skip to content

Commit

Permalink
Merge pull request #10 from curran/modernize-distribution
Browse files Browse the repository at this point in the history
Modernize Distribution
  • Loading branch information
jdfekete authored Dec 30, 2020
2 parents 8c9d325 + 0a9e589 commit 2406082
Show file tree
Hide file tree
Showing 71 changed files with 677 additions and 326 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
*~
#*

*.swp
185 changes: 185 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
"type": "git",
"url": "http://github.com/jdfekete/reorder.js.git"
},
"main": "./reorder.v1.js",
"unpkg": "reorder.v1.min.js",
"jsdelivr": "reorder.v1.min.js",
"unpkg": "dist/reorder.umd.js",
"jsdelivr": "dist/reorder.umd.js",
"main": "dist/reorder.cjs.js",
"module": "dist/reorder.esm.js",
"browser": "dist/reorder.umd.js",
"types": "./reorder.d.ts",
"author": [
{
Expand All @@ -23,18 +25,23 @@
}
],
"scripts": {
"build": "make all",
"clean": "make clean",
"build": "rollup -c",
"test": "vows --nocolor; echo"
},
"files": [
"dist"
],
"dependencies": {
"science": "1.9.2",
"tiny-queue": "0.2.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"jshint": "^2.9.7",
"jsonfile": "2.0.0",
"numeric": "1.2.6",
"rollup": "^2.35.1",
"seedrandom": "2.3.11",
"uglify-js": "3.4.9",
"vows": "^0.8.2"
Expand Down
7 changes: 1 addition & 6 deletions reorder.v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ function count_out_crossings(graph, v, w, inv) {
* @param {list} layer2 - the ordered list of nodes in layer 2
* @returns {list} a tuple containing the new layer1, layer2, and crossings count
*/
function adjacent_exchange(graph, layer1, layer2) {
export function adjacent_exchange(graph, layer1, layer2) {
layer1 = layer1.slice();
layer2 = layer2.slice();
var i, v, w, c0, c1,
Expand Down Expand Up @@ -1069,8 +1069,6 @@ function adjacent_exchange(graph, layer1, layer2) {

return [layer1, layer2, improved];
}

reorder.adjacent_exchange = adjacent_exchange;
reorder.barycenter_order = function(graph, comps, max_iter) {
var orders = [[], [], 0];
// Compute the barycenter heuristic on each connected component
Expand Down Expand Up @@ -2285,9 +2283,6 @@ reorder.order = function() {
if (list[i-1] >= list[i])
throw "Invalid list, indices not sorted";
except = list.slice(0);
// except = list.sort(function(a,b) {
// return a-b;
// });
return order;
};

Expand Down
1 change: 0 additions & 1 deletion reorder.v1.min.js

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import pkg from "./package.json";

export default [
{
input: "src/index.js",
output: {
name: "reorder",
file: pkg.browser,
format: "umd",
},
plugins: [
resolve(),
commonjs(),
],
},
{
input: "src/index.js",
external: ["science"],
output: [
{ file: pkg.main, format: "cjs" },
{ file: pkg.module, format: "es" },
],
},
];

6 changes: 3 additions & 3 deletions src/adjacent_exchange.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { inverse_permutation } from './permutation';

// Accorging to
// E. R. Gansner, E. Koutsofios, S. C. North, and K.-P. Vo. 1993. A
// Technique for Drawing Directed Graphs. IEEE Trans. Softw. Eng. 19, 3
Expand Down Expand Up @@ -46,7 +48,7 @@ function count_out_crossings(graph, v, w, inv) {
* @param {list} layer2 - the ordered list of nodes in layer 2
* @returns {list} a tuple containing the new layer1, layer2, and crossings count
*/
function adjacent_exchange(graph, layer1, layer2) {
export function adjacent_exchange(graph, layer1, layer2) {
layer1 = layer1.slice();
layer2 = layer2.slice();
var i, v, w, c0, c1,
Expand Down Expand Up @@ -91,5 +93,3 @@ function adjacent_exchange(graph, layer1, layer2) {

return [layer1, layer2, improved];
}

reorder.adjacent_exchange = adjacent_exchange;
Loading

0 comments on commit 2406082

Please sign in to comment.