Skip to content

Commit

Permalink
Remove D3.js dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Jul 18, 2021
1 parent 3747813 commit 3c8c795
Show file tree
Hide file tree
Showing 9 changed files with 522 additions and 39 deletions.
3 changes: 1 addition & 2 deletions .eslintrc.json
Expand Up @@ -19,7 +19,6 @@
},
"globals": {
"flatbuffers": "readonly",
"protobuf": "readonly",
"d3": "readonly"
"protobuf": "readonly"
}
}
1 change: 0 additions & 1 deletion Makefile
Expand Up @@ -84,7 +84,6 @@ build_web:
cp -R ./source/*.ico ./dist/web
cp -R ./source/*.png ./dist/web
rm -rf ./dist/web/electron.* ./dist/web/app.js
cp -R ./node_modules/d3/dist/d3.js ./dist/web
cp -R ./node_modules/dagre/dist/dagre.js ./dist/web
sed -i "s/0\.0\.0/$$(grep '"version":' package.json -m1 | cut -d\" -f4)/g" ./dist/web/index.html

Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -17,7 +17,6 @@
"server": "[ -d node_modules ] || npm install && python setup.py --quiet build && python -c 'import sys, os; sys.path.insert(0, os.path.join(\"dist\", \"lib\")); import netron; netron.main()' $@"
},
"dependencies": {
"d3": "7.0.0",
"dagre": "0.8.5",
"electron-updater": "4.3.9"
},
Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -10,7 +10,6 @@

node_dependencies = [
( 'netron', [
'node_modules/d3/dist/d3.js',
'node_modules/dagre/dist/dagre.js'
]
)
Expand Down
2 changes: 1 addition & 1 deletion source/app.js
Expand Up @@ -48,7 +48,7 @@ class Application {
event.returnValue = {
version: electron.app.getVersion(),
package: electron.app.isPackaged,
zoom: 'd3'
zoom: 'drag'
// zoom: 'scroll'
};
});
Expand Down
8 changes: 0 additions & 8 deletions source/electron.js
Expand Up @@ -99,14 +99,6 @@ host.ElectronHost = class {
request();
});
}
}).then(() => {
// d3.js
const Module = require('module');
var d3 = new Module('', module.main);
const location = path.join(path.dirname(__dirname), 'node_modules', 'd3', 'dist', 'd3.js');
const source = fs.readFileSync(location, 'utf-8');
d3._compile(source, '');
global.d3 = d3.exports;
});
}

Expand Down
1 change: 0 additions & 1 deletion source/index.html
Expand Up @@ -13,7 +13,6 @@
<link rel="apple-touch-icon" type="image/png" href="icon.png">
<link rel="apple-touch-icon-precomposed" type="image/png" href="icon.png">
<link rel="fluid-icon" type="image/png" href="icon.png">
<script type="text/javascript" src="d3.js"></script>
<script type="text/javascript" src="dagre.js"></script>
<script type="text/javascript" src="base.js"></script>
<script type="text/javascript" src="json.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion source/index.js
Expand Up @@ -26,7 +26,7 @@ host.BrowserHost = class {
this._version = this._meta.version ? this._meta.version[0] : null;
this._telemetry = this._version && this._version !== '0.0.0';
this._environment = new Map();
this._environment.set('zoom', 'd3');
this._environment.set('zoom', 'drag');
// this._environment.set('zoom', 'scroll');
}

Expand Down

0 comments on commit 3c8c795

Please sign in to comment.