@lgv/visualization-map 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +40 -0
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/package.json +58 -0
- package/src/configuration.js +19 -0
- package/src/index.js +8 -0
- package/src/layout/heat.js +58 -0
- package/src/structure/index.js +19 -0
- package/src/visualization/heatmap.js +157 -0
- package/src/visualization/index.js +80 -0
- package/tests/_setup-browser-env.js +3 -0
- package/tests/init_test.js +10 -0
- package/webpack.common.js +43 -0
- package/webpack.dev.js +19 -0
- package/webpack.prod.js +19 -0
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- test
|
|
3
|
+
- version
|
|
4
|
+
- publish
|
|
5
|
+
|
|
6
|
+
include:
|
|
7
|
+
###################################### GITLAB TEMPLATES ######################################
|
|
8
|
+
- template: Security/SAST.gitlab-ci.yml
|
|
9
|
+
|
|
10
|
+
# overwrites
|
|
11
|
+
- project: "lgensinger/cicd-templates"
|
|
12
|
+
file: "node/module/eslint-sast.yml"
|
|
13
|
+
|
|
14
|
+
- project: "lgensinger/cicd-templates"
|
|
15
|
+
file: "node/module/nodejs-scan-sast.yml"
|
|
16
|
+
|
|
17
|
+
- project: "lgensinger/cicd-templates"
|
|
18
|
+
file: "node/module/semgrep-sast.yml"
|
|
19
|
+
|
|
20
|
+
###################################### TESTING ######################################
|
|
21
|
+
|
|
22
|
+
# unit test
|
|
23
|
+
- project: "lgensinger/cicd-templates"
|
|
24
|
+
file: "node/module/test.yml"
|
|
25
|
+
|
|
26
|
+
# coverage
|
|
27
|
+
- project: "lgensinger/cicd-templates"
|
|
28
|
+
file: "node/module/coverage.yml"
|
|
29
|
+
|
|
30
|
+
###################################### VERSIONING ######################################
|
|
31
|
+
|
|
32
|
+
# module
|
|
33
|
+
- project: "lgensinger/cicd-templates"
|
|
34
|
+
file: "node/module/version.yml"
|
|
35
|
+
|
|
36
|
+
###################################### PUBLISHING ######################################
|
|
37
|
+
|
|
38
|
+
# npm
|
|
39
|
+
- project: "lgensinger/cicd-templates"
|
|
40
|
+
file: "node/module/publish.yml"
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 lgensinger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lgv/visualization-map",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "ES6 d3.js core visualization scaffold object and utilities for maps.",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"module": "src/index.js",
|
|
8
|
+
"directories": {
|
|
9
|
+
"test": "tests"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "webpack build --config webpack.prod.js",
|
|
13
|
+
"coverage": "c8 --reporter=html --reporter=text ava --node-arguments='--experimental-json-modules'",
|
|
14
|
+
"start": "webpack serve --config webpack.dev.js",
|
|
15
|
+
"startdocker": "webpack serve --config webpack.dev.js --host 0.0.0.0 --public 0.0.0.0",
|
|
16
|
+
"test": "npx ava --verbose --serial --timeout 1m --node-arguments='--experimental-json-modules'"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://gitlab.com/lgensinger/visualization-map.git"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"visualization",
|
|
24
|
+
"d3"
|
|
25
|
+
],
|
|
26
|
+
"author": "lgensinger",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://gitlab.com/lgensinger/visualization-map/issues"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://gitlab.com/lgensinger/visualization-map#readme",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"ava": "^4.2.0",
|
|
34
|
+
"browser-env": "^3.3.0",
|
|
35
|
+
"c8": "^7.11.3",
|
|
36
|
+
"css-loader": "^6.7.2",
|
|
37
|
+
"html-webpack-plugin": "^5.3.2",
|
|
38
|
+
"style-loader": "^3.3.1",
|
|
39
|
+
"webpack-cli": "^4.7.2",
|
|
40
|
+
"webpack-dev-server": "^3.11.2"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@deck.gl/core": "^8.8.20",
|
|
44
|
+
"@deck.gl/layers": "^8.8.20",
|
|
45
|
+
"@lgv/visualization-chart": "^0.3.5",
|
|
46
|
+
"@msrvida/vega-deck.gl": "^3.3.4",
|
|
47
|
+
"leaflet": "^1.9.2",
|
|
48
|
+
"vega": "^5.22.1"
|
|
49
|
+
},
|
|
50
|
+
"ava": {
|
|
51
|
+
"files": [
|
|
52
|
+
"tests/*_test.js"
|
|
53
|
+
],
|
|
54
|
+
"require": [
|
|
55
|
+
"./tests/_setup-browser-env.js"
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import packagejson from "../package.json";
|
|
2
|
+
|
|
3
|
+
const configuration = {
|
|
4
|
+
branding: "lgv",
|
|
5
|
+
name: packagejson.name.replace("/", "-").slice(1)
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const configurationColor = {
|
|
9
|
+
p1: ["#eb4034","#34ebe5"]
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const configurationLayout = {
|
|
13
|
+
height: process.env.LGV_HEIGHT || 400,
|
|
14
|
+
tileserver: process.env.LGV_TILESERVER || "https://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}{r}.png",
|
|
15
|
+
width: process.env.LGV_WIDTH || 400
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { configuration, configurationColor, configurationLayout };
|
|
19
|
+
export default configuration;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HeatLayout } from "./layout/heat.js";
|
|
2
|
+
|
|
3
|
+
import { MapData } from "./structure/index.js";
|
|
4
|
+
|
|
5
|
+
import { Heatmap } from "./visualization/heatmap.js";
|
|
6
|
+
import { VisualizationMap } from "./visualization/index.js";
|
|
7
|
+
|
|
8
|
+
export { HeatLayout, Heatmap, MapData, VisualizationMap };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import L from "leaflet";
|
|
2
|
+
|
|
3
|
+
import { MapData } from "../structure/index.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* HeatLayout is a data-bound layout abstraction for a heatmap.
|
|
7
|
+
* @param {array} data - geojson
|
|
8
|
+
* @param {class} map - Leaflet map object
|
|
9
|
+
*/
|
|
10
|
+
class HeatLayout extends MapData {
|
|
11
|
+
|
|
12
|
+
constructor(data, map) {
|
|
13
|
+
|
|
14
|
+
// initialize inheritance
|
|
15
|
+
super(data);
|
|
16
|
+
|
|
17
|
+
// update self
|
|
18
|
+
this.map = map;
|
|
19
|
+
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Condition data for visualization requirements.
|
|
24
|
+
* @param {array} data - geojson
|
|
25
|
+
* @returns An object or array of data specifically formatted to the visualization type.
|
|
26
|
+
*/
|
|
27
|
+
condition(data) {
|
|
28
|
+
|
|
29
|
+
let result = data;
|
|
30
|
+
|
|
31
|
+
if (this.map && data.type == "FeatureCollection") {
|
|
32
|
+
|
|
33
|
+
// project to xy
|
|
34
|
+
result = data.features.map(d => {
|
|
35
|
+
|
|
36
|
+
// convert to xy
|
|
37
|
+
let xy = this.map.latLngToContainerPoint(L.latLng(d.geometry.coordinates[1], d.geometry.coordinates[0]));
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
count: d.properties.count,
|
|
41
|
+
id: d.properties.id,
|
|
42
|
+
label: d.properties.name,
|
|
43
|
+
x: xy.x,
|
|
44
|
+
y: xy.y
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return result;
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export { HeatLayout };
|
|
58
|
+
export default HeatLayout;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChartData } from "@lgv/visualization-chart";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MapData is a data abstraction.
|
|
5
|
+
* @param {array} data - geojson
|
|
6
|
+
*/
|
|
7
|
+
class MapData extends ChartData {
|
|
8
|
+
|
|
9
|
+
constructor(data) {
|
|
10
|
+
|
|
11
|
+
// initialize inheritance
|
|
12
|
+
super(data);
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { MapData };
|
|
19
|
+
export default MapData;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as deck from '@deck.gl/core';
|
|
2
|
+
import * as layers from '@deck.gl/layers';
|
|
3
|
+
import * as luma from '@luma.gl/core';
|
|
4
|
+
import * as VegaDeckGl from "@msrvida/vega-deck.gl";
|
|
5
|
+
import L from "leaflet";
|
|
6
|
+
import * as vega from "vega";
|
|
7
|
+
|
|
8
|
+
import { VisualizationMap } from "./index.js";
|
|
9
|
+
import { HeatLayout as HL } from "../layout/heat.js";
|
|
10
|
+
|
|
11
|
+
import { configuration, configurationColor, configurationLayout } from "../configuration.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* VisualizationMap is a map abstraction.
|
|
15
|
+
* @param {object} data - usually array; occasionally object
|
|
16
|
+
* @param {string} label - identifer for chart brand
|
|
17
|
+
* @param {float} height - specified height of chart
|
|
18
|
+
* @param {class} MapData - lgv data class
|
|
19
|
+
* @param {string} name - name of chart
|
|
20
|
+
* @param {float} width - specified width of chart
|
|
21
|
+
*/
|
|
22
|
+
class Heatmap extends VisualizationMap {
|
|
23
|
+
|
|
24
|
+
constructor(data, width=configurationLayout.width, height=configurationLayout.height, HeatLayout=null, label=configuration.branding, name=configuration.name) {
|
|
25
|
+
|
|
26
|
+
// initialize inheritance
|
|
27
|
+
super(data, width, height, HeatLayout ? HeatLayout : new HL(data), label, name);
|
|
28
|
+
|
|
29
|
+
// initialize vega
|
|
30
|
+
VegaDeckGl.use(vega, deck, layers, luma);
|
|
31
|
+
|
|
32
|
+
// update self
|
|
33
|
+
this.imageOverlay = null;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Generate mark size.
|
|
39
|
+
* @returns An integer representing the render size of a visual mark.
|
|
40
|
+
*/
|
|
41
|
+
get mark() {
|
|
42
|
+
|
|
43
|
+
let isHighDensityDisplay = window.devicePixelRatio > 1 && window.innerWidth * window.devicePixelRatio > 3360 && window.innerHeight * window.devicePixelRatio > 1942;
|
|
44
|
+
|
|
45
|
+
// set starting size
|
|
46
|
+
let base = isHighDensityDisplay ? this.unit * 1.75 : this.unit * 1.5;
|
|
47
|
+
let mark = base;
|
|
48
|
+
|
|
49
|
+
// determine mark size
|
|
50
|
+
switch (true) {
|
|
51
|
+
case (this.zoom >= 16):
|
|
52
|
+
mark = base - 1;
|
|
53
|
+
break;
|
|
54
|
+
case (this.zoom >= 14):
|
|
55
|
+
mark = base - 2;
|
|
56
|
+
break;
|
|
57
|
+
case (this.zoom >= 12):
|
|
58
|
+
mark = base - 3;
|
|
59
|
+
break;
|
|
60
|
+
case (this.zoom >= 8):
|
|
61
|
+
mark = base - 4;
|
|
62
|
+
break;
|
|
63
|
+
case (this.zoom >= 0):
|
|
64
|
+
mark = base - 5;
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return mark;
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generate main visualization, i.e. everything that sits inside the map.
|
|
74
|
+
*/
|
|
75
|
+
generateChart(e) {
|
|
76
|
+
|
|
77
|
+
// process data
|
|
78
|
+
// update data object now that map exists
|
|
79
|
+
this.Data.map = this.map;
|
|
80
|
+
this.data = this.Data.update;
|
|
81
|
+
|
|
82
|
+
// generate vega specification
|
|
83
|
+
let spec = this.generateSpecification();
|
|
84
|
+
|
|
85
|
+
// render vega with deck.gl
|
|
86
|
+
let view = new VegaDeckGl.ViewGl(vega.parse(spec))
|
|
87
|
+
.renderer("deck.gl")
|
|
88
|
+
.run();
|
|
89
|
+
|
|
90
|
+
// generate url blob
|
|
91
|
+
view.toImageURL("svg")
|
|
92
|
+
.then(url => {
|
|
93
|
+
|
|
94
|
+
// check if overlay exists
|
|
95
|
+
if (this.imageOverlay) {
|
|
96
|
+
|
|
97
|
+
// update existing
|
|
98
|
+
this.imageOverlay.setUrl(url);
|
|
99
|
+
this.imageOverlay.setBounds(this.map.getBounds());
|
|
100
|
+
|
|
101
|
+
} else {
|
|
102
|
+
|
|
103
|
+
// initialize
|
|
104
|
+
this.imageOverlay = L.imageOverlay(url, this.map.getBounds());
|
|
105
|
+
|
|
106
|
+
// update map
|
|
107
|
+
this.imageOverlay.addTo(this.map);
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generate vega specification in prep for render.
|
|
117
|
+
*/
|
|
118
|
+
generateSpecification() {
|
|
119
|
+
|
|
120
|
+
// register custom scheme
|
|
121
|
+
vega.scheme(this.name, configurationColor.p1);
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
width: this.width,
|
|
125
|
+
height: this.height,
|
|
126
|
+
data: [{ name: this.name, values: this.data }],
|
|
127
|
+
scales: [
|
|
128
|
+
{
|
|
129
|
+
name: "color",
|
|
130
|
+
type: "log",
|
|
131
|
+
domain: { data: this.name, field: "count" },
|
|
132
|
+
range: { scheme: this.name, count: configurationColor.p1.length }
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
marks: [
|
|
136
|
+
{
|
|
137
|
+
type: "symbol",
|
|
138
|
+
from: { data: this.name },
|
|
139
|
+
encode: {
|
|
140
|
+
update: {
|
|
141
|
+
shape: { value: "square" },
|
|
142
|
+
x: { field: "x" },
|
|
143
|
+
y: { field: "y" },
|
|
144
|
+
size: { value: this.mark },
|
|
145
|
+
fill: { scale: "color", field: "count" },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export { Heatmap };
|
|
157
|
+
export default Heatmap;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { degreeToRadian, LinearGrid, radianToDegree } from "@lgv/visualization-chart";
|
|
2
|
+
import { mean } from "d3-array";
|
|
3
|
+
import L from "leaflet";
|
|
4
|
+
import "leaflet/dist/leaflet.css";
|
|
5
|
+
|
|
6
|
+
import { configuration, configurationLayout } from "../configuration.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* VisualizationMap is a map abstraction.
|
|
10
|
+
* @param {object} data - usually array; occasionally object
|
|
11
|
+
* @param {string} label - identifer for chart brand
|
|
12
|
+
* @param {float} height - specified height of chart
|
|
13
|
+
* @param {class} MapData - lgv data class
|
|
14
|
+
* @param {string} name - name of chart
|
|
15
|
+
* @param {float} width - specified width of chart
|
|
16
|
+
*/
|
|
17
|
+
class VisualizationMap extends LinearGrid {
|
|
18
|
+
|
|
19
|
+
constructor(data, width=configurationLayout.width, height=configurationLayout.height, MapData=null, label=configuration.branding, name=configuration.name) {
|
|
20
|
+
|
|
21
|
+
// initialize inheritance
|
|
22
|
+
super(data, width, height, MapData, label, name);
|
|
23
|
+
|
|
24
|
+
// update self
|
|
25
|
+
this.center = [mean(this.data.features, d => d.geometry.coordinates[1]), mean(this.data.features, d => d.geometry.coordinates[0])];
|
|
26
|
+
this.map = null;
|
|
27
|
+
this.tileserver = configurationLayout.tileserver;
|
|
28
|
+
this.zoom = 1;
|
|
29
|
+
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Generate main visualization, i.e. everything that sits inside the svg.
|
|
34
|
+
*/
|
|
35
|
+
generateChart() {
|
|
36
|
+
|
|
37
|
+
//
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Generate artboard for map.
|
|
43
|
+
*/
|
|
44
|
+
generateCore() {
|
|
45
|
+
|
|
46
|
+
// determine averaged center of coordinates
|
|
47
|
+
// without curvature of earth accounted for
|
|
48
|
+
this.map = L.map(this.container.node(), {
|
|
49
|
+
center: this.center,
|
|
50
|
+
zoom: this.zoom
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// add handlers for leaflet events
|
|
54
|
+
this.map.on("moveend", this.generateChart.bind(this));
|
|
55
|
+
|
|
56
|
+
// update tile server
|
|
57
|
+
L.tileLayer(this.tileserver).addTo(this.map);
|
|
58
|
+
|
|
59
|
+
// fit to center + distance
|
|
60
|
+
this.map.fitBounds(L.geoJSON(this.Data.source).getBounds());
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Generate visualization.
|
|
66
|
+
*/
|
|
67
|
+
generateVisualization() {
|
|
68
|
+
|
|
69
|
+
// generate core elements
|
|
70
|
+
this.generateCore();
|
|
71
|
+
|
|
72
|
+
// generate patterns
|
|
73
|
+
this.generatePatterns();
|
|
74
|
+
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { VisualizationMap };
|
|
80
|
+
export default VisualizationMap;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { dirname } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
import webpack from "webpack";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
|
|
9
|
+
const commonConfig = {
|
|
10
|
+
|
|
11
|
+
entry: {
|
|
12
|
+
index: "./src/index.js"
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
plugins: [
|
|
16
|
+
new webpack.DefinePlugin({
|
|
17
|
+
"process.env": {
|
|
18
|
+
"LGV_HEIGHT": JSON.stringify(process.env.LGV_HEIGHT),
|
|
19
|
+
"LGV_TILESERVER": JSON.stringify(process.env.LGV_TILESERVER),
|
|
20
|
+
"LGV_WIDTH": JSON.stringify(process.env.LGV_WIDTH)
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
output: {
|
|
26
|
+
filename: "visualization-map.bundle.js",
|
|
27
|
+
path: path.resolve(__dirname, "dist"),
|
|
28
|
+
clean: true
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
module: {
|
|
32
|
+
rules: [
|
|
33
|
+
{
|
|
34
|
+
test: /\.css$/i,
|
|
35
|
+
use: ["style-loader", "css-loader"]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { commonConfig };
|
|
43
|
+
export default commonConfig;
|
package/webpack.dev.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { commonConfig } from "./webpack.common.js";
|
|
2
|
+
|
|
3
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
4
|
+
import { merge } from "webpack-merge";
|
|
5
|
+
|
|
6
|
+
const webpackConfig = merge(commonConfig, {
|
|
7
|
+
|
|
8
|
+
mode: "development",
|
|
9
|
+
|
|
10
|
+
plugins: [
|
|
11
|
+
new HtmlWebpackPlugin({
|
|
12
|
+
title: "Development",
|
|
13
|
+
})
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { webpackConfig };
|
|
19
|
+
export default webpackConfig;
|
package/webpack.prod.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { commonConfig } from "./webpack.common.js";
|
|
2
|
+
|
|
3
|
+
import { merge } from "webpack-merge";
|
|
4
|
+
|
|
5
|
+
const webpackConfig = merge(commonConfig, {
|
|
6
|
+
|
|
7
|
+
mode: "production",
|
|
8
|
+
|
|
9
|
+
output: {
|
|
10
|
+
library: {
|
|
11
|
+
name: "VisualizationMap",
|
|
12
|
+
type: "umd"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { webpackConfig };
|
|
19
|
+
export default webpackConfig;
|