Browse Source

Allow auspice code to be imported via node's `require`

This commit begins exporting some functions which may then be available to node packages which import auspice (e.g. via `const auspice = require("auspice")`)

These are intended to be "helper functions" for those wishing to write their own auspice server, i.e. a server which handles the GET requests originating from a auspice client.
master
james hadfield 3 years ago
parent
commit
0751dd4a6c
  1. 16
      index.js
  2. 1
      package.json

16
index.js

@ -0,0 +1,16 @@
/** This file exports the functions / objects available to node packages
* which import auspice (e.g. via `const auspice = require("auspice")`)
*
* These are intended to be "helper functions" for those wishing to write
* their own auspice server, i.e. a server which handles the GET
* requests originating from a auspice client.
*/
const convertFromV1 = require("./cli/server/convertJsonSchemas").convertFromV1;
const parseNarrativeFile = require("./cli/server/parseNarrative").default;
module.exports = {
convertFromV1,
parseNarrativeFile
};

1
package.json

@ -13,6 +13,7 @@
"bin": {
"auspice": "./auspice.js"
},
"main": "index.js",
"scripts": {
"create-data-dir": "./scripts/create-data-dir.sh",
"postinstall": "npm run create-data-dir",

Loading…
Cancel
Save