Improve npm packaging so it can be installed by npm and imported by a client
authorNick Downing <downing.nick@gmail.com>
Fri, 5 Jan 2018 11:43:36 +0000 (22:43 +1100)
committerNick Downing <nick@ndcode.org>
Sun, 18 Nov 2018 02:38:20 +0000 (13:38 +1100)
.npmignore [new file with mode: 0644]
package.json
test.js
zetjs.js [new file with mode: 0644]

diff --git a/.npmignore b/.npmignore
new file mode 100644 (file)
index 0000000..adaa6a1
--- /dev/null
@@ -0,0 +1,11 @@
+build
+doc
+env.sh
+index.map.0
+index.param.0
+index.v.0
+index.vocab.0
+n.sh
+node_modules
+nodesource_setup.sh
+zetjs-*.tgz
index 2758fff..2a5b032 100644 (file)
@@ -2,7 +2,7 @@
   "name": "zetjs",
   "version": "1.0.0",
   "description": "Bindings to zettair search engine",
-  "main": "",
+  "main": "zetjs.js",
   "directories": {
     "doc": "doc"
   },
diff --git a/test.js b/test.js
index 110af5b..244f3ad 100755 (executable)
--- a/test.js
+++ b/test.js
@@ -1,6 +1,6 @@
 #!/usr/bin/env node
 
-const zet = require('./build/Release/zet');
+const zetjs = require('./zetjs');
 
-const obj = new zet.Index();
+const obj = new zetjs.Index();
 console.log(obj.search('moby', 0, 10));
diff --git a/zetjs.js b/zetjs.js
new file mode 100644 (file)
index 0000000..18890e0
--- /dev/null
+++ b/zetjs.js
@@ -0,0 +1 @@
+module.exports = require('./build/Release/zet');