cht-conf 4.1.0 → 4.1.2

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [4.1.2](https://github.com/medic/cht-conf/compare/v4.1.1...v4.1.2) (2024-10-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **#635:** update upload-artifact GH action to version 4 ([#636](https://github.com/medic/cht-conf/issues/636)) ([bafd6e3](https://github.com/medic/cht-conf/commit/bafd6e35607a481daaa911b16af4899bb1a00f7a)), closes [#635](https://github.com/medic/cht-conf/issues/635) [#635](https://github.com/medic/cht-conf/issues/635)
7
+
8
+ ## [4.1.1](https://github.com/medic/cht-conf/compare/v4.1.0...v4.1.1) (2024-08-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **#632:** replace cht-conf with cht in readme.md ([fc5b7f3](https://github.com/medic/cht-conf/commit/fc5b7f3ee5e1b8ae381b3182efbeedd4b6631418)), closes [#632](https://github.com/medic/cht-conf/issues/632)
14
+
1
15
  # [4.1.0](https://github.com/medic/cht-conf/compare/v4.0.0...v4.1.0) (2024-07-15)
2
16
 
3
17
 
package/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM node:16-slim
1
+ FROM node:20-slim
2
2
 
3
3
  RUN apt update \
4
4
  && apt install --no-install-recommends -y \
@@ -9,6 +9,7 @@ RUN apt update \
9
9
  openssh-client \
10
10
  python3-pip \
11
11
  python3-setuptools \
12
+ python3-venv \
12
13
  python3-wheel \
13
14
  xsltproc \
14
15
  # Remove chromium to save space. We only installed it to get the transitive dependencies that are needed
@@ -16,6 +17,10 @@ RUN apt update \
16
17
  && apt remove -y chromium \
17
18
  && rm -rf /var/lib/apt/lists/*
18
19
 
20
+ ENV VIRTUAL_ENV=/opt/venv
21
+ RUN python3 -m venv "$VIRTUAL_ENV"
22
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
23
+
19
24
  RUN python3 -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic
20
25
 
21
26
  RUN npm install -g cht-conf
package/README.md CHANGED
@@ -42,7 +42,7 @@ Install [Docker](https://www.docker.com/). If you are using Windows, you also ne
42
42
 
43
43
  ##### VS Code Development Container
44
44
 
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).
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` utility and its associated tech stack from within VS Code (without needing to install dependencies like NodeJS on your host system).
46
46
 
47
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.
48
48
 
@@ -58,7 +58,7 @@ docker run -it --rm -v "$PWD":/workdir medicmobile/cht-app-ide initialise-projec
58
58
 
59
59
  #### Note on connecting to a local CHT instance
60
60
 
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").
61
+ When using `cht` 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").
62
62
 
63
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).
64
64
 
@@ -66,7 +66,7 @@ It is recommended to run a local CHT instance using the [CHT Docker Helper scrip
66
66
 
67
67
  To enable tab completion in bash, add the following to your `.bashrc`/`.bash_profile`:
68
68
 
69
- eval "$(cht-conf --shell-completion=bash)"
69
+ eval "$(cht --shell-completion=bash)"
70
70
 
71
71
  ## Upgrading
72
72
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cht-conf",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
4
4
  "description": "Configure CHT deployments",
5
5
  "main": "./src/lib/main.js",
6
6
  "engines": {
@@ -36,46 +36,46 @@
36
36
  },
37
37
  "homepage": "https://github.com/medic/cht-conf#readme",
38
38
  "dependencies": {
39
- "@medic/translation-checker": "^1.0.1",
40
- "@parcel/watcher": "^2.0.5",
39
+ "@medic/translation-checker": "^1.1.0",
40
+ "@parcel/watcher": "^2.1.0",
41
41
  "@xmldom/xmldom": "^0.8.10",
42
42
  "async-retry": "^1.3.3",
43
43
  "canonical-json": "0.0.4",
44
- "csv-parse": "^4.16.0",
44
+ "csv-parse": "^5.5.6",
45
45
  "dom-compare": "^0.6.0",
46
- "eslint": "^6.8.0",
47
- "eslint-loader": "^3.0.4",
48
- "googleapis": "^84.0.0",
49
- "iso-639-1": "^3.1.0",
50
- "joi": "^17.11.0",
51
- "json-diff": "^0.5.4",
46
+ "eslint": "^8.57.0",
47
+ "eslint-webpack-plugin": "^2.7.0",
48
+ "googleapis": "^140.0.1",
49
+ "iso-639-1": "^3.1.2",
50
+ "joi": "^17.13.3",
51
+ "json-diff": "^1.0.6",
52
52
  "json-stringify-safe": "^5.0.1",
53
53
  "json2csv": "^4.5.4",
54
54
  "mime-types": "^2.1.35",
55
55
  "minimist": "^1.2.8",
56
- "mkdirp": "^1.0.4",
57
- "open": "^7.4.2",
56
+ "mkdirp": "^3.0.1",
57
+ "open": "^8.4.2",
58
58
  "pluralize": "^8.0.0",
59
59
  "pouchdb-adapter-http": "^7.2.2",
60
60
  "pouchdb-core": "^7.2.2",
61
61
  "pouchdb-mapreduce": "^7.2.2",
62
- "pouchdb-session-authentication": "^1.3.0",
62
+ "pouchdb-session-authentication": "^1.4.0",
63
63
  "properties": "^1.2.1",
64
64
  "queue-promise": "^2.2.1",
65
65
  "readline-sync": "^1.4.10",
66
66
  "redact-basic-auth": "^1.0.1",
67
67
  "request": "^2.88.2",
68
68
  "request-promise-native": "^1.0.9",
69
- "semver": "^6.1.1",
70
- "svgo": "^1.3.2",
71
- "terser-webpack-plugin": "^1.4.3",
72
- "uuid": "^8.3.2",
73
- "webpack": "^4.46.0",
69
+ "semver": "^7.6.3",
70
+ "svgo": "^3.3.2",
71
+ "terser-webpack-plugin": "^5.3.10",
72
+ "uuid": "^10.0.0",
73
+ "webpack": "^5.93.0",
74
74
  "xpath": "0.0.33"
75
75
  },
76
76
  "devDependencies": {
77
- "@commitlint/cli": "^13.2.0",
78
- "@commitlint/config-conventional": "^13.2.0",
77
+ "@commitlint/cli": "^19.3.0",
78
+ "@commitlint/config-conventional": "^19.2.2",
79
79
  "@semantic-release/changelog": "^6.0.3",
80
80
  "@semantic-release/git": "^10.0.1",
81
81
  "body-parser": "^1.20.2",
@@ -84,16 +84,16 @@
84
84
  "chai-exclude": "^2.1.0",
85
85
  "chai-shallow-deep-equal": "^1.4.6",
86
86
  "chai-xml": "^0.4.1",
87
- "eslint-plugin-node": "^11.1.0",
88
- "express": "^4.18.2",
87
+ "eslint-plugin-n": "^17.9.0",
88
+ "express": "^4.19.2",
89
89
  "express-pouchdb": "^4.2.0",
90
- "fs-extra": "8.1.0",
91
- "husky": "^7.0.2",
92
- "mocha": "^6.2.3",
93
- "nyc": "^15.1.0",
90
+ "fs-extra": "11.2.0",
91
+ "husky": "^9.1.1",
92
+ "mocha": "^10.7.0",
93
+ "nyc": "^17.0.0",
94
94
  "pouchdb-adapter-memory": "^7.2.2",
95
- "rewire": "^5.0.0",
96
- "semantic-release": "^18.0.0",
97
- "sinon": "^8.1.1"
95
+ "rewire": "^7.0.0",
96
+ "semantic-release": "^22.0.0",
97
+ "sinon": "^18.0.0"
98
98
  }
99
99
  }
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "env": {
3
- "es6": true,
3
+ "es2022": true,
4
4
  "node": true
5
5
  },
6
6
  "root": true,
7
7
  "parserOptions": {
8
- "ecmaVersion": 5
8
+ "ecmaVersion": 2022
9
9
  },
10
10
  "extends": "eslint:recommended",
11
11
  "rules": {
@@ -1,4 +1,4 @@
1
- /*eslint node/no-missing-require: "off"*/
1
+ /*eslint n/no-missing-require: "off"*/
2
2
  const compressPng = require('../lib/compress-png').execute;
3
3
  const compressSvg = require('../lib/compress-svg').execute;
4
4
 
@@ -2,8 +2,7 @@ const environment = require('../lib/environment');
2
2
  const fs = require('../lib/sync-fs');
3
3
  const { info, trace, warn } = require('../lib/log');
4
4
 
5
- const SVGO = require('svgo');
6
- const svgo = new SVGO();
5
+ const svgo = require('svgo');
7
6
 
8
7
  module.exports = {
9
8
  requiresInstance: false,
@@ -1,4 +1,4 @@
1
- const csvParse = require('csv-parse/lib/sync');
1
+ const { parse: csvParse } = require('csv-parse/sync');
2
2
  const userPrompt = require('../../src/lib/user-prompt');
3
3
 
4
4
  const api = require('../lib/api');
@@ -90,4 +90,4 @@ const execute = async () => {
90
90
  module.exports = {
91
91
  requiresInstance: true,
92
92
  execute
93
- };
93
+ };
@@ -20,10 +20,10 @@ const LAYOUT = {
20
20
  '.eslintrc': `{
21
21
  "env": {
22
22
  "node": true,
23
- "es6": true
23
+ "es2022": true,
24
24
  },
25
25
  "parserOptions": {
26
- "ecmaVersion": 6
26
+ "ecmaVersion": 2022
27
27
  }
28
28
  }`,
29
29
  forms: {
@@ -2,6 +2,7 @@ const fs = require('fs');
2
2
  const os = require('os');
3
3
  const path = require('path');
4
4
  const TerserPlugin = require('terser-webpack-plugin');
5
+ const ESLintPlugin = require('eslint-webpack-plugin');
5
6
  const webpack = require('webpack');
6
7
 
7
8
  const fsUtils = require('../sync-fs');
@@ -17,7 +18,7 @@ module.exports = (pathToProject, entry, baseEslintPath, options = {}) => {
17
18
  const outputDirectoryPath = os.tmpdir();
18
19
  const outputFilename = `./${libName}.js`;
19
20
 
20
- const compiler = webpack([{
21
+ const compiler = webpack({
21
22
  mode: 'production',
22
23
  entry,
23
24
  output: {
@@ -25,7 +26,7 @@ module.exports = (pathToProject, entry, baseEslintPath, options = {}) => {
25
26
  filename: outputFilename,
26
27
  libraryTarget: options.libraryTarget ? 'umd' : undefined,
27
28
  globalObject: options.libraryTarget,
28
- hashFunction: 'sha512' // remove when we upgrade to webpack 5
29
+ hashFunction: 'xxhash64'
29
30
  },
30
31
  optimization: {
31
32
  minimize: !!options.minifyScripts,
@@ -54,29 +55,21 @@ module.exports = (pathToProject, entry, baseEslintPath, options = {}) => {
54
55
  'node_modules',
55
56
  ],
56
57
  },
57
- module: {
58
- rules: [
59
- {
60
- enforce: 'pre',
61
- test: /\.js$/,
62
- loader: require.resolve('eslint-loader'),
63
- exclude: /node_modules/,
64
- options: {
65
- baseConfig: baseEslintConfig,
66
- useEslintrc: true,
67
- ignore: !options.skipEslintIgnore,
68
-
69
- // pack the library regardless of the eslint result
70
- failOnError: false,
71
- failOnWarning: false,
72
- },
73
- },
74
- ],
75
- },
76
58
  plugins: [
77
- new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // Ignore all optional deps of moment.js
78
- ]
79
- }]);
59
+ new ESLintPlugin({
60
+ context: pathToProject,
61
+ extensions: 'js',
62
+ exclude: 'node_modules',
63
+ baseConfig: baseEslintConfig,
64
+ useEslintrc: true,
65
+ ignore: !options.skipEslintIgnore,
66
+ // pack the library regardless of the eslint result
67
+ failOnError: false,
68
+ failOnWarning: false,
69
+ }),
70
+ new webpack.IgnorePlugin({ resourceRegExp: /^\.\/locale$/, contextRegExp: /moment$/ }), // Ignore all optional deps of moment.js
71
+ ],
72
+ });
80
73
 
81
74
  return new Promise((resolve, reject) => {
82
75
  compiler.run((err, stats) => {
@@ -92,17 +85,21 @@ module.exports = (pathToProject, entry, baseEslintPath, options = {}) => {
92
85
  info(stats.toString());
93
86
 
94
87
  if (stats.hasErrors()) {
95
- const hasErrorsNotRelatedToLinting = stats.toJson().errors.some(err => !err.includes('node_modules/eslint-loader'));
96
- const shouldHalt = options.haltOnLintMessage || hasErrorsNotRelatedToLinting;
88
+ return reject(Error(`Webpack errors when building ${libName}`));
89
+ }
90
+
91
+ if (stats.hasWarnings()) {
92
+ const hasWarningsRelatedToLinting = stats.toJson().warnings.some(warning => warning.message.includes('warnings potentially fixable'));
93
+ const shouldHalt = options.haltOnWebpackWarning ||
94
+ options.haltOnLintMessage && hasWarningsRelatedToLinting;
95
+
97
96
  if (shouldHalt) {
98
- return reject(Error(`Webpack errors when building ${libName}`));
99
- } else {
100
- warn('Ignoring linting errors');
97
+ return reject(Error(`Webpack warnings when building ${libName}`));
101
98
  }
102
- }
103
99
 
104
- if (stats.hasWarnings() && options.haltOnWebpackWarning) {
105
- return reject(Error(`Webpack warnings when building ${libName}`));
100
+ if (hasWarningsRelatedToLinting) {
101
+ warn('Ignoring linting errors');
102
+ }
106
103
  }
107
104
 
108
105
  const outputPath = path.join(outputDirectoryPath, outputFilename);
@@ -1,4 +1,4 @@
1
- const csvParse = require('csv-parse/lib/sync');
1
+ const { parse: csvParse } = require('csv-parse/sync');
2
2
  const fs = require('fs');
3
3
  const mkdirp = require('mkdirp').sync;
4
4
  const os = require('os');
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "env": {
3
- "es6": true,
3
+ "es2022": true,
4
4
  "node": true
5
5
  },
6
6
  "root": true,
7
7
  "parserOptions": {
8
- "ecmaVersion": 5
8
+ "ecmaVersion": 2022
9
9
  },
10
10
  "extends": "eslint:recommended",
11
11
  "rules": {