@adobe/aio-cli-lib-app-config 3.0.1 → 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 +8 -7
- package/schema/app.config.yaml.schema.json +1 -1
- package/src/index.js +15 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/aio-cli-lib-app-config",
|
|
3
|
-
"version": "3.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": "
|
|
22
|
-
"@adobe/aio-lib-core-logging": "
|
|
23
|
-
"@adobe/aio-lib-env": "
|
|
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",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"typescript": "^4.5.2"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
|
-
"node": "
|
|
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
|
+
}
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"additionalProperties": false
|
|
229
229
|
}
|
|
230
230
|
},
|
|
231
|
-
"configSchemaValue": { "type": "string", "maxLength": 1000 },
|
|
231
|
+
"configSchemaValue": { "type": ["string", "boolean"], "maxLength": 1000 },
|
|
232
232
|
"productDependencies": {
|
|
233
233
|
"type": "array",
|
|
234
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
|
-
|
|
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
|
-
|
|
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)
|