Skip to content

Commit d89537e

Browse files
committed
add a minified build, install docs
1 parent d4e13bb commit d89537e

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
tmp
33
yarn.lock
4+
delatin.min.js

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,14 @@ After running mesh refinement, this will be an array of `x, y` vertex coordinate
5050
#### `tin.triangles`
5151

5252
After running mesh refinement, this will be an an array of triangle indices of the final mesh. Each triple of numbers defines a triangle and references vertices in the `tin.coords` array.
53+
54+
## Install
55+
56+
Run `npm install delatin` or `yarn add delatin`. Delatin is exposed as a ES module, so you can use it like this in modern browsers:
57+
58+
```html
59+
<script type="module">
60+
import Delatin from 'https://unpkg.com/delatin';
61+
```
62+
63+
To use ES modules in Node, either use [esm](https://github.com/standard-things/esm) (`node -r esm app.js`), or `node --experimental-modules app.js` for Node v12+.

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
"version": "0.1.0",
44
"description": "JavaScript terrain mesh generation tool",
55
"main": "index.js",
6+
"module": "index.js",
67
"type": "module",
8+
"unpkg": "delatin.min.js",
79
"scripts": {
810
"pretest": "eslint index.js bench.js test/test.js",
911
"test": "node -r esm test/test.js",
1012
"bench": "node -r esm bench.js",
11-
"prepublishOnly": "npm run test"
13+
"build": "terser -c -m -- index.js > delatin.min.js",
14+
"prepublishOnly": "npm run test && npm run build"
1215
},
1316
"files": [
14-
"index.js"
17+
"index.js",
18+
"delatin.min.js"
1519
],
1620
"eslintConfig": {
1721
"extends": "mourner"
@@ -30,6 +34,7 @@
3034
"eslint-config-mourner": "^3.0.0",
3135
"esm": "^3.2.25",
3236
"pngjs": "^3.4.0",
33-
"tape": "^4.11.0"
37+
"tape": "^4.11.0",
38+
"terser": "^4.3.4"
3439
}
3540
}

0 commit comments

Comments
 (0)