@cocreate/config 1.0.8 → 1.1.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.1.0](https://github.com/CoCreate-app/CoCreate-config/compare/v1.0.9...v1.1.0) (2023-06-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * compare choices keys with configs to see if isAnswered ([c19762c](https://github.com/CoCreate-app/CoCreate-config/commit/c19762caf47633df9ca3c486337bb178d4e2d31f))
7
+
8
+ ## [1.0.9](https://github.com/CoCreate-app/CoCreate-config/compare/v1.0.8...v1.0.9) (2023-06-15)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Updatae [@cocreate](https://github.com/cocreate) dependnenies to the latest versions ([dfd4bec](https://github.com/CoCreate-app/CoCreate-config/commit/dfd4bec8492745e2a290b3b57e7ab01963fe0c7b))
14
+
1
15
  ## [1.0.8](https://github.com/CoCreate-app/CoCreate-config/compare/v1.0.7...v1.0.8) (2023-06-15)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/config",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "A convenient chain handler allows user to chain multiple CoCreate components together. When one action is complete next one will start. The sequence goes untill all config completed. Grounded on Vanilla javascript, easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "config",
package/src/server.js CHANGED
@@ -51,11 +51,29 @@ module.exports = async function (items, env = true, global = true) {
51
51
  }
52
52
 
53
53
  if (choices) {
54
- if (!prompt && prompt !== '' || !choices) continue;
55
- const answer = await promptForInput(prompt || `${key}: `);
56
- const choice = choices[answer];
57
- if (choice) {
58
- await getConfig(choice);
54
+ if (!prompt && prompt !== '') continue;
55
+
56
+ let isAnswered = false
57
+ for (let choice of Object.keys(choices)) {
58
+ let isAnsweredChoice = true
59
+ for (let choicekey of Object.keys(choices[choice])) {
60
+ let choiceValue = localConfig[choicekey] || globalConfig[choicekey]
61
+ if (choiceValue) {
62
+ config[choicekey] = choiceValue
63
+ } else
64
+ isAnsweredChoice = false
65
+
66
+ }
67
+ if (isAnsweredChoice)
68
+ isAnswered = true
69
+ }
70
+
71
+ if (!isAnswered) {
72
+ const answer = await promptForInput(prompt || `${key}: `);
73
+ const choice = choices[answer];
74
+ if (choice) {
75
+ await getConfig(choice);
76
+ }
59
77
  }
60
78
  } else if (variable) {
61
79
  let variableValue = localConfig[key] || globalConfig[key]