From 14cc986e731c5d9d0c55aca7278a4e89aaf5784c Mon Sep 17 00:00:00 2001
From: "Tobias Kraus (Lenovo)"
Date: Sat, 11 May 2019 12:43:51 +0200
Subject: [PATCH] Examples: fix parcel build, add
* replace d3-voronoi with delaunator
* tsc commpiler might complain cause of @types/delaunator
@types/delaunator version 3.0 is coming soon and will fix it
* examples/src folder cannot have subfolder as relative paths are buggy
in parcel-bundler
(https://github.com/parcel-bundler/parcel/issues/2786)
* add examples/README.md
---
LICENCE => LICENSE | 0
examples/README.md | 31 ++++++++++++
examples/package-lock.json | 11 +++++
examples/package.json | 8 +--
examples/src/index.html | 4 +-
.../index.html => points-grid.html} | 4 +-
examples/src/{points-grid => }/points-grid.ts | 2 +-
.../index.html => triangles-web-with-d3.html} | 13 +++--
.../triangles-web-with-d3.ts | 49 ++++++++++++++-----
examples/tsconfig.json | 5 +-
10 files changed, 99 insertions(+), 28 deletions(-)
rename LICENCE => LICENSE (100%)
create mode 100644 examples/README.md
rename examples/src/{points-grid/index.html => points-grid.html} (87%)
rename examples/src/{points-grid => }/points-grid.ts (97%)
rename examples/src/{triangles-web-with-d3/index.html => triangles-web-with-d3.html} (84%)
rename examples/src/{triangles-web-with-d3 => }/triangles-web-with-d3.ts (53%)
diff --git a/LICENCE b/LICENSE
similarity index 100%
rename from LICENCE
rename to LICENSE
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 0000000..4307ae4
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,31 @@
+# svg-gen Examples
+
+Some code examples, to see how this library works.
+
+## TypeScript & parcel-bundler
+
+All examples are written in TypeScript.
+In order to use the svg-gen library directly (realive path: ..) instead of npm installing and to avoid much configuration, we use parcel.
+Parcel is bundler like Webpack, but with less configuration.
+
+## Current issue: Folder structure
+
+I tried to have all examples in subfolders (html + css files).
+And to have one index.html in examples root.
+But parcel resolves the relative paths wrong, when html files are in subfolders [Parcel issue 2786](https://github.com/parcel-bundler/parcel/issues/2786)
+
+## Build and Test examples
+
+```sh
+npm run build
+```
+
+the built files will be in in examples/dist/
+
+## Develop
+
+```sh
+npm start
+```
+
+The browser will open autommatically the local webserver and refreshes when changes are made.
\ No newline at end of file
diff --git a/examples/package-lock.json b/examples/package-lock.json
index 59d892f..6fab447 100644
--- a/examples/package-lock.json
+++ b/examples/package-lock.json
@@ -1354,6 +1354,12 @@
"@types/d3-selection": "*"
}
},
+ "@types/delaunator": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@types/delaunator/-/delaunator-2.0.0.tgz",
+ "integrity": "sha512-5MwdeoRF5Q3zfGljBt4uOVt2Xppf+kAoZk2fRQV4TOUa7HsZ9R6J4Bu2pfNx9RoIJrbtQwMGHPSdGiQsmJ9jEQ==",
+ "dev": true
+ },
"@types/geojson": {
"version": "7946.0.7",
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.7.tgz",
@@ -3067,6 +3073,11 @@
}
}
},
+ "delaunator": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-3.0.2.tgz",
+ "integrity": "sha512-GNSex8jhF1mcqtNAMYvdZ6Ng7YieYNlbOq2xshyZhLc98P8y5O7Vm6buw4A60wGOd9qvK9RcIMm5qoe4PncAPw=="
+ },
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
diff --git a/examples/package.json b/examples/package.json
index 012b143..e63af31 100644
--- a/examples/package.json
+++ b/examples/package.json
@@ -4,18 +4,18 @@
"description": "",
"main": "index.html",
"scripts": {
- "start": "rm ./dist/ -rf && parcel serve ./src/**/*",
- "build": "rm ./dist/ -rf && parcel build ./src/**/* --public-url ../ && parcel build ./src/index.html --public-url ."
+ "start": "rm ./dist/ -rf && parcel serve ./src/**/* --public-url ./",
+ "build": "rm ./dist/ -rf && parcel build ./src/index.html --public-url ./ --no-minify"
},
"author": "Tobias Kraus (www.tobias-kraus.com)",
"license": "ISC",
"devDependencies": {
"@types/d3": "^5.7.2",
- "@types/d3-voronoi": "^1.1.9",
+ "@types/delaunator": "^2.0.0",
"parcel-bundler": "^1.12.3"
},
"dependencies": {
"d3": "^5.9.2",
- "d3-voronoi": "^1.1.4"
+ "delaunator": "^3.0.2"
}
}
diff --git a/examples/src/index.html b/examples/src/index.html
index b84092d..1184c10 100644
--- a/examples/src/index.html
+++ b/examples/src/index.html
@@ -21,8 +21,8 @@ svg-gen Examples