cht-conf 3.8.0 → 3.9.3
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/.husky/commit-msg +4 -0
- package/.releaserc.json +22 -0
- package/CHANGELOG.md +358 -0
- package/Dockerfile +2 -2
- package/README.md +45 -21
- package/commitlint.config.js +1 -0
- package/package.json +13 -4
- package/src/fn/move-contacts.js +34 -10
- package/src/lib/api.js +18 -0
- package/src/lib/archiving-api.js +2 -0
- package/src/lib/main.js +5 -8
package/.releaserc.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"plugins": [
|
|
3
|
+
"@semantic-release/commit-analyzer",
|
|
4
|
+
"@semantic-release/release-notes-generator",
|
|
5
|
+
"@semantic-release/npm",
|
|
6
|
+
"@semantic-release/github",
|
|
7
|
+
[
|
|
8
|
+
"@semantic-release/changelog",
|
|
9
|
+
{
|
|
10
|
+
"changelogFile": "CHANGELOG.md"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
"@semantic-release/git",
|
|
15
|
+
{
|
|
16
|
+
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
|
|
17
|
+
"message": "chore(release): ${nextRelease.version} [skip ci]"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
],
|
|
21
|
+
"branches": ["master"]
|
|
22
|
+
}
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
## [3.9.3](https://github.com/medic/cht-conf/compare/v3.9.2...v3.9.3) (2021-12-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **#455:** allow empty translation constants ([ac170d7](https://github.com/medic/cht-conf/commit/ac170d7cce13a6a500d89884d4ca63801f06a969)), closes [#455](https://github.com/medic/cht-conf/issues/455)
|
|
7
|
+
|
|
8
|
+
## [3.9.2](https://github.com/medic/cht-conf/compare/v3.9.1...v3.9.2) (2021-12-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Performance Improvements
|
|
12
|
+
|
|
13
|
+
* **#432:** refactor the moving of reports to use a recursive function to improve performance ([c17b43b](https://github.com/medic/cht-conf/commit/c17b43b4d89b29b813db4be6e0f2d2c0a1e6c94d)), closes [#432](https://github.com/medic/cht-conf/issues/432)
|
|
14
|
+
|
|
15
|
+
## [3.9.1](https://github.com/medic/cht-conf/compare/v3.9.0...v3.9.1) (2021-11-16)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **#448:** Bump Ubuntu version and Node version in container to fix docker usage. Updates to readme ([25cb955](https://github.com/medic/cht-conf/commit/25cb955377eea6c6a0a7cb3953d889b57c93884b))
|
|
21
|
+
|
|
22
|
+
# [3.9.0](https://github.com/medic/cht-conf/compare/v3.8.0...v3.9.0) (2021-11-01)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **#413:** fix tags so that next release is 3.9.0 ([6eea489](https://github.com/medic/cht-conf/commit/6eea489804cf0de3c11fe855d2b285e41553439d))
|
|
28
|
+
* **#413:** implement continuous delivery ([244203e](https://github.com/medic/cht-conf/commit/244203e341fe46e11dcb7249fd3a77dcb8d1f43c)), closes [#413](https://github.com/medic/cht-conf/issues/413)
|
|
29
|
+
* **#413:** provide medic-ci with write permissions to npm ([fd2522e](https://github.com/medic/cht-conf/commit/fd2522ef9c40f697dff2c71a3b638a225cf7adfe)), closes [#413](https://github.com/medic/cht-conf/issues/413)
|
|
30
|
+
* **#413:** publish to npm with automation token ([1cf8550](https://github.com/medic/cht-conf/commit/1cf8550cca2d404342e28d0a9086c837fa2a011e)), closes [#413](https://github.com/medic/cht-conf/issues/413)
|
|
31
|
+
* **#413:** use GH_ADMIN_TOKEN for release workflow ([0f1c581](https://github.com/medic/cht-conf/commit/0f1c581cc5e0990881ab6a99f6f26a040144bfbc)), closes [#413](https://github.com/medic/cht-conf/issues/413)
|
|
32
|
+
|
|
33
|
+
## 3.8.0
|
|
34
|
+
|
|
35
|
+
### Ability to edit a contact type
|
|
36
|
+
|
|
37
|
+
It is now possible to edit a contact type with the `edit-contacts` action. Additionally, `edit-contacts` accepts a new flag `--updateOfflineDocs`, that allows editing json docs that already exist in the directory provided in `--docDirectoryPath` instead of downloading the docs from the database.
|
|
38
|
+
|
|
39
|
+
[#408](https://github.com/medic/cht-conf/issues/408)
|
|
40
|
+
|
|
41
|
+
### Fail early if .eslintrc file is not provided
|
|
42
|
+
|
|
43
|
+
Running the `compile-app-settings` command now fails early and provides a more descriptive error message to users.
|
|
44
|
+
|
|
45
|
+
[#333](https://github.com/medic/cht-conf/issues/333)
|
|
46
|
+
|
|
47
|
+
### Check to make sure CHT instance is up
|
|
48
|
+
|
|
49
|
+
Commands that require an instance now fail with a more descriptive error message if the instance provided is not reachable
|
|
50
|
+
|
|
51
|
+
[#380](https://github.com/medic/cht-conf/issues/380)
|
|
52
|
+
|
|
53
|
+
## 3.7.0
|
|
54
|
+
|
|
55
|
+
### The repository has been renamed to `cht-conf`.
|
|
56
|
+
|
|
57
|
+
Additionally:
|
|
58
|
+
- the `medic-conf` cli command is now deprecated, in favor of `cht`.
|
|
59
|
+
- the `medic-logs` cli command is now deprecated, in favor of `cht-logs`
|
|
60
|
+
- the `pngout-medic` cli command is now deprecated, in favor of `pngout-cht`
|
|
61
|
+
|
|
62
|
+
### Default "resolvedIf" function for tasks
|
|
63
|
+
|
|
64
|
+
Task definitions can now omit the `resolvedIf` function. In this case, the task is resolved by any report assigned to the contact that matches the `form` defined in the action of type `report`.
|
|
65
|
+
For more information, please check the [documentation](https://docs.communityhealthtoolkit.org/apps/reference/tasks/#default-resolvedif-method).
|
|
66
|
+
|
|
67
|
+
[#107](https://github.com/medic/cht-conf/issues/107)
|
|
68
|
+
|
|
69
|
+
## 3.6.0
|
|
70
|
+
|
|
71
|
+
### Tasks actions `modifyContent` functions now receive the event as a parameter
|
|
72
|
+
|
|
73
|
+
To support task logic that depends on knowing which event the emission is generated for, `modifyContent` now receives a fourth parameter containing the event data.
|
|
74
|
+
For more information, please check the [documentation](https://docs.communityhealthtoolkit.org/apps/reference/tasks/#tasksjs).
|
|
75
|
+
|
|
76
|
+
[#398](https://github.com/medic/cht-conf/issues/398)
|
|
77
|
+
|
|
78
|
+
## 3.5.0
|
|
79
|
+
|
|
80
|
+
### Forms are validated before being uploaded
|
|
81
|
+
|
|
82
|
+
When uploading forms to CHT Core v3.11.0 or above these are submitted for validation to ensure they will work when uploaded.
|
|
83
|
+
|
|
84
|
+
[#331](https://github.com/medic/cht-conf/issues/331)
|
|
85
|
+
|
|
86
|
+
### Check that the code is up to date with the git repo
|
|
87
|
+
|
|
88
|
+
Warns when pushing configuration that isn't up to date with the git repo.
|
|
89
|
+
|
|
90
|
+
[#64](https://github.com/medic/cht-conf/issues/64)
|
|
91
|
+
|
|
92
|
+
### Bug fixes
|
|
93
|
+
|
|
94
|
+
- [#358](https://github.com/medic/cht-conf/issues/358): Can't create task action with type "contact"
|
|
95
|
+
- [#387](https://github.com/medic/cht-conf/issues/387): Can't upload-app-settings on Node lower than 12
|
|
96
|
+
|
|
97
|
+
## 3.4.0
|
|
98
|
+
|
|
99
|
+
### Support for uploading branding and partners docs
|
|
100
|
+
|
|
101
|
+
Two new actions, `upload-branding` and `upload-partners`, permit uploading branding and partners images, respectively.
|
|
102
|
+
For more information, please check the [documentation](https://docs.communityhealthtoolkit.org/apps/reference/resources/#branding).
|
|
103
|
+
|
|
104
|
+
[#167](https://github.com/medic/cht-conf/issues/167)
|
|
105
|
+
|
|
106
|
+
### Modular app_settings and updated folder structure
|
|
107
|
+
|
|
108
|
+
The `forms` and `schedules` sections of `app_settings` should now be configured individually, in separate files, while other configs should be added to the new `base_settings.json` file. All settings will be compiled into the `app_settings.json`, which should now no longer be edited manually.
|
|
109
|
+
For more information, please check the [documentation](https://docs.communityhealthtoolkit.org/apps/reference/app-settings/).
|
|
110
|
+
|
|
111
|
+
[#214](https://github.com/medic/cht-conf/issues/214)
|
|
112
|
+
[#68](https://github.com/medic/cht-conf/issues/68)
|
|
113
|
+
|
|
114
|
+
### Improvements
|
|
115
|
+
|
|
116
|
+
- [#254](https://github.com/medic/cht-conf/issues/254): Add validation to the upload custom translations function
|
|
117
|
+
- [#269](https://github.com/medic/cht-conf/issues/269): Warn about deprecated transitions when uploading app-settings
|
|
118
|
+
|
|
119
|
+
### Bug fixes
|
|
120
|
+
|
|
121
|
+
- [#345](https://github.com/medic/cht-conf/issues/345): Warn config overwrite falsely alerts about changes when uploading certain types of attachments
|
|
122
|
+
- [#164](https://github.com/medic/cht-conf/issues/164): Declarative config appliesToType is indicated as optional for fields and cards but we do require them
|
|
123
|
+
- [#377](https://github.com/medic/cht-conf/issues/377): Incorrect warning when specifying hidden_fields
|
|
124
|
+
- [#382](https://github.com/medic/cht-conf/issues/382): Contacts with hardcoded types that also have a `contact_type` property don't get the correct contact_summary fields and don't count towards target goals
|
|
125
|
+
|
|
126
|
+
## 3.3.0
|
|
127
|
+
|
|
128
|
+
### Support for headless execution
|
|
129
|
+
|
|
130
|
+
The `--force` argument can now be provided to make it possible to execute commands in a scripted environment by skipping any prompts. This is more dangerous as cht-conf will no longer warn about possible configuration errors, so it's recommended this option is only used when user input is not possible and you have independently verified that the configuration is correct.
|
|
131
|
+
|
|
132
|
+
[#307](https://github.com/medic/cht-conf/issues/307)
|
|
133
|
+
|
|
134
|
+
### Privacy policies
|
|
135
|
+
|
|
136
|
+
Privacy policies can now be uploaded using cht-conf. Read [the documentation](https://docs.communityhealthtoolkit.org/apps/guides/security/privacy-policy/) for more information.
|
|
137
|
+
|
|
138
|
+
[cht-core#6538](https://github.com/medic/cht-core/issues/6538)
|
|
139
|
+
|
|
140
|
+
### Bug fixes
|
|
141
|
+
|
|
142
|
+
- [#332](https://github.com/medic/cht-conf/issues/332): Uploading of multimedia is extremely limited
|
|
143
|
+
- [#273](https://github.com/medic/cht-conf/issues/273): Add configurable hierarchy support to doc references in csv-to-docs
|
|
144
|
+
- [#322](https://github.com/medic/cht-conf/issues/322): Missing optional appliesIf attribute on contact summary cards causes crash
|
|
145
|
+
- [#315](https://github.com/medic/cht-conf/issues/315): Error running csv-to-docs with null properties
|
|
146
|
+
- [#325](https://github.com/medic/cht-conf/issues/325): Task generation fails when given contactless reports
|
|
147
|
+
- [cht-core#6291](https://github.com/medic/cht-core/issues/6291): Allow specifying subject_key in properties
|
|
148
|
+
|
|
149
|
+
## 3.2.0
|
|
150
|
+
|
|
151
|
+
### Prompt before configuration overwrites
|
|
152
|
+
|
|
153
|
+
This new feature warns and prompts users when uploading a configuration if the configuration being overwritten is not the last known configuration. These warnings are comparable to a database write conflict. Previous versions of cht-conf would upload the new configuration overwriting whatever was there, resulting in users accidentally wiping out someone elses changes or changes made through the App Management webapp.
|
|
154
|
+
|
|
155
|
+
To detect accidental overwrites, cht-conf will generate two files - `.snapshots/remote.json` and `.snapshots/local.json`. These store the last known configuration on the server. The `remote.json` file should be commited with your configuration changes, and `local.json` should be added to the .gitignore since everyone's local environment is different. If changes are made to the configuration on the server using cht-conf or the App Management webapp without committing the `remote.json` file to your config repo, and then subsequently pulling the changes, then any attempt to upload configuration changes will be notified about the risk and prompted to either overwrite or cancel.
|
|
156
|
+
|
|
157
|
+
This feature was introduced but not announced in 3.1.0. In this release we have substantially changed the implementation, fixed some bugs, and improved the overall experience.
|
|
158
|
+
|
|
159
|
+
### Configuration is only uploaded if something has changed
|
|
160
|
+
|
|
161
|
+
As of this release no docs on the server will be touched unless some configuration has actually changed. This means the end users will not have to download docs with no actual difference giving them a better experience with upgrades.
|
|
162
|
+
|
|
163
|
+
[#271](https://github.com/medic/cht-conf/issues/271)
|
|
164
|
+
|
|
165
|
+
### New action to bulk-edit contacts
|
|
166
|
+
|
|
167
|
+
You can now bulk edit contacts at once by providing a CSV. For more information, read [the documentation](https://github.com/medic/cht-conf/blob/master/README.md#editing-contacts-across-the-hierarchy).
|
|
168
|
+
|
|
169
|
+
[#297](https://github.com/medic/cht-conf/issues/297)
|
|
170
|
+
|
|
171
|
+
## 3.1.0
|
|
172
|
+
|
|
173
|
+
### Declarative Configuration Support for Core Framework v3.8.0
|
|
174
|
+
|
|
175
|
+
The updates to tasks and targets in Core Framework v3.8.0 require additional data about the tasks and targets emitted by partner rules code. After upgrading to v3.8, the Tasks tab and Targets tab won't function until partner code is updated to send this new data. **Declarative configuration projects must deploy their configuration using cht-conf v3.1 or later for tasks and targets to function on the Core Framework v3.8.0**
|
|
176
|
+
|
|
177
|
+
It is still safe to deploy declarative configuration to any Core Framework version, including those prior to v3.8.
|
|
178
|
+
|
|
179
|
+
### Declarative Configuration Tasks/Targets Schema Validation
|
|
180
|
+
The updates to tasks and targets in Core Framework v3.8.0 allow for project members to write impact queries against Postgres to understand how tasks are behaving on users' phones. In previous versions of the declarative configuration system, some identification attributes were optional or able to be reused. This becomes problematic after the Core Framework v3.8.0 release because it will lead to data integrity issues if task or target elements are reorderd or removed from within the configuration.
|
|
181
|
+
|
|
182
|
+
`cht-conf` v3.1 guarantees clearer data integrity with the following changes to the declarative configuration schema:
|
|
183
|
+
|
|
184
|
+
* Task.name is now a required unique attribute
|
|
185
|
+
* Task.event[n].id is now a required unique attribute when there is more than one event
|
|
186
|
+
* Target.id although previously required, is now required to be unique
|
|
187
|
+
|
|
188
|
+
### Declarative Configuration Target "GroupBy"
|
|
189
|
+
Two new optional variables `groupBy` and `passesIfGroupCount` in the [declarative Target configuration schema](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md#targets) allows for target emissions to be counted and scored in groups. This allows targets to support more complex scenarios like the number of families receiving n household visits/family/month.
|
|
190
|
+
|
|
191
|
+
## 3.0.5
|
|
192
|
+
|
|
193
|
+
### Updates to purge configuration
|
|
194
|
+
|
|
195
|
+
cht-conf has changed the way it compiles purge configuration.
|
|
196
|
+
To configure purge, create a file `purge.js` in your project root. This file is a javascript module that should export an object containing your purge configuration:
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
module.exports = {
|
|
200
|
+
text_expression: 'at 12 am on Sunday',
|
|
201
|
+
run_every_days: 7,
|
|
202
|
+
fn: (userCtx, contact, reports, messages) => {
|
|
203
|
+
const old = Date.now() - (1000 * 60 * 60 * 24 * 365);
|
|
204
|
+
return [
|
|
205
|
+
...reports.filter(report => report.reported_date > old),
|
|
206
|
+
...messages.filter(message => message.reported_date > old),
|
|
207
|
+
].map(doc => doc._id);
|
|
208
|
+
},
|
|
209
|
+
};
|
|
210
|
+
```
|
|
211
|
+
Storing the purge function in `purging.js` is deprecated.
|
|
212
|
+
|
|
213
|
+
## 3.0.0
|
|
214
|
+
|
|
215
|
+
cht-conf v3.0 contains breaking changes! This release only impacts the `compile-app-settings` action, which impacts the configuration code in `tasks.js`, `targets.js`, `contact-summary.js`, and `contact-summary.templated.js`.
|
|
216
|
+
|
|
217
|
+
### Breaking Change - Static Analysis via ESLint
|
|
218
|
+
cht-conf has changed the engine we use for performing static analysis from [JSHint](https://jshint.com/) to [ESLint](https://eslint.org/). This grants authors more control over the static analysis rules which are enforced on their code. We provide a set of default rules, but you can change or add rules by creating an [.eslintrc file](https://eslint.org/docs/user-guide/configuring#using-configuration-files-1). The default static analysis rules which are enforced in cht-conf 3.0 are similar to the rules which were enforced in cht-conf 2.x, but details may be slightly different.
|
|
219
|
+
|
|
220
|
+
### Support for ECMAScript 6
|
|
221
|
+
In previous versions of cht-conf, configuration JavaScript was been limited to ECMAScript 5. [ECMAScript 6](http://es6-features.org/) is the next generation of the JavaScript language. To use ES6 in your JavaScript configuration code, add a `.eslintrc` file to your project directory with the following contents:
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
{
|
|
225
|
+
"env": {
|
|
226
|
+
"node": true,
|
|
227
|
+
"es6": true
|
|
228
|
+
},
|
|
229
|
+
"parserOptions": {
|
|
230
|
+
"ecmaVersion": 6
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
If your project is using [CHT Android](https://github.com/medic/cht-android) you must be running a version newer than v0.1.203 (March 2017) to use `ecmaVersion: 6`. ecmaVersions above 6 are not currently supported.
|
|
236
|
+
|
|
237
|
+
### Breaking Change - Modules
|
|
238
|
+
As part of our effort to leverage JavaScript standards, JavaScript configuration code should now use `require('./file')` or `import lib from './file';` to share code between multiple JavaScript files. The global `extras` object is no longer present and you may see the error `'extras' is not defined` when running `compile-app-settings`. This global object was a reference to `nools-extras.js` or `contact-summary-extras.js`, so you can achieve the same behavior by adding the line `var extras = require('./nools-extras');` or `import extras from './nools-extras';` to the top of your JavaScript. This gives configuration authors the flexibility to have multiple library files, and enables the sharing of code across projects.
|
|
239
|
+
|
|
240
|
+
You may also find it helpful to leverage third-party modules like [MomentJs](https://momentjs.com/) or [lodash](https://lodash.com/). You may install them using [npm](https://docs.npmjs.com/about-npm/) packages. For example, run `npm install moment` and then add `const moment = require('moment');` in your script. Ensure that you maintain a reasonable file size and memory footprint for your scripts. We support [tree shaking](https://webpack.js.org/guides/tree-shaking/) so use it when possible.
|
|
241
|
+
|
|
242
|
+
### Breaking Change - contact-summary.js as an ES Module
|
|
243
|
+
As part of our effort to leverage JavaScript standards and increase the testability of code, `contact-summary.js` should be a standard ES Module instead of using a bare return. This allows you to write standard unit tests for the file instead of needing a harness or custom wrapper.
|
|
244
|
+
|
|
245
|
+
`contact-summary.js` in cht-conf 1.x or 2.x:
|
|
246
|
+
```
|
|
247
|
+
return {
|
|
248
|
+
fields: [],
|
|
249
|
+
cards: [],
|
|
250
|
+
context: {},
|
|
251
|
+
};
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
`contact-summary.js` in cht-conf 3.0:
|
|
255
|
+
```
|
|
256
|
+
module.exports = {
|
|
257
|
+
fields: [],
|
|
258
|
+
cards: [],
|
|
259
|
+
context: {},
|
|
260
|
+
};
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Breaking Change - Declarative Configuration library is now internal
|
|
264
|
+
The [Declarative Configuration System](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md) explicitly provides documented functions which are meant to be re-used in configuration code (eg. [Utils](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md#utils)). In cht-conf 2.x and before, it was possible to also re-use some undocumented internals of the declarative library (common examples are `now`, `isReportValid()`, and `emitTargetInstance()`). In cht-conf 3.0, these internals and hidden as was intended. Documented interfaces remain unchanged.
|
|
265
|
+
|
|
266
|
+
### Breaking Change - Interface change in Target.emitCustom()
|
|
267
|
+
The Declarative Configuration [Target Schema](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md#target-schema) for `emitCustom` has changed to `function(emit, instance, contact, report)`. The default value is `(emit, instance) => emit(instance)`.
|
|
268
|
+
|
|
269
|
+
### Debug Mode for compile-app-settings
|
|
270
|
+
`cht --local compile-app-settings upload-app-settings -- --debug`
|
|
271
|
+
|
|
272
|
+
The `--debug` flag will change the behavior of `compile-app-settings` such that:
|
|
273
|
+
|
|
274
|
+
1. ESLint failures are logged as warnings instead of causing errors
|
|
275
|
+
1. Webpack warnings are logged as warnings instead of causing errors
|
|
276
|
+
1. Code minification is skipped to make it easier to debug your code
|
|
277
|
+
|
|
278
|
+
## 2.2.0
|
|
279
|
+
|
|
280
|
+
cht-conf v2.2 includes:
|
|
281
|
+
|
|
282
|
+
* New action `move-contact` facilitates the moving of contacts and places within a project's hierarchy. [Documentation](https://github.com/medic/cht-conf#moving-contacts-within-the-hierarchy). [#172](https://github.com/medic/cht-conf/issues/172)
|
|
283
|
+
* Updates the `upload-custom-translations` action to support custom locales (for WebApp projects >v3.4.0). [#199](https://github.com/medic/cht-conf/issues/199)
|
|
284
|
+
* The declarative configuration [target schema](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md#target-schema) has been updated. The idType attribute can now be a function. [#145](https://github.com/medic/cht-conf/issues/145)
|
|
285
|
+
* Support for Node 12, refactoring, and code cleanup.
|
|
286
|
+
|
|
287
|
+
## 2.0.0
|
|
288
|
+
|
|
289
|
+
cht-conf v2.0 contains breaking interface changes for the command-line and for the [declarative configuration system](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md).
|
|
290
|
+
|
|
291
|
+
### Breaking Changes to Command-line Arguments
|
|
292
|
+
Version 2.0 replaces our custom code for command-line argument parsing with [minimist](https://github.com/substack/minimist). This increases flexibility and more flexible ordering, but includes an interface change for a few commands. Refer to `cht --help` for an overview of all command-line options and syntax.
|
|
293
|
+
|
|
294
|
+
#### Commands Requiring '='
|
|
295
|
+
The command
|
|
296
|
+
|
|
297
|
+
cht --url http://admin:pass@localhost:5988
|
|
298
|
+
|
|
299
|
+
now includes an `=` sign after the `--url`
|
|
300
|
+
|
|
301
|
+
cht --url=http://admin:pass@localhost:5988
|
|
302
|
+
|
|
303
|
+
This affects the `url`, `instance`, `user`, and `shell-completion` arguments.
|
|
304
|
+
|
|
305
|
+
#### Action List Requires '--' Prefix
|
|
306
|
+
The command
|
|
307
|
+
|
|
308
|
+
cht --local convert-app-forms upload-app-forms my_form_1 my_form_2
|
|
309
|
+
|
|
310
|
+
now requires a '--' to separate actions from the list of forms:
|
|
311
|
+
|
|
312
|
+
cht --local convert-app-forms upload-app-forms -- my_form_1 my_form_2
|
|
313
|
+
|
|
314
|
+
### Breaking Changes to Declarative Configuration
|
|
315
|
+
|
|
316
|
+
The [declarative configuration system documentation](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md) contains up-to-date documentation of all interfaces.
|
|
317
|
+
|
|
318
|
+
#### Using Node Modules
|
|
319
|
+
We are hoping to converge on the interfaces used for [node modules](https://nodejs.org/api/modules.html) for sharing code between files. Moving forward, Medic configuration files will `export` and `require` code between files. This should 1) simplify the contract between the Medic web app and your configuration code, 2) simplify and facilitate unit testing, 3) allow you to use third-party libraries in your configuration code in future releases, and 4) simplify the cht-conf infrastructure and process for debugging issues.
|
|
320
|
+
|
|
321
|
+
Your `nools-extras.js` file now need to export any values, functions, objects which are to be shared with `tasks.js` or `targets.js` via the `module.exports` interface. [Example](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md#nools-extrasjs)
|
|
322
|
+
|
|
323
|
+
Your `tasks.js` and `targets.js` files should now access the exported attributes in your `nools-extras.js` via the global `extras` object. [Example](https://github.com/medic/medic-docs/blob/master/configuration/developing-community-health-applications.md#targetsjs)
|
|
324
|
+
|
|
325
|
+
#### Re-ordered Parameters
|
|
326
|
+
It can be hard to understand (and hard to document) the parameters which define the interfaces of the declarative configuration system. Version 2.0 includes interface changes which help to keep interfaces more consistent by moving optional variables to the end of the interface. The following interfaces have changed:
|
|
327
|
+
|
|
328
|
+
Interface | v1.x | v2.x
|
|
329
|
+
-- | -- | --
|
|
330
|
+
tasks.events[n].dueDate | (contact/reports, event, scheduledTaskIdx) | (event, contact, reports, scheduledTaskIdx)
|
|
331
|
+
tasks.actions[n].modifyContent | (contact/reports, content) | (content, contact, reports)
|
|
332
|
+
targets.emitCustom | (contact, reports) | (instance, contact, reports)
|
|
333
|
+
targets.date | ( contact ) | (contact, reports)
|
|
334
|
+
|
|
335
|
+
### New Features in Declarative Configuration
|
|
336
|
+
|
|
337
|
+
#### this
|
|
338
|
+
The `this` keyword is now available in all declarative configuration function interfaces to facilitate basic data sharing. This allows you to re-use a variable in another part of the task or target, rather than re-calculating it's value again.
|
|
339
|
+
|
|
340
|
+
For example, you may have a complex seek through a set of reports in your `appliesIf` function, and need the same seek in calculating the `dueDate`, as seen in the example below.
|
|
341
|
+
|
|
342
|
+
{
|
|
343
|
+
appliesTo: 'contacts',
|
|
344
|
+
appliesIf: function(contact) {
|
|
345
|
+
const necessaryReport = extras.findNecessaryReport(contact.reports);
|
|
346
|
+
this.necessaryReport = necessaryReport;
|
|
347
|
+
return !!necessaryReport;
|
|
348
|
+
},
|
|
349
|
+
events: [{
|
|
350
|
+
start: 1,
|
|
351
|
+
end: 3,
|
|
352
|
+
dueDate: function (event, contact, report) {
|
|
353
|
+
// Use the saved value of this.necessaryReport
|
|
354
|
+
return this.necessaryReport.reported_date;
|
|
355
|
+
},
|
|
356
|
+
}],
|
|
357
|
+
...
|
|
358
|
+
}
|
package/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM ubuntu:
|
|
1
|
+
FROM ubuntu:18.04
|
|
2
2
|
MAINTAINER DevOps "devops@medicmobile.org"
|
|
3
3
|
|
|
4
4
|
|
|
@@ -14,7 +14,7 @@ RUN echo "==> Installing Python dependencies" && \
|
|
|
14
14
|
RUN echo "====> Installing cht-conf python stuff" &&\
|
|
15
15
|
python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic
|
|
16
16
|
|
|
17
|
-
RUN curl -sL https://deb.nodesource.com/
|
|
17
|
+
RUN curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh
|
|
18
18
|
RUN bash nodesource_setup.sh
|
|
19
19
|
RUN apt-get install -y nodejs
|
|
20
20
|
|
package/README.md
CHANGED
|
@@ -11,29 +11,44 @@ CHT Conf is a command-line interface tool to manage and configure your apps buil
|
|
|
11
11
|
|
|
12
12
|
# Installation
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Operating System Specific
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
docker run cht-conf:v0
|
|
18
|
-
docker exec -it <container_name> /bin/bash
|
|
19
|
-
|
|
20
|
-
## Ubuntu
|
|
16
|
+
### Ubuntu
|
|
21
17
|
|
|
22
18
|
npm install -g cht-conf
|
|
23
19
|
sudo python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic
|
|
24
20
|
|
|
25
|
-
|
|
21
|
+
### OSX
|
|
26
22
|
|
|
27
23
|
npm install -g cht-conf
|
|
28
24
|
pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
### Windows
|
|
31
27
|
|
|
32
28
|
As Administrator:
|
|
33
29
|
|
|
34
30
|
npm install -g cht-conf
|
|
35
31
|
python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic --upgrade
|
|
36
32
|
|
|
33
|
+
### Docker
|
|
34
|
+
|
|
35
|
+
**NB** - `cht-conf` in a Docker container should only be used if you're familiar with running containers. You will have to copy or mount your config files into the container in order to be able to use the `cht` call to interact with a remote CHT instance.
|
|
36
|
+
|
|
37
|
+
Build and then run the `cht-conf` container:
|
|
38
|
+
|
|
39
|
+
docker build -t cht-conf:v0 .
|
|
40
|
+
docker run -d --name cht-conf cht-conf:v0
|
|
41
|
+
|
|
42
|
+
You now have a container running in the background called `cht-conf`. You can get a shell on this container with:
|
|
43
|
+
|
|
44
|
+
docker exec -it cht-conf /bin/bash
|
|
45
|
+
|
|
46
|
+
And then you can run the utility with `cht`.
|
|
47
|
+
|
|
48
|
+
When you are done with the container, you can stop it with:
|
|
49
|
+
|
|
50
|
+
docker stop cht-conf
|
|
51
|
+
|
|
37
52
|
## Bash completion
|
|
38
53
|
|
|
39
54
|
To enable tab completion in bash, add the following to your `.bashrc`/`.bash_profile`:
|
|
@@ -46,7 +61,7 @@ To upgrade to the latest version
|
|
|
46
61
|
|
|
47
62
|
npm install -g cht-conf
|
|
48
63
|
|
|
49
|
-
|
|
64
|
+
## Usage
|
|
50
65
|
|
|
51
66
|
`cht` will upload the configuration **from your current directory**.
|
|
52
67
|
|
|
@@ -60,9 +75,9 @@ For developers, this is the instance defined in your `COUCH_URL` environment var
|
|
|
60
75
|
|
|
61
76
|
cht --local
|
|
62
77
|
|
|
63
|
-
### A specific Medic
|
|
78
|
+
### A specific Medic-hosted instance
|
|
64
79
|
|
|
65
|
-
For configuring
|
|
80
|
+
For configuring Medic-hosted instances.
|
|
66
81
|
|
|
67
82
|
cht --instance=instance-name.dev
|
|
68
83
|
|
|
@@ -80,7 +95,7 @@ If a different username is required, add the `--user` switch:
|
|
|
80
95
|
|
|
81
96
|
cht --archive
|
|
82
97
|
|
|
83
|
-
The resulting archive is consumable by
|
|
98
|
+
The resulting archive is consumable by CHT API >v3.7 to create default configurations.
|
|
84
99
|
|
|
85
100
|
## Perform specific action(s)
|
|
86
101
|
|
|
@@ -267,7 +282,7 @@ To develop a new action or improve an existing one, check the ["Actions" doc](sr
|
|
|
267
282
|
|
|
268
283
|
## Testing
|
|
269
284
|
|
|
270
|
-
Execute `npm test` to run static analysis checks and the test suite.
|
|
285
|
+
Execute `npm test` to run static analysis checks and the test suite. Requires Docker to run integration tests against a CouchDB instance.
|
|
271
286
|
|
|
272
287
|
## Executing your local branch
|
|
273
288
|
|
|
@@ -279,16 +294,25 @@ Execute `npm test` to run static analysis checks and the test suite.
|
|
|
279
294
|
|
|
280
295
|
## Releasing
|
|
281
296
|
|
|
282
|
-
1. Create a pull request with prep for the new release.
|
|
283
|
-
1. Get the pull request reviewed and approved
|
|
284
|
-
1.
|
|
285
|
-
|
|
286
|
-
- Commit those changes locally and tag that commit with the new version
|
|
287
|
-
1. Run `npm publish` to publish the new tag to npm
|
|
288
|
-
1. `git push && git push --tags` to push the npm generated commit and tag up to your pre-approved pull request
|
|
289
|
-
1. Merge the pull request back into master
|
|
297
|
+
1. Create a pull request with prep for the new release.
|
|
298
|
+
1. Get the pull request reviewed and approved.
|
|
299
|
+
1. When doing the squash and merge, make sure that your commit message is clear and readable and follows the strict format described in the commit format section below. If the commit message does not comply, automatic release will fail.
|
|
300
|
+
1. In case you are planning to merge the pull request with a merge commit, make sure that every commit in your branch respects the format.
|
|
290
301
|
1. Announce the release on the [CHT forum](https://forum.communityhealthtoolkit.org), under the "Product - Releases" category.
|
|
291
302
|
|
|
303
|
+
### Commit format
|
|
304
|
+
The commit format should follow this [conventional-changelog angular preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular). Examples are provided below.
|
|
305
|
+
|
|
306
|
+
Type | Example commit message | Release type
|
|
307
|
+
-- | -- | --
|
|
308
|
+
Bug fixes | fix(#123): infinite spinner when clicking contacts tab twice | patch
|
|
309
|
+
Performance | perf(#789): lazily loaded angular modules | patch
|
|
310
|
+
Features | feat(#456): add home tab | minor
|
|
311
|
+
Non-code | chore(#123): update README | none
|
|
312
|
+
Breaking| perf(#2): remove reporting rates feature <br/> BREAKING CHANGE: reporting rates no longer supported | major
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
292
316
|
### Releasing betas
|
|
293
317
|
|
|
294
318
|
1. Checkout `master`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {extends: ['@commitlint/config-conventional']}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cht-conf",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.3",
|
|
4
4
|
"description": "Configure CHT deployments",
|
|
5
5
|
"main": "./src/lib/main.js",
|
|
6
6
|
"engines": {
|
|
@@ -9,7 +9,10 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"clean": "rm -rf ./build/",
|
|
11
11
|
"eslint": "eslint src/**/*.js test/*.js test/**/*.js",
|
|
12
|
-
"
|
|
12
|
+
"docker-start-couchdb": "npm run docker-stop-couchdb && docker run -d -p 6984:5984 --rm --name cht-conf-couchdb couchdb:2.3.1 && sh test/scripts/wait_for_response_code.sh 6984 200 CouchDB",
|
|
13
|
+
"docker-stop-couchdb": "docker stop cht-conf-couchdb || true",
|
|
14
|
+
"test": "npm run eslint && npm run docker-start-couchdb && npm run clean && mkdir -p build/test && cp -r test/data build/test/data && cd build/test && nyc --reporter=html mocha --forbid-only ../../test/**/*.spec.js && cd ../.. && npm run docker-stop-couchdb",
|
|
15
|
+
"semantic-release": "semantic-release"
|
|
13
16
|
},
|
|
14
17
|
"bin": {
|
|
15
18
|
"medic-conf": "src/bin/index.js",
|
|
@@ -23,7 +26,7 @@
|
|
|
23
26
|
},
|
|
24
27
|
"repository": {
|
|
25
28
|
"type": "git",
|
|
26
|
-
"url": "
|
|
29
|
+
"url": "https://github.com/medic/cht-conf.git"
|
|
27
30
|
},
|
|
28
31
|
"author": "",
|
|
29
32
|
"license": "AGPL-3.0-only",
|
|
@@ -33,7 +36,7 @@
|
|
|
33
36
|
"homepage": "https://github.com/medic/cht-conf#readme",
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"@hapi/joi": "^16.1.8",
|
|
36
|
-
"@medic/translation-checker": "1.0.
|
|
39
|
+
"@medic/translation-checker": "^1.0.1",
|
|
37
40
|
"canonical-json": "0.0.4",
|
|
38
41
|
"csv-parse": "^4.16.0",
|
|
39
42
|
"dom-compare": "^0.6.0",
|
|
@@ -64,6 +67,10 @@
|
|
|
64
67
|
"xmldom": "^0.6.0"
|
|
65
68
|
},
|
|
66
69
|
"devDependencies": {
|
|
70
|
+
"@commitlint/cli": "^13.2.0",
|
|
71
|
+
"@commitlint/config-conventional": "^13.2.0",
|
|
72
|
+
"@semantic-release/changelog": "^6.0.0",
|
|
73
|
+
"@semantic-release/git": "^10.0.0",
|
|
67
74
|
"body-parser": "^1.19.0",
|
|
68
75
|
"chai": "^4.3.4",
|
|
69
76
|
"chai-exclude": "^2.0.3",
|
|
@@ -72,10 +79,12 @@
|
|
|
72
79
|
"eslint-plugin-node": "^11.1.0",
|
|
73
80
|
"express": "^4.17.1",
|
|
74
81
|
"express-pouchdb": "^4.2.0",
|
|
82
|
+
"husky": "^7.0.2",
|
|
75
83
|
"mocha": "^6.2.3",
|
|
76
84
|
"nyc": "^15.1.0",
|
|
77
85
|
"pouchdb-adapter-memory": "^7.2.2",
|
|
78
86
|
"rewire": "^5.0.0",
|
|
87
|
+
"semantic-release": "^18.0.0",
|
|
79
88
|
"sinon": "^7.3.2"
|
|
80
89
|
}
|
|
81
90
|
}
|
package/src/fn/move-contacts.js
CHANGED
|
@@ -10,6 +10,7 @@ const pouch = require('../lib/db');
|
|
|
10
10
|
const { warn, trace, info, error } = require('../lib/log');
|
|
11
11
|
|
|
12
12
|
const HIERARCHY_ROOT = 'root';
|
|
13
|
+
const BATCH_SIZE = 10000;
|
|
13
14
|
|
|
14
15
|
module.exports = {
|
|
15
16
|
requiresInstance: true,
|
|
@@ -49,19 +50,15 @@ const updateLineagesAndStage = async (options, db) => {
|
|
|
49
50
|
trace(`Considering primary contact updates to ${ancestors.length} ancestor(s) of contact ${prettyPrintDocument(contactDoc)}.`);
|
|
50
51
|
const updatedAncestors = replaceLineageInAncestors(descendantsAndSelf, ancestors);
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
trace(`${reportsCreatedByDescendants.length} report(s) created by these affected contact(s) will update`);
|
|
54
|
-
const updatedReports = replaceLineageInReports(reportsCreatedByDescendants, replacementLineage, contactId);
|
|
53
|
+
minifyLineageAndWriteToDisk([...updatedDescendants, ...updatedAncestors], options);
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
writeDocumentToDisk(options, updatedDoc);
|
|
59
|
-
});
|
|
55
|
+
const movedReportsCount = await moveReports(db, descendantsAndSelf, options, replacementLineage, contactId);
|
|
56
|
+
trace(`${movedReportsCount} report(s) created by these affected contact(s) will be updated`);
|
|
60
57
|
|
|
61
58
|
affectedContactCount += updatedDescendants.length + updatedAncestors.length;
|
|
62
|
-
affectedReportCount +=
|
|
59
|
+
affectedReportCount += movedReportsCount;
|
|
63
60
|
|
|
64
|
-
info(`Staged updates to ${prettyPrintDocument(contactDoc)}. ${updatedDescendants.length} contact(s) and ${
|
|
61
|
+
info(`Staged updates to ${prettyPrintDocument(contactDoc)}. ${updatedDescendants.length} contact(s) and ${movedReportsCount} report(s).`);
|
|
65
62
|
}
|
|
66
63
|
|
|
67
64
|
info(`Staged changes to lineage information for ${affectedContactCount} contact(s) and ${affectedReportCount} report(s).`);
|
|
@@ -155,6 +152,31 @@ ${bold('OPTIONS')}
|
|
|
155
152
|
`);
|
|
156
153
|
};
|
|
157
154
|
|
|
155
|
+
const moveReports = async (db, descendantsAndSelf, writeOptions, replacementLineage, contactId) => {
|
|
156
|
+
const contactIds = descendantsAndSelf.map(contact => contact._id);
|
|
157
|
+
|
|
158
|
+
let skip = 0;
|
|
159
|
+
let reportDocsBatch;
|
|
160
|
+
do {
|
|
161
|
+
info(`Processing ${skip} to ${skip + BATCH_SIZE} report docs`);
|
|
162
|
+
reportDocsBatch = await fetch.reportsCreatedBy(db, contactIds, skip);
|
|
163
|
+
|
|
164
|
+
const updatedReports = replaceLineageInReports(reportDocsBatch, replacementLineage, contactId);
|
|
165
|
+
minifyLineageAndWriteToDisk(updatedReports, writeOptions);
|
|
166
|
+
|
|
167
|
+
skip += reportDocsBatch.length;
|
|
168
|
+
} while (reportDocsBatch.length >= BATCH_SIZE);
|
|
169
|
+
|
|
170
|
+
return skip;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const minifyLineageAndWriteToDisk = (docs, parsedArgs) => {
|
|
174
|
+
docs.forEach(doc => {
|
|
175
|
+
lineageManipulation.minifyLineagesInDoc(doc);
|
|
176
|
+
writeDocumentToDisk(parsedArgs, doc);
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
|
|
158
180
|
const writeDocumentToDisk = ({ docDirectoryPath }, doc) => {
|
|
159
181
|
const destinationPath = path.join(docDirectoryPath, `${doc._id}.doc.json`);
|
|
160
182
|
if (fs.exists(destinationPath)) {
|
|
@@ -214,10 +236,12 @@ const fetch = {
|
|
|
214
236
|
.filter(doc => doc && doc.type !== 'tombstone');
|
|
215
237
|
},
|
|
216
238
|
|
|
217
|
-
reportsCreatedBy: async (db, contactIds) => {
|
|
239
|
+
reportsCreatedBy: async (db, contactIds, skip) => {
|
|
218
240
|
const reports = await db.query('medic-client/reports_by_freetext', {
|
|
219
241
|
keys: contactIds.map(id => [`contact:${id}`]),
|
|
220
242
|
include_docs: true,
|
|
243
|
+
limit: BATCH_SIZE,
|
|
244
|
+
skip: skip,
|
|
221
245
|
});
|
|
222
246
|
|
|
223
247
|
return reports.rows.map(row => row.doc);
|
package/src/lib/api.js
CHANGED
|
@@ -87,6 +87,24 @@ const api = {
|
|
|
87
87
|
});
|
|
88
88
|
},
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Check whether the API is alive or not. The request
|
|
92
|
+
* is made to a "lightweight" endpoint that only returns a HTTP 302,
|
|
93
|
+
* and an promise is returned with true (available) or false.
|
|
94
|
+
*/
|
|
95
|
+
available: async () => {
|
|
96
|
+
const url = `${environment.apiUrl}/`;
|
|
97
|
+
try {
|
|
98
|
+
log.info(`Checking that ${url} is available...`);
|
|
99
|
+
await request.get(url);
|
|
100
|
+
return true;
|
|
101
|
+
} catch (err) {
|
|
102
|
+
log.error(`Failed to get a response from ${url}. Maybe you entered the wrong URL, `
|
|
103
|
+
+ 'wrong port or the instance is not started? Please check and try again.');
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
|
|
90
108
|
version() {
|
|
91
109
|
return request({ uri: `${environment.instanceUrl}/api/deploy-info`, method: 'GET', json: true }) // endpoint added in 3.5
|
|
92
110
|
.then(deploy_info => deploy_info && deploy_info.version);
|
package/src/lib/archiving-api.js
CHANGED
package/src/lib/main.js
CHANGED
|
@@ -10,7 +10,7 @@ const redactBasicAuth = require('redact-basic-auth');
|
|
|
10
10
|
const shellCompletionSetup = require('../cli/shell-completion-setup');
|
|
11
11
|
const supportedActions = require('../cli/supported-actions');
|
|
12
12
|
const usage = require('../cli/usage');
|
|
13
|
-
const
|
|
13
|
+
const api = require('../lib/api');
|
|
14
14
|
|
|
15
15
|
const { error, info, warn } = log;
|
|
16
16
|
const defaultActions = [
|
|
@@ -166,13 +166,6 @@ module.exports = async (argv, env) => {
|
|
|
166
166
|
error('Failed to obtain a url to the API');
|
|
167
167
|
return -1;
|
|
168
168
|
}
|
|
169
|
-
try {
|
|
170
|
-
info(`Checking that ${apiUrl} is available...`);
|
|
171
|
-
await request.get(apiUrl);
|
|
172
|
-
} catch (err) {
|
|
173
|
-
error(`Failed to get a response from ${apiUrl}. Maybe you entered the wrong URL, wrong port or the instance is not started? Please check and try again.`);
|
|
174
|
-
return -1;
|
|
175
|
-
}
|
|
176
169
|
}
|
|
177
170
|
|
|
178
171
|
let extraArgs = cmdArgs['--'];
|
|
@@ -190,6 +183,10 @@ module.exports = async (argv, env) => {
|
|
|
190
183
|
cmdArgs['skip-translation-check']
|
|
191
184
|
);
|
|
192
185
|
|
|
186
|
+
if (apiUrl && !await api().available()) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
193
190
|
const productionUrlMatch = environment.instanceUrl && environment.instanceUrl.match(/^https:\/\/(?:[^@]*@)?(.*)\.(app|dev)\.medicmobile\.org(?:$|\/)/);
|
|
194
191
|
const expectedOptions = ['alpha', projectName];
|
|
195
192
|
if (productionUrlMatch && !expectedOptions.includes(productionUrlMatch[1])) {
|