@mountainpass/addressr 1.0.265 → 1.0.267

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/README.md CHANGED
@@ -14,7 +14,6 @@
14
14
 
15
15
  ![Uptime Robot ratio (30 days)](https://img.shields.io/uptimerobot/ratio/m788652244-3e35661f9886333310f4dc2f?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAFBlWElmTU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAQKADAAQAAAABAAAAQAAAAABUjGyuAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgoZXuEHAAAI/0lEQVR4Ae1a3W9cxRWfM/furuNvCI5xhJ2U2EQhtKEKkoNAqiukqrz0LS99qSrxISEhFAnx7D8AARIqD+1LxStVJUBqRFVVLlUVCPQj4ABpjPLhQILNOs7aa3t3753D79ybtffurndn734EiZ0o3r13z8w553fOnDlnZpTqti4CXQS6CHQR6CLQReCHigB9HxQ/ySedW58c6Flz/VRKucmCQ7pcLnaNl1zz8m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3LhG7SaWVyRyOZz+uLzg05BPwzFhiTG2vQp0oQ7xuil5SCX96KavxsD4EaJNByakcpqljlLGaG1t3g4wvZfrRbHHlicL71V1jIAhMljX7y033Dux45y5BgrVgt2kMI9xJ3+vgaiBra2t/ZOZ/kG1ydecfz8ubmjb0RiTksBgKvSo5+dOqRdnpLLCVEh7tST7Mhx1uPCubNHfleRijcdBCNqIbDInRy5lmK/Px8ZocUPsLyhDVLJL6opL8xa6wG3xZcjM7mWIjcz5HKCzOMWa2YxXGh5x6jP/3nkte2oX96xLQAIEzk4kWspcjMDZkBE7ywIyDpXfJW7sJvli0C0DYCAAWKCXEvRrnMIAQGXJxDP2woEzqqw1CEj/rp3Sy/89djLsnzWbO0F4DbrRxdP7eFNPiiXE+R8vqZEsX6EuyOJwJ2wWxrr/OhDi1+XLnW1huwIAIEAuJDw+KdbQ5TcHFe+MyJH1JLFhMLFmR7iTfApKceR2zuOcy27nvmmNMkJx679t3MAFOWQu8O4nJDwEveiMMLpcnBxGkmPzfQIlRZrSz0flLTGW8YJ33LpxaciK5vPzgNQItWTF59PpT3Tj4Mj3BugAdwQ60N1sgc5T0WKzsrL4drUJit3DUXkWt5Nrg9c3ZOtdQ22hNWuX+8oABGp4Bkzc0ov71N6IpmukOtqfi+PLCkzNzOL225hIRPp333oItBFoItAF4HGEfgORzWQ8kS7XycAAAAASUVORK5CYII=)
16
16
 
17
-
18
17
  # About
19
18
 
20
19
  Australian Address Validation, Search and Autocomplete
@@ -65,7 +64,7 @@ Or for peace of mind for your mission critical solutions, get commercial support
65
64
  - [How it Works](#how-it-works)
66
65
  - [Additional Settings](#additional-settings)
67
66
  - [System requirements](#system-requirements)
68
- - [Elastic Search:](#elastic-search)
67
+ - [Open Search](#open-search)
69
68
  - [Addressr Loader](#addressr-loader)
70
69
  - [Default](#default)
71
70
  - [With Geocoding enabled](#with-geocoding-enabled)
@@ -76,21 +75,27 @@ Or for peace of mind for your mission critical solutions, get commercial support
76
75
  ## Self Hosted
77
76
 
78
77
  1. Install addressr
78
+
79
79
  ```
80
80
  npm install @mountainpass/addressr -g
81
81
  ```
82
+
82
83
  NOTE: If you are running windows, you'll need to use [wsl](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
83
- 2. Start elastic search. For example run
84
+ 2. Start open search. For example run
85
+
84
86
  ```
85
- docker pull docker.elastic.co/elasticsearch/elasticsearch:7.9.2
86
- docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.9.2
87
+ docker pull opensearchproject/opensearch:1.2.4
88
+ docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "plugins.security.disabled=true" opensearchproject/opensearch:1.2.4
87
89
  ```
90
+
88
91
  3. Start API server. In a second window run:
89
- ```
92
+
93
+ ```sh
90
94
  export ELASTIC_PORT=9200
91
95
  export ELASTIC_HOST=localhost
92
96
  addressr-server-2
93
97
  ```
98
+
94
99
  4. Setup the env vars for the data loader. In a third window run:
95
100
 
96
101
  ```
@@ -130,16 +135,20 @@ Or for peace of mind for your mission critical solutions, get commercial support
130
135
  - WA
131
136
 
132
137
  5. Run data Loader. In the third window run:
138
+
133
139
  ```
134
140
  addressr-loader
135
141
  ```
136
- 6. OK, so we stretched the truth a bit with the "Quick Start" heading. The truth is that it takes quite a while to download, store and index the 13+ million addresses from data.gov.au. So make a coffee, or tea, or find something else to do and come back in about an hour when it's done.
142
+
143
+ 6. OK, so we stretched the truth a bit with the "Quick Start" heading. The truth is that it takes quite a while to download, store and index the 13+ million addresses from [data.gov.au](http://data.gov.au/). So make a coffee, or tea, or find something else to do and come back in about an hour when it's done.
137
144
  7. Search for an address using the command line
145
+
138
146
  ```
139
147
  curl -i http://localhost:8080/addresses?q=LEVEL+25,+TOWER+3
140
148
  ```
149
+
141
150
  8. An updated G-NAF is released every 3 months. Put `addressr-loader` in a cron job or similar to keep addressr regularly updated
142
- 9. Wire you address form up to the address-server api. The easiest way to do this is by using the [waychaser](https://waychaser.io) library as follows
151
+ 9. Wire you address form up to the address-server api.
143
152
 
144
153
  ## How it Works
145
154
 
@@ -149,38 +158,34 @@ Or for peace of mind for your mission critical solutions, get commercial support
149
158
 
150
159
  | Environment Variable | Value | Description | Default |
151
160
  | -------------------- | ----------- | ----------------------------------------------------- | ------- |
152
- | ELASTIC_PROTOCOL | http | Connect to elastic search over http | ✅ |
153
- | ELASTIC_PROTOCOL | https | Connect to elastic search over https | |
154
- | ELASTIC_USERNAME | _blank_ | Connect to elastic search without authentication | ✅ |
155
- | ELASTIC_USERNAME | _non-blank_ | Connect to elastic search with the specified username | |
156
- | ELASTIC_PASSWORD | _blank_ | Connect to elastic search without authentication | ✅ |
157
- | ELASTIC_PASSWORD | _non-blank_ | Connect to elastic search with the specified password | |
158
- | ELASTIC_PASSWORD | _non-blank_ | Connect to elastic search with the specified password | |
161
+ | ELASTIC_PROTOCOL | http | Connect to open search over http | ✅ |
162
+ | ELASTIC_PROTOCOL | https | Connect to open search over https | |
163
+ | ELASTIC_USERNAME | _blank_ | Connect to open search without authentication | ✅ |
164
+ | ELASTIC_USERNAME | _non-blank_ | Connect to open search with the specified username | |
165
+ | ELASTIC_PASSWORD | _blank_ | Connect to open search without authentication | ✅ |
166
+ | ELASTIC_PASSWORD | _non-blank_ | Connect to open search with the specified password | |
159
167
  | PAGE_SIZE | 8 | Number or records to return in a search | ✅ |
160
168
 
161
- NOTE: When adjusting PAGE_SIZE, you should take into account how quickly you want the initial results returned
162
- to the user. In many use cases, you want this to be as fast as possible. If you need show more results to the
163
- user, you are often better off leaving it a 8 and using the paging links to get more results while you are
164
- displaying the first 8.
169
+ NOTE: When adjusting PAGE_SIZE, you should take into account how quickly you want the initial results returned to the user. In many use cases, you want this to be as fast as possible. If you need show more results to the user, you are often better off leaving it a 8 and using the paging links to get more results while you are displaying the first 8.
165
170
 
166
171
  Why is the default 8 and not 10? [Mechanical Sympathy](https://dzone.com/articles/mechanical-sympathy)
167
172
 
168
173
  ## System requirements
169
174
 
170
- ### Elastic Search:
175
+ ### Open Search
171
176
 
172
- elasticsearch-oss >= 7.9.2 with 1.4GiB of memory
177
+ opensearch >= 1.2.4 with 1.4GiB of memory
173
178
 
174
179
  ### Addressr Loader
175
180
 
176
181
  #### Default
177
182
 
178
- Node JS >= 11.14.0 with 1GiB of memory
183
+ Node.js >= 12.11.0 with 1GiB of memory
179
184
 
180
185
  #### With Geocoding enabled
181
186
 
182
- Node JS >= 11.14.0 with 8GiB of memory
187
+ Node.js >= 12.11.0 with 8GiB of memory
183
188
 
184
189
  ### Addressr Server
185
190
 
186
- Node JS >= 11.14.0 with 64MiB of memory
191
+ Node.js >= 12.11.0 with 64MiB of memory
@@ -397,7 +397,7 @@ definitions:
397
397
  example: RMB
398
398
  maxLength: 3
399
399
  number:
400
- type: string
400
+ type: integer
401
401
  example: '20114'
402
402
  maxLength: 6
403
403
  suffix:
package/api/swagger.yaml CHANGED
@@ -411,7 +411,7 @@ definitions:
411
411
  example: RMB
412
412
  maxLength: 3
413
413
  number:
414
- type: string
414
+ type: integer
415
415
  example: '20114'
416
416
  maxLength: 6
417
417
  suffix:
@@ -397,7 +397,7 @@ definitions:
397
397
  example: RMB
398
398
  maxLength: 3
399
399
  number:
400
- type: string
400
+ type: integer
401
401
  example: '20114'
402
402
  maxLength: 6
403
403
  suffix:
@@ -411,7 +411,7 @@ definitions:
411
411
  example: RMB
412
412
  maxLength: 3
413
413
  number:
414
- type: string
414
+ type: integer
415
415
  example: '20114'
416
416
  maxLength: 6
417
417
  suffix:
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+ // Use Node 16 or above to run this script.
3
+ // `node build.js` will run this script.
4
+ //
5
+ // This script will call various NPM commands to build the application
6
+ // using the Docker images as per the settings below
7
+ // Overall
8
+ // Node 16 on CI server (GitHub Actions) calls this script
9
+ // This script calls NPM commands.
10
+ // NPM commands call shell scripts.
11
+
12
+ /*
13
+ Stuff like deploy should use dagger.io because it has specific dependencies like terraform
14
+ or we could have convetions in the npm scripts that they call dagger.io if needed but otherwise
15
+ they're just normal npm scripts.
16
+
17
+ In this way dagger becomes our way to compose and orchestrate our build and deploy scripts
18
+
19
+ actions:
20
+ scripts for doing stuff.
21
+
22
+
23
+ */
24
+ "use strict";
25
+
26
+ var _dagger = require("@dagger.io/dagger");
27
+
28
+ // initialize Dagger client
29
+ console.log('starting...');
30
+ (0, _dagger.connect)(async client => {
31
+ // get reference to the local project
32
+ const source = client.host().directory("."); // get Node image
33
+
34
+ const node = client.container().from("node:12.11.0"); // mount cloned repository into Node image
35
+
36
+ const runner = client.container({
37
+ id: node
38
+ }).withMountedDirectory("/src", source).withWorkdir("/src").withExec(["npm", "run", "hello"]);
39
+ });
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+ // Use Node 16 or above to run this script.
3
+ // `node build.js` will run this script.
4
+ //
5
+ // This script will call various NPM commands to build the application
6
+ // using the Docker images as per the settings below
7
+ // Overall
8
+ // Node 16 on CI server (GitHub Actions) calls this script
9
+ // This script calls NPM commands.
10
+ // NPM commands call shell scripts.
11
+
12
+ /*
13
+ Stuff like deploy should use dagger.io because it has specific dependencies like terraform
14
+ or we could have convetions in the npm scripts that they call dagger.io if needed but otherwise
15
+ they're just normal npm scripts.
16
+
17
+ In this way dagger becomes our way to compose and orchestrate our build and deploy scripts
18
+
19
+ actions:
20
+ scripts for doing stuff.
21
+
22
+
23
+ */
24
+ "use strict";
25
+
26
+ var _dagger = require("@dagger.io/dagger");
27
+
28
+ var _envPaths = require("env-paths");
29
+
30
+ var _envPaths2 = _interopRequireDefault(_envPaths);
31
+
32
+ var _fs = require("fs");
33
+
34
+ var _fs2 = _interopRequireDefault(_fs);
35
+
36
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+
38
+ const cacheDir = `${(0, _envPaths2.default)("", {
39
+ suffix: ""
40
+ }).cache}/dagger`;
41
+ const binLocation = `${cacheDir}/dagger-0.3.9`;
42
+
43
+ if (!process.env._EXPERIMENTAL_DAGGER_CLI_BIN && _fs2.default.existsSync(binLocation)) {
44
+ process.env._EXPERIMENTAL_DAGGER_CLI_BIN = binLocation;
45
+ console.log(`using already downloaded '${binLocation}'`);
46
+ }
47
+
48
+ console.log('connecting...');
49
+ (0, _dagger.connect)(async client => {
50
+ console.log('\t...connected'); // get reference to the local project
51
+
52
+ client.log;
53
+ const workspace = client.host().directory("."); //, { exclude: ["node_modules/"] })
54
+ // get Node image
55
+
56
+ const node = client.container().from("node:14.21.2").withMountedDirectory("/workspace", workspace).withWorkdir("/workspace");
57
+ console.log(await node.withExec(["npm", "--version"]).stdout());
58
+ const installed = node; // .withExec(["npm", "install"])
59
+ // const exitCode = await installed.exitCode()
60
+ // console.log({ exitCode });
61
+ // const stdout = await installed.stdout()
62
+ // const stderr = await installed.stderr()
63
+ // const version = await node.withExec(["node", "-v"]).stdout()
64
+ // print output
65
+ // console.log("Hello from Dagger and Node " + version)
66
+
67
+ await installed.withExec(["npm", "run", "genversion"]).file('version.js').export('dagger-version.js');
68
+ console.log(stdout);
69
+ console.error(stderr);
70
+ /*
71
+ npm run genversion
72
+ npm run check-licenses
73
+ npm run cover:nodejs:nogeo
74
+ npm run cover:rest:nogeo
75
+ */
76
+
77
+ installed.withExec(["npm", "run", "build"]); // await runner.exitCode()
78
+ // .directory("node_modules/")
79
+ // .export("./dagger_node_modules")
80
+ });
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ // generated by genversion
7
+ const version = exports.version = '1.0.263';
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require('fs');
5
+
6
+ const packageJson = require('../package.json');
7
+
8
+ const shell = require('shelljs');
9
+
10
+ const {
11
+ zip
12
+ } = require('zip-a-folder');
13
+ /**
14
+ Creates a deployment package.json file based of an existing package.json file
15
+ The way AWS beanstalk node.js deployments work, is that they use the package.json
16
+ to run `npm install` and then `npm start` to start the application.
17
+
18
+ Doing it the AWS documented way with the original package.json, you'd basically download
19
+ ALL of the dependencies (prod and dev), build the application (e.g. transpiling etc) and
20
+ then start it. This can be quite slow and redundant if you've already built the application
21
+ in your CI/CD. It works great for code that doesn't require transpiling, but for code that
22
+ does, it's a bit of a waste.
23
+
24
+ So, instead, we create a deployment package.json that depends on the original package.
25
+ When AWS does it's thing, all it's downloading is the original package and it's dependencies
26
+ and then starting the application. This is much faster and more efficient. In our experience
27
+ this is much faster than both the AWS documented way and docker deployments. YMMV.
28
+
29
+ TODO: Apparently if you include a node_modules folder in the deployment, AWS will use that
30
+ instead of doing an npm install. This could be even faster, but we haven't tried it yet.
31
+ See https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/nodejs-platform-dependencies.html#nodejs-platform-nodemodules
32
+ **/
33
+
34
+
35
+ function createPackageJson(context, filepath) {
36
+ const {
37
+ name,
38
+ version,
39
+ description,
40
+ author,
41
+ contributors,
42
+ engines,
43
+ keywords,
44
+ license,
45
+ private: privateKey,
46
+ repository,
47
+ bugs,
48
+ homepage
49
+ } = context;
50
+ const newPackageJson = {
51
+ "name": `${name}-deployment`,
52
+ version,
53
+ description,
54
+ author,
55
+ contributors,
56
+ engines,
57
+ keywords,
58
+ license,
59
+ private: privateKey,
60
+ repository,
61
+ bugs,
62
+ homepage,
63
+ "scripts": {
64
+ // TODO: see if we can use the context.main as the start script
65
+ "start": "addressr-server-2"
66
+ },
67
+ "dependencies": {
68
+ [name]: version
69
+ }
70
+ };
71
+ fs.writeFileSync(filepath, JSON.stringify(newPackageJson, null, 2));
72
+ }
73
+
74
+ async function createDeploymentArchive(deploymentDir) {
75
+ shell.mkdir('-p', deploymentDir);
76
+ createPackageJson(packageJson, `${deploymentDir}/package.json`);
77
+ const archiveName = packageJson.name.replace('@', '').replace('/', '-');
78
+ await zip(`${deploymentDir}/`, `${archiveName}-deployment-${packageJson.version}.zip`);
79
+ }
80
+
81
+ createDeploymentArchive('./deployment');
@@ -1105,19 +1105,24 @@ async function getFiles(currentDir, baseDir) {
1105
1105
 
1106
1106
  function countFileLines(filePath) {
1107
1107
  return new Promise((resolve, reject) => {
1108
- let lineCount = 0;
1109
-
1110
- _fs2.default.createReadStream(filePath).on('data', buffer => {
1111
- let idx = -1;
1112
- lineCount--; // Because the loop will run once for idx=-1
1113
-
1114
- do {
1115
- idx = buffer.indexOf(10, idx + 1);
1116
- lineCount++;
1117
- } while (idx !== -1);
1118
- }).on('end', () => {
1119
- resolve(lineCount);
1120
- }).on('error', reject);
1108
+ const readStream = _fs2.default.createReadStream(filePath, 'utf-8');
1109
+
1110
+ let lines = 0;
1111
+ let last = undefined;
1112
+ readStream.on('data', function (chunk) {
1113
+ lines += chunk.split('\n').length - 1;
1114
+ last = chunk[chunk.length - 1];
1115
+ });
1116
+ readStream.on('end', function () {
1117
+ if (last !== '\n') {
1118
+ ++lines;
1119
+ }
1120
+
1121
+ resolve(lines);
1122
+ });
1123
+ readStream.on('error', function (err) {
1124
+ reject(err);
1125
+ });
1121
1126
  });
1122
1127
  }
1123
1128
 
@@ -8,8 +8,6 @@ var _elasticsearch = require("../client/elasticsearch");
8
8
 
9
9
  var _printVersion = require("../service/printVersion");
10
10
 
11
- var _swagger = require("../swagger");
12
-
13
11
  var _waycharterServer = require("./waycharterServer");
14
12
 
15
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -41,7 +41,7 @@ let server;
41
41
  const PAGE_SIZE = process.env.PAGE_SIZE || 8;
42
42
 
43
43
  function startRest2Server() {
44
- app.use((request, response, next) => {
44
+ app.use((_request, response, next) => {
45
45
  if (process.env.ADDRESSR_ACCESS_CONTROL_ALLOW_ORIGIN !== undefined) {
46
46
  response.append('Access-Control-Allow-Origin', process.env.ADDRESSR_ACCESS_CONTROL_ALLOW_ORIGIN);
47
47
  }
package/lib/version.js CHANGED
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  // generated by genversion
7
- const version = exports.version = '1.0.265';
7
+ const version = exports.version = '1.0.267';
package/package.json CHANGED
@@ -1,19 +1,21 @@
1
1
  {
2
2
  "name": "@mountainpass/addressr",
3
- "version": "1.0.265",
3
+ "version": "1.0.267",
4
4
  "description": "Australian Address Validation, Search and Autocomplete",
5
5
  "author": "Mountain Pass <addressr@mountain-pass.com.au>",
6
6
  "contributors": [
7
7
  "Tom Howard <tom@mountain-pass.com.au>"
8
8
  ],
9
9
  "engines": {
10
- "node": ">=12.11.0"
10
+ "node": ">=14.21.2"
11
11
  },
12
12
  "config": {
13
13
  "localport": "6060"
14
14
  },
15
15
  "scripts": {
16
- "hmm": "echo mountainpass-addressr-${npm_package_version}.tgz",
16
+ "docs:build": "log4brains build",
17
+ "docs:preview": "log4brains preview",
18
+ "deploy": "deploy/deploy.sh",
17
19
  "requirements-check": "scripts/check-version.js",
18
20
  "postinstall": "npm run requirements-check",
19
21
  "prestart:loader:babel:OT": "npm run build && cp -r target lib/.",
@@ -40,7 +42,7 @@
40
42
  "start:loader:geo:WA:prod": ". .env && COVERED_STATES=WA PORT=$npm_package_config_localport NODE_OPTIONS=--max_old_space_size=8196 babel-node loader.js ",
41
43
  "start:server:OT": "ES_INDEX_NAME=ot DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport babel-node server.js",
42
44
  "start:server": "DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport babel-node server.js",
43
- "start:server:prod": ". .env && PORT=$npm_package_config_localport DEBUG=error babel-node server.js",
45
+ "start:server:prod": ". .env && PORT=$npm_package_config_localport DEBUG=error,api,express:*,swagger-tools*,test,es babel-node src/server2.js",
44
46
  "start:server2:prod": ". .env && ADDRESSR_ACCESS_CONTROL_ALLOW_ORIGIN=null ADDRESSR_ACCESS_CONTROL_EXPOSE_HEADERS=* PORT=$npm_package_config_localport DEBUG=error,api,express:*,swagger-tools*,test,es babel-node src/server2.js",
45
47
  "start:server:OT:prod": ". .env && ES_INDEX_NAME=ot PORT=$npm_package_config_localport DEBUG=error,api,express:*,swagger-tools*,test,es babel-node server.js",
46
48
  "start:server:preinstalled": "ES_INDEX_NAME=test DEBUG=error,api,express:*,swagger-tools*,test,es PORT=$npm_package_config_localport addressr-server",
@@ -150,6 +152,7 @@
150
152
  "papaparse": "^5.0.0",
151
153
  "progress": "^2.0.3",
152
154
  "semver": "^7.3.2",
155
+ "shelljs": "^0.8.5",
153
156
  "swagger-tools": "^0.10.4",
154
157
  "unzip-stream": "^0.3.0",
155
158
  "uri-template-lite": "^20.5.0",
@@ -166,6 +169,7 @@
166
169
  "@babel/preset-react": "^7.0.0",
167
170
  "@babel/register": "^7.7.0",
168
171
  "@babel/runtime": "^7.5.0",
172
+ "@dagger.io/dagger": "^0.3.1",
169
173
  "@istanbuljs/nyc-config-babel": "^3.0.0",
170
174
  "@mountainpass/waychaser": "^4.0.0",
171
175
  "@windyroad/cucumber-js-throwables": "^1.0.4",
@@ -175,7 +179,7 @@
175
179
  "babel-preset-env": "^1.7.0",
176
180
  "chai": "^4.2.0",
177
181
  "cucumber": "^5.1.0",
178
- "dockerode": "^3.3.0",
182
+ "dockerode": "^3.3.4",
179
183
  "eslint": "^7.9.0",
180
184
  "eslint-config-prettier": "^8.0.0",
181
185
  "eslint-plugin-chai-friendly": "^0.7.1",
@@ -194,13 +198,15 @@
194
198
  "istanbul-middleware": "^0.2.2",
195
199
  "license-checker": "^25.0.1",
196
200
  "lint-staged": "^11.0.0",
201
+ "log4brains": "^1.0.1",
197
202
  "ngrok": "^4.0.1",
198
203
  "nodemon": "^2.0.4",
199
204
  "npm-check": "^5.9.0",
200
205
  "npm-run-all": "^4.1.5",
201
206
  "nyc": "^15.1.0",
202
207
  "prettier": "^2.1.0",
203
- "prettier-config-standard": "^4.0.0"
208
+ "prettier-config-standard": "^4.0.0",
209
+ "zip-a-folder": "^1.1.3"
204
210
  },
205
211
  "repository": {
206
212
  "type": "git",
@@ -209,7 +215,7 @@
209
215
  "bugs": {
210
216
  "url": "https://github.com/mountain-pass/addressr/issues"
211
217
  },
212
- "homepage": "https://addressr.mountain-pass.com.au",
218
+ "homepage": "https://addressr.io",
213
219
  "lint-staged": {
214
220
  "*.{js,jsx}": [
215
221
  "eslint --fix",