@adobe/aio-cli-lib-app-config 3.0.0 → 3.0.2-pre.2024-01-08.sha-754ff986

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aio-cli-lib-app-config",
3
- "version": "3.0.0",
3
+ "version": "3.0.2-pre.2024-01-08.sha-754ff986",
4
4
  "description": "node lib to provide a consistent interface to various config files that make up Adobe Developer App Builder applications and extensions",
5
5
  "repository": "https://github.com/adobe/aio-cli-lib-app-config/",
6
6
  "license": "Apache-2.0",
@@ -18,9 +18,9 @@
18
18
  "generate-docs": "npm run typings && npm run jsdoc"
19
19
  },
20
20
  "dependencies": {
21
- "@adobe/aio-lib-core-config": "^3.0.0",
22
- "@adobe/aio-lib-core-logging": "^2.0.0",
23
- "@adobe/aio-lib-env": "^2.0.0",
21
+ "@adobe/aio-lib-core-config": "next",
22
+ "@adobe/aio-lib-core-logging": "next",
23
+ "@adobe/aio-lib-env": "next",
24
24
  "ajv": "^8.12.0",
25
25
  "ajv-formats": "^2.1.1",
26
26
  "fs-extra": "^9.0.1",
@@ -36,7 +36,7 @@
36
36
  "eslint-plugin-import": "^2.25.3",
37
37
  "eslint-plugin-jest": "^27",
38
38
  "eslint-plugin-jsdoc": "^42",
39
- "eslint-plugin-n": "^16",
39
+ "eslint-plugin-n": "^15.7.0",
40
40
  "eslint-plugin-node": "^11.1.0",
41
41
  "eslint-plugin-promise": "^6",
42
42
  "eslint-plugin-standard": "^4.0.0",
@@ -49,7 +49,7 @@
49
49
  "typescript": "^4.5.2"
50
50
  },
51
51
  "engines": {
52
- "node": "^14.18 || ^16.13 || >=18"
52
+ "node": ">=18"
53
53
  },
54
54
  "jest": {
55
55
  "collectCoverage": true,
@@ -74,5 +74,6 @@
74
74
  "setupFilesAfterEnv": [
75
75
  "./test/jest.setup.js"
76
76
  ]
77
- }
78
- }
77
+ },
78
+ "prereleaseSha": "754ff986ddcd5be75a3106e4da8af307b8c23f8a"
79
+ }
@@ -218,6 +218,7 @@
218
218
  "properties": {
219
219
  "type": { "type": "string", "enum": ["string", "boolean"] },
220
220
  "title": { "type": "string", "maxLength": 200 },
221
+ "description": { "type": "string", "maxLength": 1000 },
221
222
  "envKey": { "type": "string", "pattern": "[a-zA-Z_]{1,}[a-zA-Z0-9_]{0,}", "maxLength": 100 },
222
223
  "enum": { "type": "array", "items": { "$ref": "#/definitions/configSchemaValue" }, "minItems": 1, "maxItems": 100 },
223
224
  "default": { "$ref": "#/definitions/configSchemaValue" },
@@ -227,7 +228,7 @@
227
228
  "additionalProperties": false
228
229
  }
229
230
  },
230
- "configSchemaValue": { "type": "string", "maxLength": 1000 },
231
+ "configSchemaValue": { "type": ["string", "boolean"], "maxLength": 1000 },
231
232
  "productDependencies": {
232
233
  "type": "array",
233
234
  "items": {
package/src/index.js CHANGED
@@ -137,13 +137,16 @@ const cloneDeep = require('lodash.clonedeep')
137
137
  * }
138
138
  *
139
139
  * @param {object} options options to load Config
140
- * @param {boolean} options.allowNoImpl do not throw if there is no implementation
141
- * @param {boolean} options.ignoreAioConfig do not load .aio config via aio-lib-core-config, which is loaded synchronously and blocks the main thread.
140
+ * @param {boolean} [options.allowNoImpl=false] do not throw if there is no implementation
141
+ * @param {boolean} [options.ignoreAioConfig=false] do not load .aio config via aio-lib-core-config, which is loaded synchronously and blocks the main thread.
142
+ * @param {boolean} [options.validateAppConfig=true] set to false to not validate
142
143
  * @returns {object} the config
143
144
  */
144
145
  async function load (options = {}) {
145
146
  const allowNoImpl = options.allowNoImpl === undefined ? false : options.allowNoImpl
146
147
  const ignoreAioConfig = options.ignoreAioConfig === undefined ? false : options.ignoreAioConfig
148
+ const validateAppConfig = options.validateAppConfig === undefined ? true : options.validateAppConfig
149
+
147
150
  // *NOTE* it would be nice to support an appFolder option to load config from a different folder.
148
151
  // However, this requires to update aio-lib-core-config to support loading
149
152
  // from a different folder aswell (or enforcing ignore).
@@ -164,7 +167,9 @@ async function load (options = {}) {
164
167
  // this will resolve $include directives and output the app config into a single object
165
168
  // paths config values in $included files will be rewritten
166
169
  const appConfigWithIndex = await coalesce(defaults.USER_CONFIG_FILE, { absolutePaths: true })
167
- await validate(appConfigWithIndex.config, { throws: true })
170
+ if (validateAppConfig) {
171
+ await validate(appConfigWithIndex.config, { throws: true })
172
+ }
168
173
  const mergedAppConfig = await mergeLegacyAppConfig(appConfigWithIndex, legacyAppConfigWithIndex)
169
174
 
170
175
  appConfig = mergedAppConfig.config
@@ -589,7 +594,13 @@ async function buildSingleConfig (configName, singleUserConfig, commonConfig, in
589
594
  // Let's search the config path that defines a key in the same config object level as 'web' or
590
595
  // 'action'
591
596
  const otherKeyInObject = Object.keys(singleUserConfig)[0]
592
- const configFilePath = includeIndex[`${fullKeyPrefix}.${otherKeyInObject}`].file
597
+ let configFilePath
598
+ if (otherKeyInObject === undefined) {
599
+ // corner case if config is empty e.g. application: {}
600
+ configFilePath = includeIndex[`${fullKeyPrefix}`].file
601
+ } else {
602
+ configFilePath = includeIndex[`${fullKeyPrefix}.${otherKeyInObject}`].file
603
+ }
593
604
 
594
605
  const defaultActionPath = resolveToRoot('actions/', configFilePath)
595
606
  const defaultWebPath = resolveToRoot('web-src/', configFilePath)