cht-conf 3.16.1 → 3.17.0
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/CHANGELOG.md +15 -0
- package/README.md +8 -48
- package/{devcontainer.cht-ide → devcontainer.cht-app-ide}/.devcontainer.json +1 -1
- package/package.json +4 -3
- package/src/fn/upload-extension-libs.js +41 -0
- package/src/lib/main.js +2 -0
- package/src/lib/package-lib.js +2 -1
- package/src/lib/project-paths.js +11 -10
- /package/{devcontainer.cht-ide → devcontainer.cht-app-ide}/README.md +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
# [3.17.0](https://github.com/medic/cht-conf/compare/v3.16.2...v3.17.0) (2023-04-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **#545:** publish cht-app-ide docker image ([#550](https://github.com/medic/cht-conf/issues/550)) ([8b5e62e](https://github.com/medic/cht-conf/commit/8b5e62e8f2191c4457433d30024266aa27ae1129)), closes [#545](https://github.com/medic/cht-conf/issues/545)
|
|
7
|
+
* **#547:** add command for uploading extension libs ([3b13e40](https://github.com/medic/cht-conf/commit/3b13e40e276d37e554cb5863974cea1090ed4585)), closes [#547](https://github.com/medic/cht-conf/issues/547)
|
|
8
|
+
|
|
9
|
+
## [3.16.2](https://github.com/medic/cht-conf/compare/v3.16.1...v3.16.2) (2023-03-18)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* **#533:** compile-app-settings with --debug flag should ignore eslint errors ([5592efe](https://github.com/medic/cht-conf/commit/5592efe0ccee0165fa8690f7d4494e7ed7057beb)), closes [#533](https://github.com/medic/cht-conf/issues/533) [#533](https://github.com/medic/cht-conf/issues/533)
|
|
15
|
+
|
|
1
16
|
## [3.16.1](https://github.com/medic/cht-conf/compare/v3.16.0...v3.16.1) (2023-03-18)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -34,73 +34,33 @@ As Administrator:
|
|
|
34
34
|
|
|
35
35
|
CHT Conf can also be run from within a Docker container. This is useful if you are already familiar with Docker and do not wish to configure the various dependencies required for developing CHT apps on your local machine. The necessary dependencies are pre-packaged in the Docker image.
|
|
36
36
|
|
|
37
|
-
#### Building the image
|
|
38
|
-
|
|
39
|
-
Install [Docker](https://www.docker.com/). If you are using Windows, you also need to enable the [Windows Subsystem for Linux (WSL2)](https://learn.microsoft.com/en-us/windows/wsl/install) to perform the following steps.
|
|
40
|
-
|
|
41
|
-
Using the terminal (or the WLS shell on Windows: _Start > wsl_), run the following commands to create a new project directory and build the Docker image:
|
|
42
|
-
|
|
43
|
-
```shell
|
|
44
|
-
mkdir -p ~/cht-project
|
|
45
|
-
cd ~/cht-project
|
|
46
|
-
curl https://raw.githubusercontent.com/medic/cht-conf/main/Dockerfile > Dockerfile
|
|
47
|
-
docker build -t cht-ide .
|
|
48
|
-
```
|
|
49
|
-
|
|
50
37
|
#### Using the image
|
|
51
38
|
|
|
52
|
-
The
|
|
53
|
-
|
|
54
|
-
##### VSCode Development Container
|
|
55
|
-
|
|
56
|
-
If you want to develop CHT apps with VSCode, you can use the Docker image as a Development Container. This will allow you to use the `cht-conf` utility and its associated tech stack from within VSCode (without needing to install dependencies like NodeJS on your host system).
|
|
57
|
-
|
|
58
|
-
[Install VSCode](https://code.visualstudio.com/) if you do not have it already.
|
|
59
|
-
|
|
60
|
-
Using the terminal (or the WLS shell on Windows: _Start > wsl_), run the following commands from within your project directory (created above) to download the `.devcontainer.json` config file, install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers), and open the project directory in VSCode:
|
|
39
|
+
The Docker image can be used as a [VS Code Development Container](https://code.visualstudio.com/docs/devcontainers/containers) (easiest) or as a standalone Docker utility.
|
|
61
40
|
|
|
62
|
-
|
|
63
|
-
cd ~/cht-project
|
|
64
|
-
curl -s https://raw.githubusercontent.com/medic/cht-conf/main/devcontainer.cht-ide/.devcontainer.json > .devcontainer.json
|
|
65
|
-
code --install-extension ms-vscode-remote.remote-containers
|
|
66
|
-
code -n .
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
When opening VSCode, you may be prompted with the question:
|
|
70
|
-
|
|
71
|
-
> **Do you trust the authors of the files in this folder?**
|
|
72
|
-
|
|
73
|
-
Choose, "Yes, I trust the authors".
|
|
74
|
-
|
|
75
|
-
Open the Command Palette in VSCode (_Ctrl+Shift+P_ or _Cmd+Shift+P_) and select `Reopen in Container`. This will open your workspace inside a container based on the `cht-ide` image. You can use the `cht` commands by opening a terminal in VSCode (_Ctrl+Shift+\`_ or _Cmd+Shift+\`_). If prompted "Do you trust the authors..." choose "Trust Folder & Continue".
|
|
76
|
-
|
|
77
|
-
Run the following command in the VSCode terminal to bootstrap your new CHT project:
|
|
78
|
-
|
|
79
|
-
```shell
|
|
80
|
-
cht initialise-project-layout
|
|
81
|
-
```
|
|
41
|
+
Install [Docker](https://www.docker.com/). If you are using Windows, you also need to enable the [Windows Subsystem for Linux (WSL2)](https://learn.microsoft.com/en-us/windows/wsl/install) to perform the following steps.
|
|
82
42
|
|
|
83
|
-
|
|
43
|
+
##### VS Code Development Container
|
|
84
44
|
|
|
85
|
-
|
|
45
|
+
If you want to develop CHT apps with VS Code, you can use the Docker image as a Development Container. This will allow you to use the `cht-conf` utility and its associated tech stack from within VS Code (without needing to install dependencies like NodeJS on your host system).
|
|
86
46
|
|
|
87
|
-
|
|
47
|
+
See the [CHT Documentation](https://docs.communityhealthtoolkit.org/apps/tutorials/local-setup/#developing-with-vs-code-dev-container) for more information on building CHT apps with VS Code Development Containers.
|
|
88
48
|
|
|
89
49
|
##### Standalone Docker utility
|
|
90
50
|
|
|
91
|
-
If you are not using
|
|
51
|
+
If you are not using VS Code, you can use the Docker image as a standalone utility from the command line. Instead of using the `cht ...` command, you can run `docker run -it --rm -v "$PWD":/workdir medicmobile/cht-app-ide ...`. This will create an ephemeral container with access to your current directory that will run the given cht command. (Do not include the `cht` part of the command, just your desired actions/parameters.)
|
|
92
52
|
|
|
93
53
|
Run the following command inside the project directory to bootstrap your new CHT project:
|
|
94
54
|
|
|
95
55
|
```shell
|
|
96
|
-
docker run -it --rm -v "$PWD":/workdir cht-ide initialise-project-layout
|
|
56
|
+
docker run -it --rm -v "$PWD":/workdir medicmobile/cht-app-ide initialise-project-layout
|
|
97
57
|
```
|
|
98
58
|
|
|
99
59
|
#### Note on connecting to a local CHT instance
|
|
100
60
|
|
|
101
61
|
When using `cht-conf` within a Docker container to connect to a CHT instance that is running on your local machine (e.g. a development instance), you cannot use the `--local` flag or `localhost` in your `--url` parameter (since these will be interpreted as "local to the container").
|
|
102
62
|
|
|
103
|
-
It is recommended to run a local CHT instance using the [CHT Docker Helper script](https://docs.communityhealthtoolkit.org/apps/guides/hosting/4.x/app-developer/). You can connect to the resulting `...my.local-ip.co` URL from the Docker container (or the
|
|
63
|
+
It is recommended to run a local CHT instance using the [CHT Docker Helper script](https://docs.communityhealthtoolkit.org/apps/guides/hosting/4.x/app-developer/). You can connect to the resulting `...my.local-ip.co` URL from the Docker container (or the VS Code terminal). (Just make sure the port your CHT instance is hosted on is not blocked by your firewall).
|
|
104
64
|
|
|
105
65
|
## Bash completion
|
|
106
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cht-conf",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.0",
|
|
4
4
|
"description": "Configure CHT deployments",
|
|
5
5
|
"main": "./src/lib/main.js",
|
|
6
6
|
"engines": {
|
|
@@ -77,19 +77,20 @@
|
|
|
77
77
|
"@semantic-release/git": "^10.0.0",
|
|
78
78
|
"body-parser": "^1.19.0",
|
|
79
79
|
"chai": "^4.3.4",
|
|
80
|
+
"chai-as-promised": "^7.1.1",
|
|
80
81
|
"chai-exclude": "^2.0.3",
|
|
81
82
|
"chai-shallow-deep-equal": "^1.4.6",
|
|
82
83
|
"chai-xml": "^0.4.0",
|
|
83
84
|
"eslint-plugin-node": "^11.1.0",
|
|
84
85
|
"express": "^4.17.1",
|
|
85
86
|
"express-pouchdb": "^4.2.0",
|
|
87
|
+
"fs-extra": "8.1.0",
|
|
86
88
|
"husky": "^7.0.2",
|
|
87
89
|
"mocha": "^6.2.3",
|
|
88
90
|
"nyc": "^15.1.0",
|
|
89
91
|
"pouchdb-adapter-memory": "^7.2.2",
|
|
90
92
|
"rewire": "^5.0.0",
|
|
91
93
|
"semantic-release": "^18.0.0",
|
|
92
|
-
"sinon": "^7.3.2"
|
|
93
|
-
"fs-extra": "8.1.0"
|
|
94
|
+
"sinon": "^7.3.2"
|
|
94
95
|
}
|
|
95
96
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const environment = require('../lib/environment');
|
|
2
|
+
const pouch = require('../lib/db');
|
|
3
|
+
const log = require('../lib/log');
|
|
4
|
+
const attachmentsFromDir = require('../lib/attachments-from-dir');
|
|
5
|
+
const warnUploadOverwrite = require('../lib/warn-upload-overwrite');
|
|
6
|
+
const insertOrReplace = require('../lib/insert-or-replace');
|
|
7
|
+
const projectPaths = require('../lib/project-paths');
|
|
8
|
+
|
|
9
|
+
const DOC_ID = 'extension-libs';
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
requiresInstance: true,
|
|
13
|
+
execute: async () => {
|
|
14
|
+
const configurationDir = `${environment.pathToProject}/${projectPaths.EXTENSION_LIBS_PATH}`;
|
|
15
|
+
|
|
16
|
+
const attachments = attachmentsFromDir(configurationDir);
|
|
17
|
+
if (!Object.keys(attachments).length) {
|
|
18
|
+
log.info(`No configuration found at "${configurationDir}" - not uploading extension-libs`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
log.info(`Found extension-libs: ${Object.keys(attachments).join(', ')}`);
|
|
23
|
+
const doc = {
|
|
24
|
+
_id: DOC_ID,
|
|
25
|
+
_attachments: attachments
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const db = pouch(environment.apiUrl);
|
|
29
|
+
const changes = await warnUploadOverwrite.preUploadDoc(db, doc);
|
|
30
|
+
|
|
31
|
+
if (!changes) {
|
|
32
|
+
log.info('Extension libs not uploaded as already up to date');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
await insertOrReplace(db, doc);
|
|
37
|
+
log.info('Extension libs upload complete');
|
|
38
|
+
|
|
39
|
+
return await warnUploadOverwrite.postUploadDoc(db, doc);
|
|
40
|
+
}
|
|
41
|
+
};
|
package/src/lib/main.js
CHANGED
|
@@ -37,6 +37,7 @@ const defaultActions = [
|
|
|
37
37
|
'upload-partners',
|
|
38
38
|
'upload-custom-translations',
|
|
39
39
|
'upload-privacy-policies',
|
|
40
|
+
'upload-extension-libs',
|
|
40
41
|
];
|
|
41
42
|
const defaultArchiveActions = [
|
|
42
43
|
'compile-app-settings',
|
|
@@ -58,6 +59,7 @@ const defaultArchiveActions = [
|
|
|
58
59
|
'upload-partners',
|
|
59
60
|
'upload-custom-translations',
|
|
60
61
|
'upload-privacy-policies',
|
|
62
|
+
'upload-extension-libs',
|
|
61
63
|
];
|
|
62
64
|
|
|
63
65
|
module.exports = async (argv, env) => {
|
package/src/lib/package-lib.js
CHANGED
|
@@ -64,6 +64,7 @@ module.exports = (pathToProject, entry, baseEslintPath, options = {}) => {
|
|
|
64
64
|
options: {
|
|
65
65
|
baseConfig: baseEslintConfig,
|
|
66
66
|
useEslintrc: true,
|
|
67
|
+
ignore: !options.skipEslintIgnore,
|
|
67
68
|
|
|
68
69
|
// pack the library regardless of the eslint result
|
|
69
70
|
failOnError: false,
|
|
@@ -91,7 +92,7 @@ module.exports = (pathToProject, entry, baseEslintPath, options = {}) => {
|
|
|
91
92
|
info(stats.toString());
|
|
92
93
|
|
|
93
94
|
if (stats.hasErrors()) {
|
|
94
|
-
const hasErrorsNotRelatedToLinting = stats.toJson().errors.some(err => !err.includes('
|
|
95
|
+
const hasErrorsNotRelatedToLinting = stats.toJson().errors.some(err => !err.includes('node_modules/eslint-loader'));
|
|
95
96
|
const shouldHalt = options.haltOnLintMessage || hasErrorsNotRelatedToLinting;
|
|
96
97
|
if (shouldHalt) {
|
|
97
98
|
return reject(Error(`Webpack errors when building ${libName}`));
|
package/src/lib/project-paths.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
// Paths Relative to the Project
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
APP_SETTINGS_DIR_PATH: 'app_settings',
|
|
5
|
+
APP_SETTINGS_JSON_PATH: 'app_settings.json',
|
|
6
|
+
APP_FORMS_PATH: path.join('forms', 'app'),
|
|
7
|
+
CONTACT_FORMS_PATH: path.join('forms', 'contact'),
|
|
8
|
+
COLLECT_FORMS_PATH: path.join('forms', 'collect'),
|
|
9
|
+
TRAINING_FORMS_PATH: path.join('forms', 'training'),
|
|
10
|
+
TRANSLATIONS_DIR_PATH: 'translations',
|
|
11
|
+
RESOURCE_CONFIG_PATH: 'resources.json',
|
|
12
|
+
RESOURCES_DIR_PATH: 'resources',
|
|
13
|
+
EXTENSION_LIBS_PATH: 'extension-libs',
|
|
14
|
+
};
|
|
File without changes
|